@webority/ui-react 0.152.0 → 0.154.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.
- package/dist/canvas-kit/kit.js +11 -11
- package/dist/canvas-kit/manifest.json +38 -8
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppDrawer.js +1 -1
- package/dist/components/AppFileAttachment.js +1 -1
- package/dist/components/AppFilePicker.js +1 -1
- package/dist/components/AppFileViewer.js +1 -1
- package/dist/components/AppKanban.js +1 -1
- package/dist/components/AppLeadPopup.js +1 -1
- package/dist/components/AppLightbox.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppSlider.js +1 -1
- package/dist/components/AppThemeToggle.js +1 -1
- package/dist/components/AppTour.js +1 -1
- package/dist/guidance.json +1 -1
- package/dist/lib/fileItem.js +1 -1
- package/dist/lib/useTableView.js +1 -1
- package/dist/types/components/AppDrawer.d.ts +2 -2
- package/dist/types/components/AppSectionHero.d.ts +1 -1
- package/dist/types/components/AppSectionLogos.d.ts +1 -1
- package/dist/types/components/AppSectionPricing.d.ts +1 -1
- package/dist/types/components/AppSectionTestimonials.d.ts +1 -1
- package/dist/types/components/AppTour.d.ts +3 -3
- package/dist/types/lib/fileItem.d.ts +8 -2
- package/package.json +8 -8
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "WeborityWeb",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/ui-react",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.154.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 13,
|
|
8
8
|
"platform": "Web",
|
|
@@ -8299,7 +8299,7 @@
|
|
|
8299
8299
|
"name": "href",
|
|
8300
8300
|
"type": "url",
|
|
8301
8301
|
"required": false,
|
|
8302
|
-
"description": "Makes the value a link. Leave it out for a value that is not actionable."
|
|
8302
|
+
"description": "Makes the value a link; in layout list the whole row (icon, label and value) is the link. Leave it out for a value that is not actionable."
|
|
8303
8303
|
},
|
|
8304
8304
|
{
|
|
8305
8305
|
"name": "icon",
|
|
@@ -8721,9 +8721,9 @@
|
|
|
8721
8721
|
},
|
|
8722
8722
|
{
|
|
8723
8723
|
"name": "title",
|
|
8724
|
-
"type": "
|
|
8724
|
+
"type": "node",
|
|
8725
8725
|
"required": false,
|
|
8726
|
-
"description": "The heading,
|
|
8726
|
+
"description": "The heading. Text, or a node with an icon or badge. It names the dialog unless ariaLabel is set or a custom header replaces it; give ariaLabel with a custom header."
|
|
8727
8727
|
},
|
|
8728
8728
|
{
|
|
8729
8729
|
"name": "titleIcon",
|
|
@@ -19873,6 +19873,12 @@
|
|
|
19873
19873
|
"required": false,
|
|
19874
19874
|
"description": "Draws the eyebrow as a pill in this tone; unset keeps plain text."
|
|
19875
19875
|
},
|
|
19876
|
+
{
|
|
19877
|
+
"name": "id",
|
|
19878
|
+
"type": "string",
|
|
19879
|
+
"required": false,
|
|
19880
|
+
"description": "The section's id, the target of an in-page link."
|
|
19881
|
+
},
|
|
19876
19882
|
{
|
|
19877
19883
|
"name": "media",
|
|
19878
19884
|
"type": "node",
|
|
@@ -20195,6 +20201,12 @@
|
|
|
20195
20201
|
"required": false,
|
|
20196
20202
|
"description": "A short label above the heading."
|
|
20197
20203
|
},
|
|
20204
|
+
{
|
|
20205
|
+
"name": "id",
|
|
20206
|
+
"type": "string",
|
|
20207
|
+
"required": false,
|
|
20208
|
+
"description": "The section's id, the target of an in-page link."
|
|
20209
|
+
},
|
|
20198
20210
|
{
|
|
20199
20211
|
"name": "items",
|
|
20200
20212
|
"type": "array",
|
|
@@ -20345,6 +20357,12 @@
|
|
|
20345
20357
|
"required": false,
|
|
20346
20358
|
"description": "A short label above the heading."
|
|
20347
20359
|
},
|
|
20360
|
+
{
|
|
20361
|
+
"name": "id",
|
|
20362
|
+
"type": "string",
|
|
20363
|
+
"required": false,
|
|
20364
|
+
"description": "The section's id, the target of an in-page link."
|
|
20365
|
+
},
|
|
20348
20366
|
{
|
|
20349
20367
|
"name": "subtitle",
|
|
20350
20368
|
"type": "node",
|
|
@@ -20435,6 +20453,12 @@
|
|
|
20435
20453
|
"required": false,
|
|
20436
20454
|
"description": "A short label above the heading."
|
|
20437
20455
|
},
|
|
20456
|
+
{
|
|
20457
|
+
"name": "id",
|
|
20458
|
+
"type": "string",
|
|
20459
|
+
"required": false,
|
|
20460
|
+
"description": "The section's id, the target of an in-page link."
|
|
20461
|
+
},
|
|
20438
20462
|
{
|
|
20439
20463
|
"name": "items",
|
|
20440
20464
|
"type": "array",
|
|
@@ -27467,8 +27491,8 @@
|
|
|
27467
27491
|
{
|
|
27468
27492
|
"name": "target",
|
|
27469
27493
|
"type": "string",
|
|
27470
|
-
"required":
|
|
27471
|
-
"description": "A CSS selector for the element the step points at."
|
|
27494
|
+
"required": false,
|
|
27495
|
+
"description": "A CSS selector for the element the step points at. Left out, the step is a welcome card with no spotlight."
|
|
27472
27496
|
},
|
|
27473
27497
|
{
|
|
27474
27498
|
"name": "title",
|
|
@@ -27478,7 +27502,7 @@
|
|
|
27478
27502
|
}
|
|
27479
27503
|
],
|
|
27480
27504
|
"required": true,
|
|
27481
|
-
"description": "The steps, in order. A step whose target is missing or hidden is dropped."
|
|
27505
|
+
"description": "The steps, in order. A step with no target is a welcome card, centred over the page. A step whose target is missing or hidden is dropped."
|
|
27482
27506
|
},
|
|
27483
27507
|
{
|
|
27484
27508
|
"name": "tourId",
|
|
@@ -28653,6 +28677,7 @@
|
|
|
28653
28677
|
"info-text",
|
|
28654
28678
|
"info-text-on-soft",
|
|
28655
28679
|
"link",
|
|
28680
|
+
"link-hover",
|
|
28656
28681
|
"neutral",
|
|
28657
28682
|
"neutral-hover",
|
|
28658
28683
|
"neutral-pressed",
|
|
@@ -28839,6 +28864,7 @@
|
|
|
28839
28864
|
"info-text": "Info colour as text on a page or a soft info tint.",
|
|
28840
28865
|
"info-text-on-soft": "Info text on its own soft tint, such as an alert heading.",
|
|
28841
28866
|
"link": "Interactive link text.",
|
|
28867
|
+
"link-hover": "Link text while it is hovered.",
|
|
28842
28868
|
"neutral": "Quiet unbranded fill for supporting actions such as Back, Skip and Close.",
|
|
28843
28869
|
"neutral-hover": "Neutral fill while a control is hovered.",
|
|
28844
28870
|
"neutral-pressed": "Neutral fill while a control is pressed.",
|
|
@@ -29124,6 +29150,10 @@
|
|
|
29124
29150
|
"light": "#4f46e5",
|
|
29125
29151
|
"dark": "#aeaaf5"
|
|
29126
29152
|
},
|
|
29153
|
+
"link-hover": {
|
|
29154
|
+
"light": "#4338ca",
|
|
29155
|
+
"dark": "#c3c0f8"
|
|
29156
|
+
},
|
|
29127
29157
|
"neutral": {
|
|
29128
29158
|
"light": "#07143714",
|
|
29129
29159
|
"dark": "#e6e8ee14"
|
|
@@ -30797,7 +30827,7 @@
|
|
|
30797
30827
|
"removed": {
|
|
30798
30828
|
"backdrop": "removed: AppDrawer always draws its backdrop; use staticBackdrop to stop a click closing it",
|
|
30799
30829
|
"scroll": "removed: the page behind a drawer never scrolls",
|
|
30800
|
-
"keyboard": "removed: Escape
|
|
30830
|
+
"keyboard": "removed: Escape closes the drawer unless it is set dismissible={false}, which a drawer only an action closes needs",
|
|
30801
30831
|
"responsive": "removed: no inline mode; render the content in the page at that width instead",
|
|
30802
30832
|
"closeButton": "removed: set dismissible={false}"
|
|
30803
30833
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.154.0",
|
|
4
4
|
"platform": "Web",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 13,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/ui-react",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.154.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "7a8d4742968362427de5d0777656ec9c591183321585aa8494e7b4dda67f435e",
|
|
14
|
+
"bytes": 1015078
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "287dd9aeb8875b260ca14d057d6a023cd80ff29e9415574d758f9be96a93fe36",
|
|
18
|
+
"bytes": 9846214
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/DiscardPrompt.js";import{lockPageScroll as t}from"../lib/pageScrollLock.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useEffect as s,
|
|
1
|
+
import e from"../lib/DiscardPrompt.js";import{lockPageScroll as t}from"../lib/pageScrollLock.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useEffect as s,useId as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`end`,`start`],m=[`sm`,`md`,`lg`,`xl`],h=[50,90],g=()=>import(`@webority/ui-elements/elements/drawer`),_=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function v(v){n(`wui-drawer`,g);let{marker:ee,props:te}=r(`AppDrawer`,v),{open:y=!1,onClose:b,title:x,titleIcon:S,header:C,subtitle:w,ariaLabel:T,side:E=`end`,size:D=`md`,width:O,maxWidth:k,snapPoints:A=h,defaultSnap:j=0,sheet:M=!0,onSnapChange:N,onOpened:ne,onClosed:re,dismissible:P=!0,closeLabel:F=`Close`,sheetHeightLabel:I=`Sheet height`,staticBackdrop:L=!0,confirmDiscard:R,dirty:z=!1,headerClassName:B=``,bodyClassName:V=``,footer:H,className:U=``,style:W,children:G,...K}=te;o(`AppDrawer`,K),a(`AppDrawer`,`side`,E,p),a(`AppDrawer`,`size`,D,m),a(`AppDrawer`,`snapPoints`,_(A)?void 0:JSON.stringify(A),[`an array of numbers from 10 to 100`]);let q=c(),J=x!=null&&x!==!1&&x!==``,Y=l(null),X=l({dirty:!1}),Z=l(null),[Q,$]=u(!1);X.current={onClose:b,onSnapChange:N,onOpened:ne,onClosed:re,confirmDiscard:R,dirty:z},s(()=>{y||$(!1)},[y]),s(()=>{Q&&Z.current?.focus()},[Q]),s(()=>{if(y)return t()},[y]),s(()=>{let e=Y.current;if(!e)return;let t=t=>{t.target===e&&(t.preventDefault(),X.current.confirmDiscard&&X.current.dirty?$(!0):X.current.onClose?.())},n=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-drawer> snap arrived without its index and percent.`);X.current.onSnapChange?.(t.detail.index,t.detail.percent)}},r=t=>{t.target===e&&X.current.onOpened?.()},i=t=>{t.target===e&&X.current.onClosed?.()},a=n=>{n.target instanceof Element&&n.target.closest(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),e.addEventListener(`click`,a),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i),e.removeEventListener(`click`,a)}},[]);let ie=()=>{$(!1),Y.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),X.current.onClose?.()},ae=_(A)?A:h,oe={...O&&{"--wui-drawer-width":O},...k&&{"--wui-drawer-max-width":k},...W};return/* @__PURE__ */ f(`wui-drawer`,{ref:Y,...ee,...K,class:[`wui-drawer`,U].filter(Boolean).join(` `),side:E,size:D,"snap-points":ae.join(`,`),"default-snap":String(j),static:L?``:void 0,"no-sheet":M?void 0:``,"no-dismiss":P?void 0:``,"confirm-discard":R||void 0,open:y?``:void 0,style:oe,children:[/* @__PURE__ */ d(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),/* @__PURE__ */ f(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":T||void 0,"aria-labelledby":!T&&J&&C===void 0?q:void 0,tabIndex:-1,children:[M&&/* @__PURE__ */ d(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:/* @__PURE__ */ d(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":I})}),C===void 0?/* @__PURE__ */ f(`div`,{className:[`wui-drawer-header`,B].filter(Boolean).join(` `),"data-wui-drawer-grip":M?``:void 0,children:[/* @__PURE__ */ f(`div`,{className:`wui-drawer-headtext`,children:[J&&/* @__PURE__ */ f(`div`,{className:`wui-drawer-title`,id:q,children:[S&&/* @__PURE__ */ d(`span`,{className:`wui-drawer-title-ic`,children:/* @__PURE__ */ d(i,{name:S,size:18})}),x]}),w&&/* @__PURE__ */ d(`div`,{className:`wui-drawer-subtitle`,children:w})]}),P&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":F,children:/* @__PURE__ */ d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):C,/* @__PURE__ */ d(`div`,{className:[`wui-drawer-body`,V].filter(Boolean).join(` `),children:G}),(H||Q)&&/* @__PURE__ */ f(`div`,{className:Q?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[Q&&/* @__PURE__ */ d(e,{text:R,confirmRef:Z,onDiscard:ie,onKeep:()=>$(!1)}),H]})]})]})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/FileItemRow.js";import{keyOf as n,linkOf as r,nameOf as i,sizeLabelOf as a,uploadErrorOf as o,uploadProgressOf as s,useItemUrl as c}from"../lib/fileItem.js";import l from"../lib/fillLabel.js";import{linkTarget as ee}from"../lib/linkTarget.js";import{TargetLink as u}from"../lib/TargetLink.js";import d from"../lib/useFileDrop.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppIcon.js";import m from"./AppProgress.js";import h from"./warnUnknownProps.js";import{DEFAULT_IMAGE_ACCEPT as g,DEFAULT_MAX_SIZE_MB as _,acceptDroppedFiles as v,acceptLabel as y,isImageFile as b,isImageOnlyAccept as x}from"@webority/ui-elements/helpers";import{useId as S,useState as C}from"react";import{jsx as w,jsxs as T}from"react/jsx-runtime";function E(i){let{marker:a,props:o}=f(`AppFileAttachment`,i),{label:s=`Attachment`,value:c,name:l,onChange:ee,multiple:u=!1,accept:m=g,maxSizeMb:y=_,optional:E=!1,validate:A=!0,error:j,id:M,linkComponent:N,browseLabel:P=`Browse`,removeLabel:F=`Remove attachment`,uploadingLabel:te=`Uploading {name}`,maxSizeText:ne=`Up to {size} MB`,typesAndMaxSizeText:re=`{types}, up to {size} MB`,removeFileLabel:ie=`Remove {name}`,optionalLabel:ae=`(optional)`,dropTitle:oe,...I}=o;if(h(`AppFileAttachment`,I),!u&&Array.isArray(c))throw TypeError(`[@webority/ui-react] <AppFileAttachment> received a list of files as value without multiple. Pass one file (or null), or set multiple to take a list.`);let L=S(),R=M||L,[z,B]=C(``),V=Array.isArray(c)?c:c?[c]:[],H=x(m),U=e=>e instanceof File?b(e):H||b(O(e)),W=V[0],G=!u&&W!==void 0&&U(W)&&(W instanceof File||r(W)!==null)?W:void 0,K=D(m,y,ne,re),q=A?{accept:m,maxSizeMb:y,multiple:u}:{accept:``,maxSizeMb:0,multiple:u},J=e=>{i.multiple
|
|
1
|
+
import e from"../lib/FieldMessage.js";import t from"../lib/FileItemRow.js";import{keyOf as n,linkOf as r,nameOf as i,sizeLabelOf as a,uploadErrorOf as o,uploadProgressOf as s,useItemUrl as c}from"../lib/fileItem.js";import l from"../lib/fillLabel.js";import{linkTarget as ee}from"../lib/linkTarget.js";import{TargetLink as u}from"../lib/TargetLink.js";import d from"../lib/useFileDrop.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppIcon.js";import m from"./AppProgress.js";import h from"./warnUnknownProps.js";import{DEFAULT_IMAGE_ACCEPT as g,DEFAULT_MAX_SIZE_MB as _,acceptDroppedFiles as v,acceptLabel as y,isImageFile as b,isImageOnlyAccept as x}from"@webority/ui-elements/helpers";import{useId as S,useState as C}from"react";import{jsx as w,jsxs as T}from"react/jsx-runtime";function E(i){let{marker:a,props:o}=f(`AppFileAttachment`,i),{label:s=`Attachment`,value:c,name:l,onChange:ee,multiple:u=!1,accept:m=g,maxSizeMb:y=_,optional:E=!1,validate:A=!0,error:j,id:M,linkComponent:N,browseLabel:P=`Browse`,removeLabel:F=`Remove attachment`,uploadingLabel:te=`Uploading {name}`,maxSizeText:ne=`Up to {size} MB`,typesAndMaxSizeText:re=`{types}, up to {size} MB`,removeFileLabel:ie=`Remove {name}`,optionalLabel:ae=`(optional)`,dropTitle:oe,...I}=o;if(h(`AppFileAttachment`,I),!u&&Array.isArray(c))throw TypeError(`[@webority/ui-react] <AppFileAttachment> received a list of files as value without multiple. Pass one file (or null), or set multiple to take a list.`);let L=S(),R=M||L,[z,B]=C(``),V=Array.isArray(c)?c:c?[c]:[],H=x(m),U=e=>e instanceof File?b(e):H||b(O(e)),W=V[0],G=!u&&W!==void 0&&U(W)&&(W instanceof File||r(W)!==null)?W:void 0,K=D(m,y,ne,re),q=A?{accept:m,maxSizeMb:y,multiple:u}:{accept:``,maxSizeMb:0,multiple:u},J=e=>{i.multiple||i.onChange(e)},Y=e=>{i.multiple&&i.onChange(e)};function X(e){if(B(``),u){let t=Array.isArray(c)?c:c?[c]:[],r=new Set(t.map(n)),i=t.concat(e.filter(e=>!r.has(n(e))));Y(i)}else J(e[0]??null)}function se(e){if(!e.length)return;let{files:t,rejections:n}=v(e,q);t.length&&X(t),B(n[0]?.message??``)}let{dragOver:ce,dropProps:le}=d({...q,disabled:I.disabled,onFiles:X,onReject:e=>B(e.message)});function ue(e){let t=Array.from(e.target.files||[]);e.target.value=``,se(t)}function Z(e){B(``),u?Y(V.filter((t,n)=>n!==e)):J(null)}let Q=j||z,de=Q?`${R}-error`:void 0,fe=u||V.length===0,$=H?`image`:`file`,pe=oe??(u?`Add ${$}s`:`Add ${H?`an`:`a`} ${$}`);return/* @__PURE__ */ T(`div`,{...a,className:`field`,children:[/* @__PURE__ */ T(`label`,{className:`label`,htmlFor:R,children:[s,E&&/* @__PURE__ */ w(`span`,{className:`label-optional`,children:` ${ae}`})]}),/* @__PURE__ */ T(`label`,{className:`attach-drop${ce?` dragging`:``}`,htmlFor:R,style:fe?void 0:{display:`none`},...le,children:[/* @__PURE__ */ w(`span`,{className:`attach-drop-icon`,children:/* @__PURE__ */ w(p,{name:H?`image`:`file-text`,size:18})}),/* @__PURE__ */ T(`span`,{className:`attach-drop-copy`,children:[/* @__PURE__ */ w(`span`,{className:`attach-drop-title`,children:pe}),K&&/* @__PURE__ */ w(`span`,{className:`attach-drop-hint`,children:K})]}),/* @__PURE__ */ w(`span`,{className:`attach-drop-cta`,children:P})]}),/* @__PURE__ */ w(`input`,{id:R,type:`file`,className:`visually-hidden`,name:l,accept:m||void 0,multiple:u||void 0,"aria-describedby":de,onChange:ue,...I}),G?/* @__PURE__ */ w(k,{item:G,isImage:!0,linkComponent:N,onRemove:()=>Z(0),removeLabel:F,uploadingLabel:te}):V.length>0&&/* @__PURE__ */ w(`div`,{className:`attach-list`,children:V.map((e,r)=>/* @__PURE__ */ w(t,{item:e,isImage:U(e),linkComponent:N,onRemove:()=>Z(r),removeFileLabel:ie},n(e)))}),/* @__PURE__ */ w(e,{error:Q,errorId:`${R}-error`})]})}function D(e,t,n,r){let i=e?.trim()?y(e):``,a=t>0;return i&&a?l(r,{types:i,size:t}):a?l(n,{size:t}):i}function O({name:e,url:t}){return{...e===void 0?null:{name:e},...t===void 0?null:{url:t}}}function k({item:e,isImage:t,linkComponent:n,onRemove:d,removeLabel:f,uploadingLabel:h}){let g=c(e,t),_=i(e),v=a(e),y=s(e),b=o(e),x=r(e),S=e instanceof File?void 0:e.to,C=ee(n,{to:S,href:x??void 0,routeHref:!1});return/* @__PURE__ */ T(`div`,{className:b?`attach-preview wui-attach-failed`:`attach-preview`,children:[/* @__PURE__ */ T(`div`,{className:`attach-figure`,children:[/* @__PURE__ */ w(`img`,{src:g??void 0,alt:_}),/* @__PURE__ */ w(`button`,{type:`button`,className:`attach-remove`,"aria-label":f,onClick:d,children:/* @__PURE__ */ w(p,{name:`x`,size:18})})]}),/* @__PURE__ */ T(`div`,{className:`attach-meta`,children:[/* @__PURE__ */ w(`div`,{className:`attach-name`,children:x||S?/* @__PURE__ */ w(u,{link:C,children:_}):_}),v&&/* @__PURE__ */ w(`div`,{className:`attach-size`,children:v})]}),y!==null&&/* @__PURE__ */ w(m,{value:y,size:`sm`,label:l(h,{name:_}),className:`wui-attach-progress`}),b&&/* @__PURE__ */ w(`div`,{className:`wui-attach-error`,children:b})]})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{FIELD_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import a from"../lib/fillLabel.js";import o from"../lib/useFileDrop.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import re from"./AppSpinner.js";import c from"./assertValidValue.js";import ie from"./warnUnknownProps.js";import ae from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as oe,acceptDroppedFiles as se,acceptLabel as l,isImageFile as u,isImageOnlyAccept as ce,isPdfFile as le}from"@webority/ui-elements/helpers";import{useEffect as d,useId as ue,useRef as de,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var fe=[`dropzone`,`button`],pe={sm:` input-sm`,md:``,lg:` input-lg`},me={md:``,lg:` btn-lg`};function h(e){return e instanceof File?e:{url:e.url,...e.name===void 0?null:{name:e.name}}}function g(g){let{marker:he,props:ge}=ee(`AppFilePicker`,g),{label:_,value:v,name:_e,id:ve,onChange:ye,multiple:y=!1,variant:b=`dropzone`,buttonLabel:be=`Add file`,browseLabel:xe=`Click to upload`,dropLabel:Se=`or drag & drop`,maxSizeText:Ce=`up to {size} MB`,optionalLabel:we=`(optional)`,changeImageLabel:Te=`Change image`,changeFileLabel:Ee=`Change file`,maxFilesText:De=`Up to {count} files.`,removeFileLabel:Oe=`Remove {name}`,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=oe,required:w,optional:ke=!1,error:Ae,helperText:T,help:E,helpLabel:je=`More information`,loading:D=!1,readOnly:O=!1,size:k,disabled:A=!1,className:j=``,fieldClassName:M=``,style:N,...P}=ge;if(ie(`AppFilePicker`,P),c(`AppFilePicker`,`variant`,b,fe),c(`AppFilePicker`,`size`,k,r),!y&&Array.isArray(v))throw TypeError(`[@webority/ui-react] <AppFilePicker> received a list of files as value without multiple. Pass one file (or null), or set multiple to take a list.`);let F=k===void 0?``:pe[k]??``,I=O?{"aria-readonly":`true`,"data-wui-readonly":``}:null,[Me,L]=f(null),[Ne,R]=f(null),[Pe,z]=f(``),B=de(null),Fe=ue(),V=ve||Fe,H=A||D;d(()=>{if(!y&&v instanceof File&&u(v)){let e=URL.createObjectURL(v);return L(e),()=>URL.revokeObjectURL(e)}L(null)},[v,y]);let U=y||Array.isArray(v)?void 0:v,W=U&&!u(h(U))&&le(h(U))?U instanceof File?U:U.url:null;d(()=>{if(!W){R(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof W==`string`?{url:W}:W)).then(e=>{t&&(n=URL.createObjectURL(e),R(n))}).catch(t=>e(`[AppFilePicker] the PDF preview failed:`,t?.message)),()=>{t=!1,R(null),n&&URL.revokeObjectURL(n)}},[W]);let G=y?Array.isArray(v)?v:v?[v]:[]:[],K=Ae||Pe,q=K?`${V}-error`:void 0,J=T&&!K?`${V}-hint`:void 0,Ie=q||J,Y=ce(S),Le=b===`button`,Re=`btn btn-outline-primary${(k===`md`||k===`lg`?me[k]:void 0)??` btn-sm`}`,ze=!y&&!!v,X=!!U&&(U instanceof File?u(U):Y||u(h(U))),Be=U?.name,Ve=U instanceof File?void 0:U?.url,He=X?Ve||Me:Ne,Z=X?`image`:`file`,Ue=_?`Change ${_}`:`Change ${Z}`,We=_?`Remove ${_}`:`Remove ${Z}`,Ge=_?`${_} preview`:`Selected ${Z} preview`,Ke={accept:S,maxSizeMb:C,multiple:y},qe=e=>{g.multiple
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{FIELD_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import a from"../lib/fillLabel.js";import o from"../lib/useFileDrop.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import re from"./AppSpinner.js";import c from"./assertValidValue.js";import ie from"./warnUnknownProps.js";import ae from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as oe,acceptDroppedFiles as se,acceptLabel as l,isImageFile as u,isImageOnlyAccept as ce,isPdfFile as le}from"@webority/ui-elements/helpers";import{useEffect as d,useId as ue,useRef as de,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var fe=[`dropzone`,`button`],pe={sm:` input-sm`,md:``,lg:` input-lg`},me={md:``,lg:` btn-lg`};function h(e){return e instanceof File?e:{url:e.url,...e.name===void 0?null:{name:e.name}}}function g(g){let{marker:he,props:ge}=ee(`AppFilePicker`,g),{label:_,value:v,name:_e,id:ve,onChange:ye,multiple:y=!1,variant:b=`dropzone`,buttonLabel:be=`Add file`,browseLabel:xe=`Click to upload`,dropLabel:Se=`or drag & drop`,maxSizeText:Ce=`up to {size} MB`,optionalLabel:we=`(optional)`,changeImageLabel:Te=`Change image`,changeFileLabel:Ee=`Change file`,maxFilesText:De=`Up to {count} files.`,removeFileLabel:Oe=`Remove {name}`,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=oe,required:w,optional:ke=!1,error:Ae,helperText:T,help:E,helpLabel:je=`More information`,loading:D=!1,readOnly:O=!1,size:k,disabled:A=!1,className:j=``,fieldClassName:M=``,style:N,...P}=ge;if(ie(`AppFilePicker`,P),c(`AppFilePicker`,`variant`,b,fe),c(`AppFilePicker`,`size`,k,r),!y&&Array.isArray(v))throw TypeError(`[@webority/ui-react] <AppFilePicker> received a list of files as value without multiple. Pass one file (or null), or set multiple to take a list.`);let F=k===void 0?``:pe[k]??``,I=O?{"aria-readonly":`true`,"data-wui-readonly":``}:null,[Me,L]=f(null),[Ne,R]=f(null),[Pe,z]=f(``),B=de(null),Fe=ue(),V=ve||Fe,H=A||D;d(()=>{if(!y&&v instanceof File&&u(v)){let e=URL.createObjectURL(v);return L(e),()=>URL.revokeObjectURL(e)}L(null)},[v,y]);let U=y||Array.isArray(v)?void 0:v,W=U&&!u(h(U))&&le(h(U))?U instanceof File?U:U.url:null;d(()=>{if(!W){R(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof W==`string`?{url:W}:W)).then(e=>{t&&(n=URL.createObjectURL(e),R(n))}).catch(t=>e(`[AppFilePicker] the PDF preview failed:`,t?.message)),()=>{t=!1,R(null),n&&URL.revokeObjectURL(n)}},[W]);let G=y?Array.isArray(v)?v:v?[v]:[]:[],K=Ae||Pe,q=K?`${V}-error`:void 0,J=T&&!K?`${V}-hint`:void 0,Ie=q||J,Y=ce(S),Le=b===`button`,Re=`btn btn-outline-primary${(k===`md`||k===`lg`?me[k]:void 0)??` btn-sm`}`,ze=!y&&!!v,X=!!U&&(U instanceof File?u(U):Y||u(h(U))),Be=U?.name,Ve=U instanceof File?void 0:U?.url,He=X?Ve||Me:Ne,Z=X?`image`:`file`,Ue=_?`Change ${_}`:`Change ${Z}`,We=_?`Remove ${_}`:`Remove ${Z}`,Ge=_?`${_} preview`:`Selected ${Z} preview`,Ke={accept:S,maxSizeMb:C,multiple:y},qe=e=>{g.multiple||g.onChange(e)},Je=e=>{g.multiple&&g.onChange(e)},Ye=e=>{if(z(``),!y){qe(e[0]??null);return}let t=Array.isArray(v)?v:v?[v]:[],n=new Set(t.map(i)),r=[];for(let t of e)n.has(i(t))||(n.add(i(t)),r.push(t));let o=t.concat(r);x&&o.length>x&&(o=o.slice(0,x),z(a(De,{count:x}))),Je(o)},Xe=e=>z(e.message),{dragOver:Ze,dropProps:Qe}=o({...Ke,disabled:H||O,onFiles:Ye,onReject:Xe}),$e=e=>{if(O)return;let{files:t,rejections:n}=se(e,Ke);t.length&&Ye(t);let[r]=n;r&&Xe(r)},et=e=>$e(e.target.files),tt=e=>{O||(z(``),Je(G.filter((t,n)=>n!==e)))},nt=()=>{O||B.current?.click()},Q=D?/* @__PURE__ */ p(`span`,{className:`wui-file-busy`,children:/* @__PURE__ */ p(re,{size:`sm`})}):null,$=/* @__PURE__ */ p(`input`,{id:V,name:_e,ref:B,type:`file`,"aria-describedby":Ie,accept:S,multiple:y||void 0,disabled:H||void 0,className:`visually-hidden`,onClick:e=>{O?e.preventDefault():e.currentTarget.value=``},onChange:et,...P});return/* @__PURE__ */ m(`div`,{...he,className:`field${M?` ${M}`:``}`,children:[_?/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:V,children:[_,ke&&!w&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${we}`}),w&&/* @__PURE__ */ p(ne,{}),E&&/* @__PURE__ */ p(te,{label:je,children:E})]}):null,Le?/* @__PURE__ */ m(`div`,{className:`file-input wui-file-input-button-field${F}${K?` error`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,...I,children:[/* @__PURE__ */ m(`label`,{htmlFor:V,className:Re,children:[/* @__PURE__ */ p(s,{name:`paperclip`,size:16}),be]}),$,Q]}):ze?/* @__PURE__ */ m(`div`,{className:`file-preview${F}${K?` error`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,...I,children:[/* @__PURE__ */ m(`button`,{type:`button`,className:`file-preview-open`,"aria-label":Ue,onClick:nt,disabled:H||O,children:[He?/* @__PURE__ */ p(`img`,{src:He,alt:Ge,className:`file-preview-img`}):/* @__PURE__ */ m(`span`,{className:`file-preview-file`,children:[/* @__PURE__ */ p(s,{name:`file-text`,size:28}),/* @__PURE__ */ p(`span`,{className:`file-preview-file-name`,children:Be})]}),/* @__PURE__ */ p(`span`,{className:`file-preview-overlay`,children:/* @__PURE__ */ m(`span`,{className:`file-preview-cta`,children:[/* @__PURE__ */ p(s,{name:X?`image`:`file-text`,size:16}),` `,X?Te:Ee]})})]}),ae(/* @__PURE__ */ p(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":We,onClick:()=>qe(null),disabled:H||O,children:/* @__PURE__ */ p(s,{name:`x`,size:16})}),We),$,Q]}):/* @__PURE__ */ m(`div`,{className:`file-input file-input-tall${F}${Ze?` dragging`:``}${K?` error`:``}${y&&G.length>0?` has-files`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,"aria-disabled":A||void 0,...I,...Qe,children:[/* @__PURE__ */ m(`label`,{htmlFor:V,className:`file-input-zone-label`,children:[/* @__PURE__ */ p(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ p(s,{name:`upload`,size:24})}),/* @__PURE__ */ m(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ p(`span`,{className:`browse`,children:xe}),` ${Se}`]}),/* @__PURE__ */ p(`span`,{className:`file-input-text`,children:C>0?`${l(S)}, ${a(Ce,{size:C})}`:l(S)})]}),$,Q,y&&G.length>0&&/* @__PURE__ */ p(`div`,{className:`attach-list`,children:G.map((e,t)=>/* @__PURE__ */ p(n,{item:e,isImage:e instanceof File?u(e):Y||u(h(e)),noun:`file`,removeFileLabel:Oe,readOnly:O,onRemove:()=>tt(t)},i(e)))})]}),/* @__PURE__ */ p(t,{error:K,hint:T,errorId:q,hintId:J})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{createElement as r,forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{createPortal as p}from"react-dom";var m=`wui-file-viewer:load`,h=`wui-file-viewer:error`,g=`wui-file-viewer:prefs-change`,_=()=>import(`@webority/ui-elements/file-viewer`),v=i(function(i,v){let{marker:y,props:b}=t(`AppFileViewer`,i),{src:x,name:S,type:C,prefs:w,onPrefsChange:T,viewKey:E,download:D=!1,print:O=!0,workerSrc:k,assetBase:A,captions:j,actions:M,onLoad:N,onError:P,className:F=``,style:I,...L}=b;n(`AppFileViewer`,L);let R=e(`wui-file-viewer`,_),z=c(null),B=c(N),V=c(P),H=c(T),[U,W]=l(null),G=a(e=>{z.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]);s(()=>{if(!R||w===void 0)return;let e=z.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);e.prefs=w},[w,R]),o(()=>{B.current=N,V.current=P,H.current=T}),o(()=>{let e=z.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);let t=e=>{e instanceof CustomEvent
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{createElement as r,forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{createPortal as p}from"react-dom";var m=`wui-file-viewer:load`,h=`wui-file-viewer:error`,g=`wui-file-viewer:prefs-change`,_=()=>import(`@webority/ui-elements/file-viewer`),v=i(function(i,v){let{marker:y,props:b}=t(`AppFileViewer`,i),{src:x,name:S,type:C,prefs:w,onPrefsChange:T,viewKey:E,download:D=!1,print:O=!0,workerSrc:k,assetBase:A,captions:j,actions:M,onLoad:N,onError:P,className:F=``,style:I,...L}=b;n(`AppFileViewer`,L);let R=e(`wui-file-viewer`,_),z=c(null),B=c(N),V=c(P),H=c(T),[U,W]=l(null),G=a(e=>{z.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]);s(()=>{if(!R||w===void 0)return;let e=z.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);e.prefs=w},[w,R]),o(()=>{B.current=N,V.current=P,H.current=T}),o(()=>{let e=z.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:load arrived without a CustomEvent`);B.current?.(e.detail)},n=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:error arrived without a CustomEvent`);V.current?.(e.detail)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:prefs-change arrived without a CustomEvent`);H.current?.(e.detail)};return e.addEventListener(m,t),e.addEventListener(h,n),e.addEventListener(g,r),()=>{e.removeEventListener(m,t),e.removeEventListener(h,n),e.removeEventListener(g,r)}},[]),o(()=>{if(!R)return;let e=z.current;e?.isConnected&&W(e.actionsContainer)},[R]);let K=I&&I.height!==void 0&&I.minHeight===void 0?{...I,minHeight:0}:I;return/* @__PURE__ */ f(u,{children:[r(`wui-file-viewer`,{ref:G,src:x,name:S||void 0,type:C||void 0,"view-key":E||void 0,download:D?``:void 0,print:O?void 0:`false`,"worker-src":k||void 0,"asset-base":A||void 0,captions:j||void 0,className:F||void 0,style:K,...y,...L}),U&&M!=null&&p(/* @__PURE__ */ d(`div`,{slot:`actions`,className:`wui-file-viewer-slot`,children:M}),U)]})});export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/fillLabel.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import{errorToast as s}from"./toast.js";import c from"./warnUnknownProps.js";import{KANBAN_SUMMARY_FORMATS as l,KANBAN_TEXT as u,KANBAN_TONES as d,formatValue as ee,kanbanOverflow as te,kanbanSummaryFormat as f,kanbanVisibleLimit as ne,sumKanbanValues as re}from"@webority/ui-elements/helpers";import{useEffect as p,useId as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";var ie=()=>import(`@webority/ui-elements/elements/kanban`),ae=e=>e.key??e.id,oe=e=>e.column,b=[`rupees`,`paise`],se=[`inline`,`stacked`];function ce(e){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:void 0}function x(x){let S=r(`wui-kanban`,ie),{marker:le,props:ue}=i(`AppKanban`,x),{columns:C,cards:w,renderCard:de,renderColumnActions:fe,getCardKey:T=ae,getCardColumn:E=oe,getCardValue:D,cardLabel:O,isCardLocked:pe,onLocked:k,onMove:A,accept:j,filter:me,boardId:he,ariaLabel:ge=`Board`,columnsLabel:_e=`Board columns`,expandLabel:ve=`Expand {title}`,collapseLabel:ye=`Collapse {title}`,emptyText:be=u.empty,helpText:xe=u.help,readOnly:Se=!1,swipeHint:Ce=!1,swipeHintText:M=u.swipeHint,fill:we=!1,columnWidth:N,fillOffset:P,activeCardKey:F,headLayout:I=`inline`,truncateHeads:L=!1,summaryFormat:R,summaryUnit:z,className:B=``,id:Te,linkComponent:Ee,...V}=ue;if(!Array.isArray(C))throw Error(`<AppKanban> columns is required: pass the board's stage columns.`);if(!Array.isArray(w))throw Error(`<AppKanban> cards is required: pass the cards, an empty array for an empty board.`);c(`AppKanban`,V),o(`AppKanban`,`summaryFormat`,R,l),o(`AppKanban`,`summaryUnit`,z,b),o(`AppKanban`,`headLayout`,I,se);for(let e of C)o(`AppKanban`,`columns[].tone`,e.tone,d);let De=m(),H=Te||`kanban-${De.replace(/[^a-zA-Z0-9_-]/g,``)}`,U=g(null),[W,G]=_(()=>/* @__PURE__ */ new Map),[K,Oe]=_(()=>/* @__PURE__ */ new Set),[ke,q]=_(()=>/* @__PURE__ */ new Set),J=h(()=>new Map(w.map(e=>[String(T(e)),e])),[w,T]),Y=g({accept:j,onMove:A,onLocked:k,byKey:J,columns:C});Y.current={accept:j,onMove:A,onLocked:k,byKey:J,columns:C};let X=R&&l.includes(R)&&(z==null||b.includes(z))?f(R,z):null,Z=h(()=>{let e=new Map(C.map(e=>[e.key,[]])),t=[];for(let n of w){let r=String(T(n)),i=W.get(r);i?t.push([n,i]):e.get(E(n))?.push(n)}for(let[n,r]of t){let t=e.get(r.to);t&&t.splice(Math.min(r.index,t.length),0,n)}return e},[C,w,W,T,E]);p(()=>{let e=U.current;if(!e||!S)return;e.accept=(e,t,n)=>{let r=Y.current.accept;return!r||r(Y.current.byKey.get(e.getAttribute(`data-wui-card`)??``),t,n)};let t=e=>{if(!(e instanceof CustomEvent))
|
|
1
|
+
import e from"../lib/fillLabel.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import{errorToast as s}from"./toast.js";import c from"./warnUnknownProps.js";import{KANBAN_SUMMARY_FORMATS as l,KANBAN_TEXT as u,KANBAN_TONES as d,formatValue as ee,kanbanOverflow as te,kanbanSummaryFormat as f,kanbanVisibleLimit as ne,sumKanbanValues as re}from"@webority/ui-elements/helpers";import{useEffect as p,useId as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";var ie=()=>import(`@webority/ui-elements/elements/kanban`),ae=e=>e.key??e.id,oe=e=>e.column,b=[`rupees`,`paise`],se=[`inline`,`stacked`];function ce(e){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:void 0}function x(x){let S=r(`wui-kanban`,ie),{marker:le,props:ue}=i(`AppKanban`,x),{columns:C,cards:w,renderCard:de,renderColumnActions:fe,getCardKey:T=ae,getCardColumn:E=oe,getCardValue:D,cardLabel:O,isCardLocked:pe,onLocked:k,onMove:A,accept:j,filter:me,boardId:he,ariaLabel:ge=`Board`,columnsLabel:_e=`Board columns`,expandLabel:ve=`Expand {title}`,collapseLabel:ye=`Collapse {title}`,emptyText:be=u.empty,helpText:xe=u.help,readOnly:Se=!1,swipeHint:Ce=!1,swipeHintText:M=u.swipeHint,fill:we=!1,columnWidth:N,fillOffset:P,activeCardKey:F,headLayout:I=`inline`,truncateHeads:L=!1,summaryFormat:R,summaryUnit:z,className:B=``,id:Te,linkComponent:Ee,...V}=ue;if(!Array.isArray(C))throw Error(`<AppKanban> columns is required: pass the board's stage columns.`);if(!Array.isArray(w))throw Error(`<AppKanban> cards is required: pass the cards, an empty array for an empty board.`);c(`AppKanban`,V),o(`AppKanban`,`summaryFormat`,R,l),o(`AppKanban`,`summaryUnit`,z,b),o(`AppKanban`,`headLayout`,I,se);for(let e of C)o(`AppKanban`,`columns[].tone`,e.tone,d);let De=m(),H=Te||`kanban-${De.replace(/[^a-zA-Z0-9_-]/g,``)}`,U=g(null),[W,G]=_(()=>/* @__PURE__ */ new Map),[K,Oe]=_(()=>/* @__PURE__ */ new Set),[ke,q]=_(()=>/* @__PURE__ */ new Set),J=h(()=>new Map(w.map(e=>[String(T(e)),e])),[w,T]),Y=g({accept:j,onMove:A,onLocked:k,byKey:J,columns:C});Y.current={accept:j,onMove:A,onLocked:k,byKey:J,columns:C};let X=R&&l.includes(R)&&(z==null||b.includes(z))?f(R,z):null,Z=h(()=>{let e=new Map(C.map(e=>[e.key,[]])),t=[];for(let n of w){let r=String(T(n)),i=W.get(r);i?t.push([n,i]):e.get(E(n))?.push(n)}for(let[n,r]of t){let t=e.get(r.to);t&&t.splice(Math.min(r.index,t.length),0,n)}return e},[C,w,W,T,E]);p(()=>{let e=U.current;if(!e||!S)return;e.accept=(e,t,n)=>{let r=Y.current.accept;return!r||r(Y.current.byKey.get(e.getAttribute(`data-wui-card`)??``),t,n)};let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:kanban:move arrived without a CustomEvent`);let{key:t,from:n,to:r,index:i}=e.detail,a=Y.current.onMove,o=Y.current.byKey.get(t);if(!a||!o)return;let c=Y.current.columns.find(e=>e.key===r)?.visibleLimit!=null;c&&q(e=>new Set(e).add(t)),G(e=>new Map(e).set(t,{to:r,index:i}));let l=()=>G(e=>{let n=new Map(e);return n.delete(t),n}),d;try{d=a({card:o,key:t,from:n,to:r,index:i})}catch(e){d=Promise.reject(e)}Promise.resolve(d).then(l,e=>{l(),c&&q(e=>{let n=new Set(e);return n.delete(t),n}),s(ce(e)||u.failed.server)})},n=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:kanban:locked arrived without a CustomEvent`);let{key:t,reason:n}=e.detail,r=Y.current.byKey.get(t);r&&Y.current.onLocked?.({card:r,key:t,reason:n})};return e.addEventListener(`wui:kanban:move`,t),e.addEventListener(`wui:kanban:locked`,n),()=>{e.removeEventListener(`wui:kanban:move`,t),e.removeEventListener(`wui:kanban:locked`,n),e.accept=void 0}},[S]);let Q=e=>me?.(e)!==!1,Ae=(e,t)=>{K.has(e)&&q(e=>{let n=new Set(e);for(let e of t)n.delete(String(T(e)));return n}),Oe(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},$={};return N!=null&&($[`--wui-kanban-column-width`]=`${N}px`),P!=null&&($[`--wui-kanban-fill-offset`]=`${P}px`),/* @__PURE__ */ y(`wui-kanban`,{ref:U,id:H,class:B?`wui-kanban ${B}`:`wui-kanban`,role:`region`,"aria-label":ge,"board-id":he||void 0,"summary-format":X?R:void 0,"summary-unit":X&&z?z:void 0,readonly:Se?``:void 0,fill:we?``:void 0,"data-head-layout":I===`stacked`?`stacked`:void 0,"data-head-truncate":L?``:void 0,style:$,controlled:``,...le,...V,children:[/* @__PURE__ */ v(`nav`,{className:`wui-kanban-switcher`,"aria-label":_e,children:C.map((e,t)=>/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-kanban-switch`,"data-wui-switch":e.key,"aria-controls":`${H}-${e.key}`,"aria-current":t===0?`true`:void 0,children:[/* @__PURE__ */ v(`span`,{className:`wui-kanban-switch-title`,children:e.title}),/* @__PURE__ */ v(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:(Z.get(e.key)||[]).filter(Q).length})]},e.key))}),Ce&&/* @__PURE__ */ y(`p`,{className:`wui-kanban-hint`,"aria-hidden":`true`,children:[/* @__PURE__ */ v(a,{name:`arrow-swap-horizontal`,size:14}),M]}),/* @__PURE__ */ v(`div`,{className:`wui-kanban-board`,"data-wui-scroller":``,children:C.map(r=>{let i=t(Ee,{href:r.href}),o=`${H}-${r.key}`,s=Z.get(r.key)||[],c=s.filter(Q),l=!!(r.collapsible&&r.collapsed),f=ne(r.visibleLimit),p=K.has(r.key),m=te(c.map(e=>String(T(e))),f,p,ke),h=typeof r.summary==`function`?r.summary(c):r.summary;X&&(h=ee(re(c.map(e=>D?.(e))),X));let g=fe?.(r,c);return/* @__PURE__ */ y(`section`,{className:`wui-kanban-column`,id:o,"data-wui-column":r.key,"data-tone":r.tone&&d.includes(r.tone)?r.tone:`neutral`,"aria-labelledby":`${o}-title`,"data-accept-from":r.acceptFrom?r.acceptFrom.join(` `):void 0,"data-collapsible":r.collapsible?``:void 0,"data-collapsed":l?``:void 0,children:[/* @__PURE__ */ y(`header`,{className:`wui-kanban-head`,children:[/* @__PURE__ */ v(`span`,{className:`wui-kanban-dot`,"aria-hidden":`true`}),/* @__PURE__ */ v(`h2`,{className:`wui-kanban-title`,id:`${o}-title`,title:L?r.title:void 0,children:r.href?/* @__PURE__ */ v(n,{link:i,children:r.title}):r.title}),/* @__PURE__ */ v(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:c.length}),r.collapsible&&/* @__PURE__ */ v(`span`,{className:`wui-kanban-lock`,"aria-hidden":`true`,children:/* @__PURE__ */ v(a,{name:`lock`,size:14})}),g!=null&&g!==!1&&/* @__PURE__ */ v(`div`,{className:`wui-kanban-actions`,"data-wui-no-drag":``,children:g}),r.collapsible&&/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-kanban-collapse`,"data-wui-collapse":``,"aria-expanded":l?`false`:`true`,"aria-controls":`${o}-body`,"aria-label":e(l?ve:ye,{title:r.title}),children:/* @__PURE__ */ v(a,{name:`chevron-left`,size:16})}),h!=null&&/* @__PURE__ */ v(`div`,{className:`wui-kanban-summary`,"data-wui-summary":``,children:h})]}),/* @__PURE__ */ v(`p`,{className:`wui-kanban-drop-note`,"data-wui-drop-note":``,hidden:!0}),/* @__PURE__ */ v(`div`,{className:`wui-kanban-body`,id:`${o}-body`,"data-wui-body":``,children:s.map(e=>{let t=String(T(e)),n=W.has(t);return/* @__PURE__ */ v(`article`,{className:`wui-kanban-card`,"data-wui-card":t,tabIndex:0,"aria-label":O?O(e):void 0,"data-wui-locked":pe?.(e)?``:void 0,"data-wui-value":D?D(e)??void 0:void 0,"aria-current":F!=null&&t===String(F)?`true`:void 0,"aria-busy":n?`true`:void 0,"data-wui-saving":n?``:void 0,"data-wui-overflow":m.has(t)?``:void 0,hidden:!Q(e),children:de?.(e)},t)})}),f!=null&&/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-kanban-more`,"data-wui-more":``,"aria-controls":`${o}-body`,"aria-expanded":p?`true`:`false`,hidden:p?c.length<=f:m.size===0,onClick:()=>Ae(r.key,s),children:p?u.fewer:u.more(m.size)}),/* @__PURE__ */ v(`p`,{className:`wui-kanban-empty`,"data-wui-empty":``,hidden:c.length>0,children:r.emptyText??be})]},r.key)})}),/* @__PURE__ */ v(`p`,{className:`visually-hidden`,id:`${H}-help`,"data-wui-help":``,children:xe}),/* @__PURE__ */ v(`div`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./useWuiControl.js";import i from"./warnUnknownProps.js";import{forwardRef as a,useEffect as ee}from"react";import{jsx as o}from"react/jsx-runtime";var s=[`name`,`email`,`phone`,`company`,`message`,`consent`],c=[`exit`,`delay`,`scroll`,`pages`],l=()=>import(`@webority/ui-elements/elements/lead-popup`),u=e=>e?.length?e.join(` `):void 0,d=e=>{let t=Object.entries(e??{});return t.length?t.map(([e,t])=>`${e}=${t}`).join(`;`):void 0},f=a(function(a,f){let p=e(`wui-lead-popup`,l),{marker:m,props:h}=t(`AppLeadPopup`,a),{action:g,publicForm:_,title:v,description:y,fields:b=[`name`,`email`],required:x=[],fieldPrefix:S,fieldNames:C,labels:w,maxLengths:T,consentHref:E,submitLabel:D,successTitle:O,successText:k,errorText:A,closeLabel:j,secondaryLabel:M,secondaryHref:N,secondaryDivider:P,triggers:F=[],delaySeconds:I,scrollPercent:L,pagesViewed:R,storageKey:z,dismissDays:B,submittedDays:V,successCloseSeconds:H,preview:U=!1,onShown:W,onBeforeSubmit:G,onSubmitted:K,onError:q,onClosed:J,className:Y=``,style:X,...Z}=h;i(`AppLeadPopup`,Z);for(let e of b)n(`AppLeadPopup`,`fields`,e,s);for(let e of x)n(`AppLeadPopup`,`required`,e,s);for(let e of F)n(`AppLeadPopup`,`triggers`,e,c);let{setRef:Q,innerRef:$}=r({ready:p,ref:f});return ee(()=>{let e=$.current;if(!e)return;let t=[[`wui-lead-popup-shown`,e=>e instanceof CustomEvent
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./useWuiControl.js";import i from"./warnUnknownProps.js";import{forwardRef as a,useEffect as ee}from"react";import{jsx as o}from"react/jsx-runtime";var s=[`name`,`email`,`phone`,`company`,`message`,`consent`],c=[`exit`,`delay`,`scroll`,`pages`],l=()=>import(`@webority/ui-elements/elements/lead-popup`),u=e=>e?.length?e.join(` `):void 0,d=e=>{let t=Object.entries(e??{});return t.length?t.map(([e,t])=>`${e}=${t}`).join(`;`):void 0},f=a(function(a,f){let p=e(`wui-lead-popup`,l),{marker:m,props:h}=t(`AppLeadPopup`,a),{action:g,publicForm:_,title:v,description:y,fields:b=[`name`,`email`],required:x=[],fieldPrefix:S,fieldNames:C,labels:w,maxLengths:T,consentHref:E,submitLabel:D,successTitle:O,successText:k,errorText:A,closeLabel:j,secondaryLabel:M,secondaryHref:N,secondaryDivider:P,triggers:F=[],delaySeconds:I,scrollPercent:L,pagesViewed:R,storageKey:z,dismissDays:B,submittedDays:V,successCloseSeconds:H,preview:U=!1,onShown:W,onBeforeSubmit:G,onSubmitted:K,onError:q,onClosed:J,className:Y=``,style:X,...Z}=h;i(`AppLeadPopup`,Z);for(let e of b)n(`AppLeadPopup`,`fields`,e,s);for(let e of x)n(`AppLeadPopup`,`required`,e,s);for(let e of F)n(`AppLeadPopup`,`triggers`,e,c);let{setRef:Q,innerRef:$}=r({ready:p,ref:f});return ee(()=>{let e=$.current;if(!e)return;let t=[[`wui-lead-popup-shown`,e=>{if(!(e instanceof CustomEvent))throw Error(`wui-lead-popup-shown arrived without a CustomEvent`);W?.(e.detail)}],[`wui-lead-popup-before-submit`,e=>{if(!(e instanceof CustomEvent))throw Error(`wui-lead-popup-before-submit arrived without a CustomEvent`);G?.(e.detail.formData)}],[`wui-lead-popup-submitted`,e=>{if(!(e instanceof CustomEvent))throw Error(`wui-lead-popup-submitted arrived without a CustomEvent`);K?.(e.detail)}],[`wui-lead-popup-error`,e=>{if(!(e instanceof CustomEvent))throw Error(`wui-lead-popup-error arrived without a CustomEvent`);q?.(e.detail)}],[`wui-lead-popup-closed`,e=>{if(!(e instanceof CustomEvent))throw Error(`wui-lead-popup-closed arrived without a CustomEvent`);J?.(e.detail.reason)}]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[$,W,G,K,q,J]),/* @__PURE__ */ o(`wui-lead-popup`,{ref:Q,action:g||void 0,"public-form":_||void 0,heading:v||void 0,description:y||void 0,fields:u(b),required:u(x),"field-prefix":S||void 0,"field-names":d(C),labels:d(w),"max-lengths":d(T),"consent-href":E||void 0,"submit-label":D||void 0,"success-title":O||void 0,"success-text":k||void 0,"error-text":A||void 0,"close-label":j||void 0,"secondary-label":M||void 0,"secondary-href":N||void 0,"secondary-divider":P||void 0,triggers:u(F),"delay-seconds":I??void 0,"scroll-percent":L??void 0,"pages-viewed":R??void 0,"storage-key":z||void 0,"dismiss-days":B??void 0,"submitted-days":V??void 0,"success-close-seconds":H??void 0,preview:U||void 0,class:Y||void 0,style:X,...m,...Z})});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{useEffect as i,useRef as a}from"react";import{jsx as o}from"react/jsx-runtime";var s=[`gallery`,`single`],c=()=>import(`@webority/ui-elements/elements/lightbox`);function l(l){e(`wui-lightbox`,c);let{marker:u,props:d}=t(`AppLightbox`,l),{items:f=[],download:p=!1,label:m,layout:h=`gallery`,openIndex:g,onChange:_,onClose:v,className:y=``,...b}=d;r(`AppLightbox`,b),n(`AppLightbox`,`layout`,h,s);let x=a(null),S=a({onChange:_,onClose:v});return i(()=>{S.current={onChange:_,onClose:v}}),i(()=>{let e=x.current;if(e===null)throw Error(`<AppLightbox> lost its element before mount`);let t=e=>{e instanceof CustomEvent
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{useEffect as i,useRef as a}from"react";import{jsx as o}from"react/jsx-runtime";var s=[`gallery`,`single`],c=()=>import(`@webority/ui-elements/elements/lightbox`);function l(l){e(`wui-lightbox`,c);let{marker:u,props:d}=t(`AppLightbox`,l),{items:f=[],download:p=!1,label:m,layout:h=`gallery`,openIndex:g,onChange:_,onClose:v,className:y=``,...b}=d;r(`AppLightbox`,b),n(`AppLightbox`,`layout`,h,s);let x=a(null),S=a({onChange:_,onClose:v});return i(()=>{S.current={onChange:_,onClose:v}}),i(()=>{let e=x.current;if(e===null)throw Error(`<AppLightbox> lost its element before mount`);let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-lightbox:change arrived without a CustomEvent`);S.current.onChange?.(e.detail.index)},n=()=>S.current.onClose?.();return e.addEventListener(`wui-lightbox:change`,t),e.addEventListener(`wui-lightbox:close`,n),()=>{e.removeEventListener(`wui-lightbox:change`,t),e.removeEventListener(`wui-lightbox:close`,n)}},[]),/* @__PURE__ */ o(`wui-lightbox`,{ref:x,class:[`wui-lightbox`,y].filter(Boolean).join(` `),download:p?``:void 0,label:m||void 0,layout:h===`single`?`single`:void 0,"open-index":Number.isInteger(g)?g:void 0,...u,...b,children:f.map(e=>/* @__PURE__ */ o(`a`,{className:`wui-lightbox-item`,href:e.src,"data-caption":e.caption||void 0,"data-name":e.name||void 0,children:/* @__PURE__ */ o(`img`,{src:e.thumb||e.src,alt:e.alt??e.caption??``,loading:`lazy`})},e.key??e.src))})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{splitMarkerProps as d}from"../lib/wuiMarker.js";import f from"./AppAvatar.js";import p from"./AppButton.js";import m from"./AppIcon.js";import h from"./AppNavigationMenu.js";import g from"./assertValidValue.js";import _ from"./warnUnknownProps.js";import{initScrollEdges as v,revealActiveNavItem as y}from"@webority/ui-elements/helpers";import{useEffect as b,useId as x,useMemo as S,useRef as C,useState as w}from"react";import{Fragment as T,jsx as E,jsxs as D}from"react/jsx-runtime";var O=()=>import(`@webority/ui-elements/elements/overflow`),k=99,A=4,j=5,M=/^[a-z0-9-]+$/,N=`wui-sidebar-footer`,P=[],F=[`prefix`,`exact`],I=[`comfortable`,`compact`],L=[`neutral`,`primary`],R=[`side`,`top`],z=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ee=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),B=e=>e>k?`${k}+`:String(e),te=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ne=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:te.format(/* @__PURE__ */ new Date)<=e},re=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},ie=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ E(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ E(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ E(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ E(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function ae(e){let{marker:t,props:n}=d(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O,brandHref:k,brandLabel:A,sidebarStart:j,sidebarStartCompact:M,sidebarFooter:N,sidebarFooterItems:F=P,topbarStart:ee,topbarEnd:B,footer:te,launcher:ne,children:ae,collapsed:V,onCollapsedChange:H,noSidebar:U=!1,nav:W=`side`,density:se=`comfortable`,itemHeight:G,iconVariant:K=`twotone`,topbarTone:_e=`neutral`,navLabel:ve=`Main navigation`,linkComponent:q,currentPath:ye,rememberCollapsed:be=!1,collapsedCookie:xe=`wui-shell-collapsed`,foldedCookie:Se=i,tabBarLabel:Ce=`Quick navigation`,moreLabel:we=`More`,skipLabel:Te=`Skip to content`,openNavLabel:Ee=`Open navigation`,closeNavLabel:De=`Close navigation`,expandNavLabel:Oe=`Expand navigation`,collapseNavLabel:ke=`Collapse navigation`,newLabel:Ae=`New`,togglePagesLabel:je=`Show or hide {name} pages`,accountMenuLabel:Me=`Account menu for {name}`,roleLabel:Ne=`Role:`,rolesLabel:Pe=`Roles:`,unreadLabel:Fe=`Unread`,markAllReadLabel:Ie=`Mark all read`,viewAllLabel:Le=`View all`,loadingNotificationsText:Re=`Loading…`,noUnreadText:ze=`No unread notifications`,unreadNotificationsText:Be=`{count} unread notifications`,unreadBellLabel:Ve=`{label}, {count} unread`,searchResultsLabel:He=`Search results`,noResultsText:Ue=`No results`,noResultsForText:We=`No results for “{value}”`,resultsCountText:Ge=`{count} results`,resultCountText:Ke=`{count} result`,userMenu:qe,notifications:Je,search:Ye,className:Xe=``,style:Ze,...Qe}=n;if(_(`AppShell`,Qe),g(`AppShell`,`density`,se,I),g(`AppShell`,`topbarTone`,_e,L),g(`AppShell`,`nav`,W,R),g(`AppShell`,`iconVariant`,K,z),A!==void 0&&!k)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(k){if(!A&&!O)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||f||p||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let $e=(G??0)>0?{...Ze,"--wui-nav-item-height":`${G}px`}:Ze,[et,tt]=w(()=>be&&V===void 0&&typeof document<`u`?o(xe)??!1:!1),[J,Y]=w(!1),[nt,rt]=w(!1),[it,at]=w(!1),ot=C(null),X=V??et,st=e=>k?/* @__PURE__ */ E(ue,{href:k,label:A||O,linkComponent:q,onNavigate:()=>Y(!1),children:e}):e,ct=()=>{let e=!X;V===void 0&&tt(e),be&&c(e,xe),H?.(e)},lt=r.some(e=>e.collapsible),[ut,dt]=w(()=>lt&&typeof document<`u`?a(Se):/* @__PURE__ */ new Set),ft=e=>{let t=new Set(ut);t.has(e)?t.delete(e):t.add(e),dt(t),s(t,Se)},pt=S(()=>oe(r,F,ye),[r,F,ye]),Z=pt.groups,Q=pt.footer,$=U?null:ce(Z,Q.some(e=>e.active));b(()=>{let e=()=>rt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),b(()=>{v()},[]),b(()=>{y(ot.current)},[]),b(()=>{let e=ot.current;if(!e)return;let t=()=>at(Z.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[Z]),b(()=>{if(!J)return;let e=e=>{e.key===`Escape`&&Y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]);let mt=[`app-shell`,X?`collapsed`:``,U?`no-sidebar`:``,W===`top`?`wui-shell-top`:``,J?`mobile-open`:``,Xe].filter(Boolean).join(` `);return/* @__PURE__ */ D(`div`,{className:mt,"data-density":se===`compact`?`compact`:void 0,"data-wui-folded-cookie":lt?Se:void 0,style:$e,...t,...Qe,children:[/* @__PURE__ */ E(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Te}),/* @__PURE__ */ D(`aside`,{className:`app-sidebar`,children:[(l||u||f||p||x)&&/* @__PURE__ */ E(`div`,{className:re({logoLight:u,logoDark:f,markLight:p,markDark:x}),children:st(/* @__PURE__ */ D(T,{children:[ie({logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O}),l]}))}),j&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start`,children:j}),M&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start-compact`,children:M}),/* @__PURE__ */ E(`nav`,{className:`app-sidebar-scroll`,"aria-label":ve,ref:ot,tabIndex:it?0:void 0,children:Z.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ E(pe,{item:e,linkComponent:q,onNavigate:()=>Y(!1),iconVariant:K,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label):/* @__PURE__ */ E(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ D(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!ut.has(e.key??``)||!!fe(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ D(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ft(e.key??``),children:[/* @__PURE__ */ E(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ E(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ D(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(N||Q.length>0)&&/* @__PURE__ */ D(`div`,{className:`app-sidebar-foot`,children:[Q.length>0&&/* @__PURE__ */ E(`div`,{className:`wui-sidebar-foot-links`,children:Q.map(e=>/* @__PURE__ */ E(pe,{item:e,linkComponent:q,onNavigate:()=>Y(!1),iconVariant:K,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label))}),N]}),!U&&/* @__PURE__ */ E(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ct,"aria-label":X?Oe:ke,"aria-expanded":!X,children:/* @__PURE__ */ E(m,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ D(`div`,{className:`app-main`,children:[/* @__PURE__ */ D(`header`,{className:`app-topbar${nt?` scrolled`:``}`,"data-tone":_e===`primary`?`primary`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Y(!0),"aria-label":Ee,"aria-expanded":J,children:/* @__PURE__ */ E(m,{name:`menu`,size:18})}),W===`top`&&l&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-brand`,children:st(l)}),W===`top`&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ E(h,{items:le(Z),ariaLabel:ve,linkComponent:q})}),ee,Ye&&/* @__PURE__ */ E(ge,{config:Ye,searchResultsLabel:He,noResultsText:Ue,noResultsForText:We,resultsCountText:Ge,resultCountText:Ke})]}),/* @__PURE__ */ D(`div`,{className:`app-topbar-end`,children:[B,Je&&/* @__PURE__ */ E(he,{config:Je,unreadLabel:Fe,markAllReadLabel:Ie,viewAllLabel:Le,loadingNotificationsText:Re,noUnreadText:ze,unreadNotificationsText:Be,unreadBellLabel:Ve}),qe&&/* @__PURE__ */ E(me,{config:qe,linkComponent:q,accountMenuLabel:Me,roleLabel:Ne,rolesLabel:Pe})]})]}),/* @__PURE__ */ E(`main`,{className:`app-content`,id:`main-content`,children:ae}),te&&/* @__PURE__ */ E(`footer`,{className:`app-footer`,children:te})]}),ne&&/* @__PURE__ */ E(`div`,{className:`wui-shell-launcher`,children:ne}),$&&/* @__PURE__ */ D(`nav`,{className:`wui-tabbar`,"aria-label":Ce,children:[$.tabs.map(e=>/* @__PURE__ */ E(de,{tab:e,linkComponent:q,iconVariant:K},e.key??e.href)),$.hasMore&&/* @__PURE__ */ D(`button`,{type:`button`,className:`wui-tabbar-item${$.moreActive?` active`:``}`,onClick:()=>Y(!0),children:[/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ E(m,{name:`more`,size:24})}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:we})]})]}),/* @__PURE__ */ E(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Y(!1),"aria-label":De,tabIndex:J?0:-1})]})}function oe(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&se(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>H(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:N,items:t}].map(e=>({...e,items:U(a(e.items,!0))})).filter(e=>e.items.some(e=>!H(e))),s=[],c=e=>{for(let t of e)H(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)_(`AppShell items`,V(e)),g(`AppShell`,`match`,e.match,F),g(`AppShell`,`iconVariant`,e.iconVariant,z);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==N),footer:o.find(e=>e.key===N)?.items??[]}}function V(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ee.has(e)))}var H=e=>e.header!=null;function U(e){return e.filter((t,n)=>{if(!H(t))return!0;let r=e.findIndex((e,t)=>t>n&&H(e));return e.slice(n+1,r<0?void 0:r).length>0})}var W=/* @__PURE__ */ new Set;function se(t){if(t.key!=null&&M.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||W.has(n)||(W.add(n),e(n))}function ce(e,t){let n=[],r=e=>{for(let t of e)H(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?A:j;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function le(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>H(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(H(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function ue({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ E(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function de({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ E(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ E(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function fe(e){for(let t of e){if(t.active)return t;let e=t.children?.length?fe(t.children):void 0;if(e)return e}}function pe({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?fe(e.children??[]):void 0,h=!!p,g=p?p.key??p.href??p.label:null,[_,v]=w(h);b(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,x=!u&&e.icon&&/* @__PURE__ */ E(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),S=e.badge!=null&&/* @__PURE__ */ E(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),C=ne(e.newUntil)&&/* @__PURE__ */ E(`span`,{className:`wui-nav-new`,children:s}),O=/* @__PURE__ */ D(T,{children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,e.trailingIcon&&/* @__PURE__ */ E(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ E(m,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),k=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ E(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ E(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ E(pe,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ E(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":k,onClick:i,children:O});return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${h||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ E(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${h?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,/* @__PURE__ */ E(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ E(l,{link:n(r,{to:e.href}),className:A,"aria-current":k,"data-label":y,onClick:i,children:O})}function G(){let[e,t]=w(!1),n=C(null);return b(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target instanceof Node?e.target:null)||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 me({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=x(),{open:c,setOpen:u,ref:d}=G(),{name:h,role:_,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:S,profileLabel:C=`My profile`,onLogout:w,logoutAction:O,logoutLabel:k=`Sign out`,head:A,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(g(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!h)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let P=v.map(e=>(e??``).trim()).filter(Boolean),F=()=>u(!1),I=(e,t,i,a)=>/* @__PURE__ */ E(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ E(m,{name:`log-out`,size:18}),R=/* @__PURE__ */ D(T,{children:[L,k]});return/* @__PURE__ */ D(`div`,{className:`dropdown wui-usermenu`,ref:d,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:h}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ E(f,{name:h,src:b,tone:`auto`}),/* @__PURE__ */ D(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-name`,children:h}),_&&!y&&/* @__PURE__ */ E(`span`,{className:`wui-usermenu-role`,children:_})]}),/* @__PURE__ */ E(m,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ E(f,{name:h,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ D(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ E(`div`,{className:`wui-usermenu-name`,children:h}),_&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-role`,children:_}),P.length>0&&/* @__PURE__ */ D(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),A?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-extra`,children:A}):null]})]}),j?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-section`,children:j}):null,S&&I(S,/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(m,{name:`user`,size:18}),C]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ E(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(m,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(O||w)&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-foot`,children:O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(p,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:k})}):/* @__PURE__ */ E(p,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),w?.()},children:k})}):O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):w&&/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),w()},children:R})]})]})}function he({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=x(),{open:u,setOpen:d,ref:f}=G(),{unread:p=0,items:h,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:y,label:S=`Notifications`,emptyText:O=`You are all caught up.`}=e,[k,A]=w(``),j=C(p);b(()=>{j.current!==p&&(j.current=p,A(p===0?o:t(s,{count:B(p)})))},[p,o,s]);let M=null;return h?.length?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-items`,children:h.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ D(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ E(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ E(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ E(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ E(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:a}):h&&(M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:O})),/* @__PURE__ */ D(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":p===0?S:t(c,{label:S,count:B(p)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ E(m,{name:`notification`,size:20}),/* @__PURE__ */ E(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:B(p)})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-title`,children:S}),v&&/* @__PURE__ */ E(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ E(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),y&&/* @__PURE__ */ E(`a`,{className:`wui-bell-foot`,href:y,children:i})]})]})}var K=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ge({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o}){u(`wui-overflow`,O);let s=x(),{value:c=``,onChange:l,results:d=null,loading:f=!1,onSelect:p,onSubmit:h,onFocus:g,placeholder:_=`Search`}=e,[v,y]=w(!1),[T,k]=w(!1),[A,j]=w({results:null,index:-1}),M=A.results===d?A.index:-1,N=e=>j({results:d,index:e}),P=C(null),F=C(null),I=C([]),L=S(()=>(d??[]).flatMap(e=>e.hits??[]),[d]),R=d!=null&&!T,z=L.length;b(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||K(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),y(!0),F.current?.focus())},t=e=>{P.current?.contains(e.target instanceof Node?e.target:null)||(k(!0),y(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ee=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!R||z===0)return;e.preventDefault(),N((M+(e.key===`ArrowDown`?1:-1)+z)%z)}else e.key===`Enter`?R&&M>=0&&I.current[M]?(e.preventDefault(),I.current[M].click()):h&&c.trim()!==``&&(e.preventDefault(),h(c.trim())):e.key===`Escape`&&(R?(e.preventDefault(),k(!0)):v&&(e.preventDefault(),y(!1)))},B=-1;return I.current=[],/* @__PURE__ */ E(`wui-overflow`,{class:`wui-topsearch-host`,label:`More`,children:/* @__PURE__ */ E(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ D(`div`,{className:`wui-topsearch${v?` is-open`:``}${f?` is-loading`:``}`,ref:P,"data-overflow-label":_,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":_,"aria-expanded":v,"aria-controls":`${s}-panel`,onClick:()=>{let e=!v;y(e),e&&F.current?.focus()},children:/* @__PURE__ */ E(m,{name:`search`,size:20})}),/* @__PURE__ */ D(`div`,{className:`wui-topsearch-panel`,id:`${s}-panel`,children:[/* @__PURE__ */ D(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ E(m,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ E(`input`,{ref:F,type:`search`,className:`form-control input search-input`,id:`${s}-input`,placeholder:_,"aria-label":_,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":R,"aria-controls":`${s}-list`,"aria-activedescendant":R&&M>=0?`${s}-opt-${M}`:void 0,autoComplete:`off`,value:c,onChange:e=>{k(!1),l?.(e.target.value)},onKeyDown:ee,onFocus:g})]}),/* @__PURE__ */ E(`div`,{className:`wui-topsearch-results`,id:`${s}-list`,role:`listbox`,"aria-label":n,hidden:!R,children:R&&/* @__PURE__ */ D(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[z===0&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:c})}),d.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ D(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{B+=1;let t=B;return/* @__PURE__ */ D(`a`,{className:`wui-topsearch-hit${t===M?` is-active`:``}`,role:`option`,"aria-selected":t===M,id:`${s}-opt-${t}`,href:e.href,ref:e=>{I.current[t]=e},onClick:t=>p?.(e,t),children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:R?z===0?r:t(z===1?o:a,{count:z}):``})]})})})}export{ae as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{splitMarkerProps as d}from"../lib/wuiMarker.js";import f from"./AppAvatar.js";import p from"./AppButton.js";import m from"./AppIcon.js";import h from"./AppNavigationMenu.js";import g from"./assertValidValue.js";import _ from"./warnUnknownProps.js";import{initScrollEdges as v,revealActiveNavItem as y}from"@webority/ui-elements/helpers";import{useEffect as b,useId as x,useMemo as S,useRef as C,useState as w}from"react";import{Fragment as T,jsx as E,jsxs as D}from"react/jsx-runtime";var O=()=>import(`@webority/ui-elements/elements/overflow`),k=99,A=4,j=5,M=/^[a-z0-9-]+$/,N=`wui-sidebar-footer`,P=[],F=[`prefix`,`exact`],I=[`comfortable`,`compact`],L=[`neutral`,`primary`],R=[`side`,`top`],z=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],B=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),V=e=>e>k?`${k}+`:String(e),H=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ee=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:H.format(/* @__PURE__ */ new Date)<=e},te=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},ne=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ E(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ E(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ E(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ E(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function re(e){let{marker:t,props:n}=d(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O,brandHref:k,brandLabel:A,sidebarStart:j,sidebarStartCompact:M,sidebarFooter:N,sidebarFooterItems:F=P,topbarStart:B,topbarEnd:V,footer:H,launcher:ee,children:re,collapsed:U,onCollapsedChange:W,noSidebar:G=!1,nav:K=`side`,density:ae=`comfortable`,itemHeight:q,iconVariant:J=`twotone`,topbarTone:he=`neutral`,navLabel:ge=`Main navigation`,linkComponent:Y,currentPath:_e,rememberCollapsed:ve=!1,collapsedCookie:ye=`wui-shell-collapsed`,foldedCookie:be=i,tabBarLabel:xe=`Quick navigation`,moreLabel:Se=`More`,skipLabel:Ce=`Skip to content`,openNavLabel:we=`Open navigation`,closeNavLabel:Te=`Close navigation`,expandNavLabel:Ee=`Expand navigation`,collapseNavLabel:De=`Collapse navigation`,newLabel:Oe=`New`,togglePagesLabel:ke=`Show or hide {name} pages`,accountMenuLabel:Ae=`Account menu for {name}`,roleLabel:je=`Role:`,rolesLabel:Me=`Roles:`,unreadLabel:Ne=`Unread`,markAllReadLabel:Pe=`Mark all read`,viewAllLabel:Fe=`View all`,loadingNotificationsText:Ie=`Loading…`,noUnreadText:Le=`No unread notifications`,unreadNotificationsText:Re=`{count} unread notifications`,unreadBellLabel:ze=`{label}, {count} unread`,searchResultsLabel:Be=`Search results`,noResultsText:Ve=`No results`,noResultsForText:He=`No results for “{value}”`,resultsCountText:Ue=`{count} results`,resultCountText:We=`{count} result`,userMenu:Ge,notifications:Ke,search:qe,className:Je=``,style:Ye,...Xe}=n;if(_(`AppShell`,Xe),g(`AppShell`,`density`,ae,I),g(`AppShell`,`topbarTone`,he,L),g(`AppShell`,`nav`,K,R),g(`AppShell`,`iconVariant`,J,z),A!==void 0&&!k)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(k){if(!A&&!O)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||f||p||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let Ze=(q??0)>0?{...Ye,"--wui-nav-item-height":`${q}px`}:Ye,[Qe,$e]=w(()=>ve&&U===void 0&&typeof document<`u`?o(ye)??!1:!1),[X,Z]=w(!1),[et,tt]=w(!1),[nt,rt]=w(!1),it=C(null),Q=U??Qe,at=e=>k?/* @__PURE__ */ E(ce,{href:k,label:A||O,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,ot=()=>{let e=!Q;U===void 0&&$e(e),ve&&c(e,ye),W?.(e)},st=r.some(e=>e.collapsible),[ct,lt]=w(()=>st&&typeof document<`u`?a(be):/* @__PURE__ */ new Set),ut=e=>{let t=new Set(ct);t.has(e)?t.delete(e):t.add(e),lt(t),s(t,be)},dt=S(()=>ie(r,F,_e),[r,F,_e]),$=dt.groups,ft=dt.footer,pt=G?null:oe($,ft.some(e=>e.active));b(()=>{let e=()=>tt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),b(()=>{v()},[]),b(()=>{y(it.current)},[]),b(()=>{let e=it.current;if(!e)return;let t=()=>rt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),b(()=>{if(!X)return;let e=e=>{e.key===`Escape`&&Z(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[X]);let mt=[`app-shell`,Q?`collapsed`:``,G?`no-sidebar`:``,K===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Je].filter(Boolean).join(` `);return/* @__PURE__ */ D(`div`,{className:mt,"data-density":ae===`compact`?`compact`:void 0,"data-wui-folded-cookie":st?be:void 0,style:Ze,...t,...Xe,children:[/* @__PURE__ */ E(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ce}),/* @__PURE__ */ D(`aside`,{className:`app-sidebar`,children:[(l||u||f||p||x)&&/* @__PURE__ */ E(`div`,{className:te({logoLight:u,logoDark:f,markLight:p,markDark:x}),children:at(/* @__PURE__ */ D(T,{children:[ne({logoLight:u,logoDark:f,markLight:p,markDark:x,brandName:O}),l]}))}),j&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start`,children:j}),M&&/* @__PURE__ */ E(`div`,{className:`app-sidebar-start-compact`,children:M}),/* @__PURE__ */ E(`nav`,{className:`app-sidebar-scroll`,"aria-label":ge,ref:it,tabIndex:nt?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ E(de,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:J,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label):/* @__PURE__ */ E(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ D(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!ct.has(e.key??``)||!!ue(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ D(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>ut(e.key??``),children:[/* @__PURE__ */ E(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ E(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ D(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ E(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(N||ft.length>0)&&/* @__PURE__ */ D(`div`,{className:`app-sidebar-foot`,children:[ft.length>0&&/* @__PURE__ */ E(`div`,{className:`wui-sidebar-foot-links`,children:ft.map(e=>/* @__PURE__ */ E(de,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:J,newLabel:Oe,togglePagesLabel:ke},e.key??e.href??e.label))}),N]}),!G&&/* @__PURE__ */ E(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ot,"aria-label":Q?Ee:De,"aria-expanded":!Q,children:/* @__PURE__ */ E(m,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ D(`div`,{className:`app-main`,children:[/* @__PURE__ */ D(`header`,{className:`app-topbar${et?` scrolled`:``}`,"data-tone":he===`primary`?`primary`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":we,"aria-expanded":X,children:/* @__PURE__ */ E(m,{name:`menu`,size:18})}),K===`top`&&l&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-brand`,children:at(l)}),K===`top`&&/* @__PURE__ */ E(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ E(h,{items:se($),ariaLabel:ge,linkComponent:Y})}),B,qe&&/* @__PURE__ */ E(me,{config:qe,searchResultsLabel:Be,noResultsText:Ve,noResultsForText:He,resultsCountText:Ue,resultCountText:We,moreLabel:Se})]}),/* @__PURE__ */ D(`div`,{className:`app-topbar-end`,children:[V,Ke&&/* @__PURE__ */ E(pe,{config:Ke,unreadLabel:Ne,markAllReadLabel:Pe,viewAllLabel:Fe,loadingNotificationsText:Ie,noUnreadText:Le,unreadNotificationsText:Re,unreadBellLabel:ze}),Ge&&/* @__PURE__ */ E(fe,{config:Ge,linkComponent:Y,accountMenuLabel:Ae,roleLabel:je,rolesLabel:Me})]})]}),/* @__PURE__ */ E(`main`,{className:`app-content`,id:`main-content`,children:re}),H&&/* @__PURE__ */ E(`footer`,{className:`app-footer`,children:H})]}),ee&&/* @__PURE__ */ E(`div`,{className:`wui-shell-launcher`,children:ee}),pt&&/* @__PURE__ */ D(`nav`,{className:`wui-tabbar`,"aria-label":xe,children:[pt.tabs.map(e=>/* @__PURE__ */ E(le,{tab:e,linkComponent:Y,iconVariant:J},e.key??e.href)),pt.hasMore&&/* @__PURE__ */ D(`button`,{type:`button`,className:`wui-tabbar-item${pt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ E(m,{name:`more`,size:24})}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:Se})]})]}),/* @__PURE__ */ E(`button`,{type:`button`,className:`app-scrim`,onClick:()=>Z(!1),"aria-label":Te,tabIndex:X?0:-1})]})}function ie(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&ae(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>W(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:N,items:t}].map(e=>({...e,items:G(a(e.items,!0))})).filter(e=>e.items.some(e=>!W(e))),s=[],c=e=>{for(let t of e)W(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)_(`AppShell items`,U(e)),g(`AppShell`,`match`,e.match,F),g(`AppShell`,`iconVariant`,e.iconVariant,z);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==N),footer:o.find(e=>e.key===N)?.items??[]}}function U(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!B.has(e)))}var W=e=>e.header!=null;function G(e){return e.filter((t,n)=>{if(!W(t))return!0;let r=e.findIndex((e,t)=>t>n&&W(e));return e.slice(n+1,r<0?void 0:r).length>0})}var K=/* @__PURE__ */ new Set;function ae(t){if(t.key!=null&&M.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||K.has(n)||(K.add(n),e(n))}function oe(e,t){let n=[],r=e=>{for(let t of e)W(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?A:j;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function se(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>W(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(W(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function ce({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ E(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function le({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ E(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ E(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ E(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function ue(e){for(let t of e){if(t.active)return t;let e=t.children?.length?ue(t.children):void 0;if(e)return e}}function de({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?ue(e.children??[]):void 0,h=!!p,g=p?p.key??p.href??p.label:null,[_,v]=w(h);b(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,x=!u&&e.icon&&/* @__PURE__ */ E(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ E(m,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),S=e.badge!=null&&/* @__PURE__ */ E(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),C=ee(e.newUntil)&&/* @__PURE__ */ E(`span`,{className:`wui-nav-new`,children:s}),O=/* @__PURE__ */ D(T,{children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,e.trailingIcon&&/* @__PURE__ */ E(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ E(m,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),k=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ E(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ E(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ E(de,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ E(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":k,onClick:i,children:O});return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${h||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ E(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ D(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${h?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[x,/* @__PURE__ */ E(`span`,{className:`app-nav-text`,children:e.label}),C,S,/* @__PURE__ */ E(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ E(m,{name:`chevron-right`,size:16})})]}),f]})}let A=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ E(l,{link:n(r,{to:e.href}),className:A,"aria-current":k,"data-label":y,onClick:i,children:O})}function q(){let[e,t]=w(!1),n=C(null);return b(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target instanceof Node?e.target:null)||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 fe({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=x(),{open:c,setOpen:u,ref:d}=q(),{name:h,role:_,roles:v=[],noTriggerRole:y=!1,photo:b,profileHref:S,profileLabel:C=`My profile`,onLogout:w,logoutAction:O,logoutLabel:k=`Sign out`,head:A,section:j,logoutVariant:M=`item`,items:N=[]}=e;if(g(`AppShell`,`userMenu.logoutVariant`,M,[`item`,`button`]),!h)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let P=v.map(e=>(e??``).trim()).filter(Boolean),F=()=>u(!1),I=(e,t,i,a)=>/* @__PURE__ */ E(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),L=/* @__PURE__ */ E(m,{name:`log-out`,size:18}),R=/* @__PURE__ */ D(T,{children:[L,k]});return/* @__PURE__ */ D(`div`,{className:`dropdown wui-usermenu`,ref:d,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:s,className:`wui-usermenu-trigger`,"aria-expanded":c,"aria-label":t(i,{name:h}),onClick:()=>u(e=>!e),children:[/* @__PURE__ */ E(f,{name:h,src:b,tone:`auto`}),/* @__PURE__ */ D(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-name`,children:h}),_&&!y&&/* @__PURE__ */ E(`span`,{className:`wui-usermenu-role`,children:_})]}),/* @__PURE__ */ E(m,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,"data-bs-popper":c?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ E(f,{name:h,src:b,size:`lg`,tone:`auto`}),/* @__PURE__ */ D(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ E(`div`,{className:`wui-usermenu-name`,children:h}),_&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-role`,children:_}),P.length>0&&/* @__PURE__ */ D(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ E(`span`,{className:`wui-usermenu-roles-label`,children:P.length===1?a:o}),` ${P.join(`, `)}`]}),A?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-extra`,children:A}):null]})]}),j?/* @__PURE__ */ E(`div`,{className:`wui-usermenu-section`,children:j}):null,S&&I(S,/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(m,{name:`user`,size:18}),C]}),void 0,F),N.map(e=>{if(e.divider)return/* @__PURE__ */ E(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ D(T,{children:[e.icon&&/* @__PURE__ */ E(m,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),F()};return e.href?I(e.href,t,e.key,n):/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),M===`button`?(O||w)&&/* @__PURE__ */ E(`div`,{className:`wui-usermenu-foot`,children:O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(p,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,children:k})}):/* @__PURE__ */ E(p,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:L,onClick:()=>{F(),w?.()},children:k})}):O?/* @__PURE__ */ E(`form`,{method:`post`,action:O,className:`wui-usermenu-logout`,children:/* @__PURE__ */ E(`button`,{type:`submit`,className:`dropdown-item danger`,children:R})}):w&&/* @__PURE__ */ E(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{F(),w()},children:R})]})]})}function pe({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=x(),{open:u,setOpen:d,ref:f}=q(),{unread:p=0,items:h,loading:g=!1,onOpen:_,onMarkAllRead:v,viewAllHref:y,label:S=`Notifications`,emptyText:O=`You are all caught up.`}=e,[k,A]=w(``),j=C(p);b(()=>{j.current!==p&&(j.current=p,A(p===0?o:t(s,{count:V(p)})))},[p,o,s]);let M=null;return h?.length?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-items`,children:h.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ D(T,{children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ D(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ E(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ E(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ E(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ E(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):g?M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:a}):h&&(M=/* @__PURE__ */ E(`div`,{className:`wui-bell-state`,children:O})),/* @__PURE__ */ D(`div`,{className:`dropdown wui-bell`,ref:f,children:[/* @__PURE__ */ D(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"aria-expanded":u,"aria-label":p===0?S:t(c,{label:S,count:V(p)}),onClick:()=>{let e=!u;d(e),e&&_?.()},children:[/* @__PURE__ */ E(m,{name:`notification`,size:20}),/* @__PURE__ */ E(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:V(p)})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:k}),/* @__PURE__ */ D(`div`,{className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,"data-bs-popper":u?`static`:void 0,children:[/* @__PURE__ */ D(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ E(`span`,{className:`wui-bell-title`,children:S}),v&&/* @__PURE__ */ E(`button`,{type:`button`,className:`wui-bell-markall`,onClick:v,children:r})]}),/* @__PURE__ */ E(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:M}),y&&/* @__PURE__ */ E(`a`,{className:`wui-bell-foot`,href:y,children:i})]})]})}var J=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function me({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,O);let c=x(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:h,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,T]=w(!1),[k,A]=w(!1),[j,M]=w({results:null,index:-1}),N=j.results===f?j.index:-1,P=e=>M({results:f,index:e}),F=C(null),I=C(null),L=C([]),R=S(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),z=f!=null&&!k,B=R.length;b(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||J(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),T(!0),I.current?.focus())},t=e=>{F.current?.contains(e.target instanceof Node?e.target:null)||(A(!0),T(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let V=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!z||B===0)return;e.preventDefault(),P((N+(e.key===`ArrowDown`?1:-1)+B)%B)}else e.key===`Enter`?z&&N>=0&&L.current[N]?(e.preventDefault(),L.current[N].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(z?(e.preventDefault(),A(!0)):y&&(e.preventDefault(),T(!1)))},H=-1;return L.current=[],/* @__PURE__ */ E(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ E(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ D(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:F,"data-overflow-label":v,children:[/* @__PURE__ */ E(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;T(e),e&&I.current?.focus()},children:/* @__PURE__ */ E(m,{name:`search`,size:20})}),/* @__PURE__ */ D(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ D(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ E(m,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ E(`input`,{ref:I,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":z,"aria-controls":`${c}-list`,"aria-activedescendant":z&&N>=0?`${c}-opt-${N}`:void 0,autoComplete:`off`,value:l,onChange:e=>{A(!1),d?.(e.target.value)},onKeyDown:V,onFocus:_})]}),/* @__PURE__ */ E(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!z,children:z&&/* @__PURE__ */ D(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[B===0&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ D(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ E(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{H+=1;let t=H;return/* @__PURE__ */ D(`a`,{className:`wui-topsearch-hit${t===N?` is-active`:``}`,role:`option`,"aria-selected":t===N,id:`${c}-opt-${t}`,href:e.href,ref:e=>{L.current[t]=e},onClick:t=>h?.(e,t),children:[e.icon&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ E(m,{name:e.icon,size:18})}),/* @__PURE__ */ D(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ E(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ E(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:z?B===0?r:t(B===1?o:a,{count:B}):``})]})})})}export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import ee from"./AppRequiredMark.js";import te from"./assertValidValue.js";import i,{readRange as a,writeNumberValue as o}from"./useWuiControl.js";import s from"./warnUnknownProps.js";import{forwardRef as c,useEffect as ne,useId as re,useRef as ie}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`sm`,`md`,`lg`],f=()=>import(`@webority/ui-elements/elements/slider`),p=(e,t)=>o(e,typeof t==`number`||typeof t==`string`?t:void 0),m=c(function(o,c){let{marker:m,props:h}=n(`AppSlider`,o),{value:g,start:_,end:v,range:ae=!1,onChange:oe,label:y,required:b=!1,optional:se=!1,helperText:x,error:S,name:ce,startName:C,endName:w,min:T=0,max:E=100,step:D=1,disabled:O,readOnly:k=!1,loading:A=!1,defaultValue:j,defaultStart:M,defaultEnd:N,size:P,showValue:F,unit:I,id:L,ariaLabel:R,className:z=``,fieldClassName:B=``,help:V,helpLabel:H=`More information`,optionalLabel:U=`(optional)`,...W}=h;s(`AppSlider`,W),te(`AppSlider`,`size`,P,d);let G=t(`wui-slider`,f),le=re(),K=L||le,q=ae,{setRef:ue,innerRef:J}=i({ready:G,ref:e=>{typeof c==`function`?c(e):c&&(c.current=e)},value:q?void 0:g,onChange:q?e=>{o.range
|
|
1
|
+
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import ee from"./AppRequiredMark.js";import te from"./assertValidValue.js";import i,{readRange as a,writeNumberValue as o}from"./useWuiControl.js";import s from"./warnUnknownProps.js";import{forwardRef as c,useEffect as ne,useId as re,useRef as ie}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`sm`,`md`,`lg`],f=()=>import(`@webority/ui-elements/elements/slider`),p=(e,t)=>o(e,typeof t==`number`||typeof t==`string`?t:void 0),m=c(function(o,c){let{marker:m,props:h}=n(`AppSlider`,o),{value:g,start:_,end:v,range:ae=!1,onChange:oe,label:y,required:b=!1,optional:se=!1,helperText:x,error:S,name:ce,startName:C,endName:w,min:T=0,max:E=100,step:D=1,disabled:O,readOnly:k=!1,loading:A=!1,defaultValue:j,defaultStart:M,defaultEnd:N,size:P,showValue:F,unit:I,id:L,ariaLabel:R,className:z=``,fieldClassName:B=``,help:V,helpLabel:H=`More information`,optionalLabel:U=`(optional)`,...W}=h;s(`AppSlider`,W),te(`AppSlider`,`size`,P,d);let G=t(`wui-slider`,f),le=re(),K=L||le,q=ae,{setRef:ue,innerRef:J}=i({ready:G,ref:e=>{typeof c==`function`?c(e):c&&(c.current=e)},value:q?void 0:g,onChange:q?e=>{o.range&&o.onChange?.(e)}:e=>{o.range||o.onChange?.(e)},readValue:q?a:void 0,writeValue:q?void 0:p}),Y=ie(!1);ne(()=>{if(!q)return;let e=J.current;if(!e)return;let t=_===void 0?Y.current?void 0:M:_,n=v===void 0?Y.current?void 0:N:v;Y.current=!0,t!==void 0&&t>e.end?(n!==void 0&&e.end!==n&&(e.end=n),t!==void 0&&e.start!==t&&(e.start=t)):(t!==void 0&&e.start!==t&&(e.start=t),n!==void 0&&e.end!==n&&(e.end=n))},[_,v,M,N,q,J]);let X=!y&&!S&&!x,Z=S?`${K}-error`:void 0,Q=x?`${K}-hint`:void 0,$=/* @__PURE__ */ l(`wui-slider`,{ref:ue,id:K,name:ce||void 0,"start-name":C||void 0,"end-name":w||void 0,min:T,max:E,step:D,size:P||void 0,value:(g??j)!=null&&!q?String(g??j):void 0,"aria-label":R||(typeof y==`string`?y:void 0),"aria-describedby":Z||Q,"aria-invalid":S?`true`:void 0,disabled:O?``:void 0,readonly:k?``:void 0,loading:A?``:void 0,required:b?``:void 0,range:q?``:void 0,"show-value":F?``:void 0,unit:I||void 0,className:z||void 0,...X?m:null,...W});return X?$:/* @__PURE__ */ u(`div`,{...m,className:`field${B?` ${B}`:``}`,children:[y&&/* @__PURE__ */ u(`label`,{className:`label`,htmlFor:K,children:[y,se&&!b&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${U}`}),b&&/* @__PURE__ */ l(ee,{}),V&&/* @__PURE__ */ l(r,{label:H,children:V})]}),$,/* @__PURE__ */ l(e,{error:S,hint:x,errorId:Z,hintId:Q})]})});export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppSegmented.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{DEFAULT_THEME_EFFECT as a,DEFAULT_THEME_STORAGE_KEY as o,THEME_CHANGE_EVENT as s,THEME_EFFECTS as c,THEME_MODES as l,applyTheme as u,nextTheme as d,readStoredTheme as f,resolveTheme as p,storeTheme as m,transitionTheme as h,watchSystemTheme as g}from"@webority/ui-elements/helpers";import{useCallback as _,useEffect as v,useId as y,useRef as b,useState as x}from"react";import{jsx as S}from"react/jsx-runtime";import{flushSync as C}from"react-dom";function w(e){return l.some(t=>t===e)}var T={light:`sun`,dark:`moon`,auto:`monitor`},E={light:`light`,dark:`dark`,auto:`follows your device`},D=[`icon`,`segmented`],O={sm:16,md:20,lg:24,xl:28};function k(l){let{marker:k,props:A}=e(`AppThemeToggle`,l),{variant:j=`icon`,effect:M=a,includeAuto:N=!0,storageKey:P=o,duration:F,label:I=`Theme`,lightLabel:L=`Light`,darkLabel:R=`Dark`,autoLabel:z=`System`,name:B,size:V=`md`,tooltipPlacement:H=`auto`,onChange:U,className:W=``,...G}=A;i(`AppThemeToggle`,G),r(`AppThemeToggle`,`variant`,j,D),r(`AppThemeToggle`,`effect`,M,c),r(`AppThemeToggle`,`size`,V,Object.keys(O));let K=_(e=>e===`auto`&&!N?p(e):e,[N]),[q,J]=x(()=>K(typeof window>`u`?`auto`:f(P))),Y=y(),X=B||Y,Z=b({shown:K,storageKey:P});v(()=>{let e=document.documentElement.getAttribute(`data-theme`);w(e)?J(Z.current.shown(e)):u(f(Z.current.storageKey))},[]),v(()=>{let e=e=>{let t=`detail`in e?e.detail:void 0,n=typeof t==`object`&&t&&`preference`in t?t.preference:void 0;w(n)&&J(K(n))};return document.addEventListener(s,e),()=>document.removeEventListener(s,e)},[K]),v(()=>g(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&u(`auto`)}),[]);let Q=_((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};h(()=>{u(e),m(e,P),C(()=>J(e)),U?.(e)},{effect:M,to:p(e),origin:r,...F===void 0?null:{duration:F}})},[P,M,F,U]);if(j===`segmented`){let e=[{value:`light`,label:L,icon:T.light},{value:`dark`,label:R,icon:T.dark}];return N&&e.push({value:`auto`,label:z,icon:T.auto}),/* @__PURE__ */ S(n,{...k,options:e,value:q,name:X,label:I,size:V===`xl`?`lg`:V,className:[`wui-theme-toggle`,`wui-theme-toggle-segmented`,W].filter(Boolean).join(` `),onChange:e=>{if(!w(e)||e===q)return;let t=document.querySelector(`.segmented-input[name="${CSS.escape(X)}"][value="${e}"]`);Q(e,t?.closest(`.segmented-option`)??t)}})}return/* @__PURE__ */ S(t,{...k,icon:T[q],label:`${I}: ${E[q]}`,size:O[V]??O.md,tooltipPlacement:H,onClick:e=>Q(d(q,{includeAuto:N}),e.currentTarget),className:[`wui-theme-toggle`,W].filter(Boolean).join(` `)})}export{k as default};
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppSegmented.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{DEFAULT_THEME_EFFECT as a,DEFAULT_THEME_STORAGE_KEY as o,THEME_CHANGE_EVENT as s,THEME_EFFECTS as c,THEME_MODES as l,applyTheme as u,nextTheme as d,readStoredTheme as f,resolveTheme as p,storeTheme as m,transitionTheme as h,watchSystemTheme as g}from"@webority/ui-elements/helpers";import{useCallback as _,useEffect as v,useId as y,useRef as b,useState as x}from"react";import{jsx as S}from"react/jsx-runtime";import{flushSync as C}from"react-dom";function w(e){return l.some(t=>t===e)}var T={light:`sun`,dark:`moon`,auto:`monitor`},E={light:`light`,dark:`dark`,auto:`follows your device`},D=[`icon`,`segmented`],O={sm:16,md:20,lg:24,xl:28};function k(l){let{marker:k,props:A}=e(`AppThemeToggle`,l),{variant:j=`icon`,effect:M=a,includeAuto:N=!0,storageKey:P=o,duration:F,label:I=`Theme`,lightLabel:L=`Light`,darkLabel:R=`Dark`,autoLabel:z=`System`,name:B,size:V=`md`,tooltipPlacement:H=`auto`,onChange:U,className:W=``,...G}=A;i(`AppThemeToggle`,G),r(`AppThemeToggle`,`variant`,j,D),r(`AppThemeToggle`,`effect`,M,c),r(`AppThemeToggle`,`size`,V,Object.keys(O));let K=_(e=>e===`auto`&&!N?p(e):e,[N]),[q,J]=x(()=>K(typeof window>`u`?`auto`:f(P))),Y=y(),X=B||Y,Z=b({shown:K,storageKey:P});v(()=>{let e=document.documentElement.getAttribute(`data-theme`);w(e)?J(Z.current.shown(e)):u(f(Z.current.storageKey))},[]),v(()=>{let e=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:theme:change arrived without a CustomEvent`);let t=`detail`in e?e.detail:void 0,n=typeof t==`object`&&t&&`preference`in t?t.preference:void 0;w(n)&&J(K(n))};return document.addEventListener(s,e),()=>document.removeEventListener(s,e)},[K]),v(()=>g(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&u(`auto`)}),[]);let Q=_((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};h(()=>{u(e),m(e,P),C(()=>J(e)),U?.(e)},{effect:M,to:p(e),origin:r,...F===void 0?null:{duration:F}})},[P,M,F,U]);if(j===`segmented`){let e=[{value:`light`,label:L,icon:T.light},{value:`dark`,label:R,icon:T.dark}];return N&&e.push({value:`auto`,label:z,icon:T.auto}),/* @__PURE__ */ S(n,{...k,options:e,value:q,name:X,label:I,size:V===`xl`?`lg`:V,className:[`wui-theme-toggle`,`wui-theme-toggle-segmented`,W].filter(Boolean).join(` `),onChange:e=>{if(!w(e)||e===q)return;let t=document.querySelector(`.segmented-input[name="${CSS.escape(X)}"][value="${e}"]`);Q(e,t?.closest(`.segmented-option`)??t)}})}return/* @__PURE__ */ S(t,{...k,icon:T[q],label:`${I}: ${E[q]}`,size:O[V]??O.md,tooltipPlacement:H,onClick:e=>Q(d(q,{includeAuto:N}),e.currentTarget),className:[`wui-theme-toggle`,W].filter(Boolean).join(` `)})}export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useEffect as a,useLayoutEffect as o,useRef as s}from"react";import{jsx as c}from"react/jsx-runtime";var l=[`image`,`video`],u=[`click`],d=()=>import(`@webority/ui-elements/elements/tour`),f=i(function(i,f){let p=e(`wui-tour`,d),{marker:m,props:h}=t(`AppTour`,i),{open:g,onClose:_,tourId:v,steps:y,seenStore:b,onBeforeStep:x,labels:S,endDialog:C=!0,endNextHref:w,className:T,...E}=h;r(`AppTour`,E);for(let e of y)n(`AppTour`,`steps[].mediaType`,e.mediaType,l),n(`AppTour`,`steps[].advanceOn`,e.advanceOn,u);let D=s(null),O=e=>{D.current=e,typeof f==`function`?f(e):f&&(f.current=e)};o(()=>{let e=D.current;e&&p&&(e.seenStore=b??null,e.onBeforeStep=x??null)},[b,x,p]),o(()=>{let e=D.current;e&&p&&(g?e.setAttribute(`open`,``):e.removeAttribute(`open`))},[g,p]);let k=s(_);return k.current=_,a(()=>{let e=D.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`AppTour: wui-tour:close must be a CustomEvent carrying its detail.`);let{reason:t,index:n,position:r,total:i}=e.detail;k.current?.(t,{index:n,position:r,total:i})};return e.addEventListener(`wui-tour:close`,t),()=>e.removeEventListener(`wui-tour:close`,t)},[]),/* @__PURE__ */ c(`wui-tour`,{ref:O,"tour-id":v,"back-label":S?.back,"next-label":S?.next,"skip-label":S?.skip,"done-label":S?.done,"progress-label":S?.progress,"advance-label":S?.advance,"media-pause-label":S?.mediaPause,"media-play-label":S?.mediaPlay,"end-title":S?.endTitle,"end-message":S?.endMessage,"end-button":S?.endButton,"end-next-label":S?.endNextLabel,"end-next-href":w,"end-dialog":C===!1?`false`:void 0,class:T||void 0,...m,...E,children:y.map(e=>/* @__PURE__ */ c(`wui-tour-step`,{target:e.target,title:e.title,media:e.media,"media-alt":e.mediaAlt,"media-poster":e.mediaPoster,"media-type":e.mediaType,"advance-on":e.advanceOn,"action-label":e.actionLabel,children:e.description},`${e.target}|${e.description}`))})});export{f as default};
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useEffect as a,useLayoutEffect as o,useRef as s}from"react";import{jsx as c}from"react/jsx-runtime";var l=[`image`,`video`],u=[`click`],d=()=>import(`@webority/ui-elements/elements/tour`),f=i(function(i,f){let p=e(`wui-tour`,d),{marker:m,props:h}=t(`AppTour`,i),{open:g,onClose:_,tourId:v,steps:y,seenStore:b,onBeforeStep:x,labels:S,endDialog:C=!0,endNextHref:w,className:T,...E}=h;r(`AppTour`,E);for(let e of y)n(`AppTour`,`steps[].mediaType`,e.mediaType,l),n(`AppTour`,`steps[].advanceOn`,e.advanceOn,u);let D=s(null),O=e=>{D.current=e,typeof f==`function`?f(e):f&&(f.current=e)};o(()=>{let e=D.current;e&&p&&(e.seenStore=b??null,e.onBeforeStep=x??null)},[b,x,p]),o(()=>{let e=D.current;e&&p&&(g?e.setAttribute(`open`,``):e.removeAttribute(`open`))},[g,p]);let k=s(_);return k.current=_,a(()=>{let e=D.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`AppTour: wui-tour:close must be a CustomEvent carrying its detail.`);let{reason:t,index:n,position:r,total:i}=e.detail;k.current?.(t,{index:n,position:r,total:i})};return e.addEventListener(`wui-tour:close`,t),()=>e.removeEventListener(`wui-tour:close`,t)},[]),/* @__PURE__ */ c(`wui-tour`,{ref:O,"tour-id":v,"back-label":S?.back,"next-label":S?.next,"skip-label":S?.skip,"done-label":S?.done,"progress-label":S?.progress,"advance-label":S?.advance,"media-pause-label":S?.mediaPause,"media-play-label":S?.mediaPlay,"end-title":S?.endTitle,"end-message":S?.endMessage,"end-button":S?.endButton,"end-next-label":S?.endNextLabel,"end-next-href":w,"end-dialog":C===!1?`false`:void 0,class:T||void 0,...m,...E,children:y.map(e=>/* @__PURE__ */ c(`wui-tour-step`,{target:e.target,title:e.title,media:e.media,"media-alt":e.mediaAlt,"media-poster":e.mediaPoster,"media-type":e.mediaType,"advance-on":e.advanceOn,"action-label":e.actionLabel,children:e.description},`${e.target??``}|${e.description}`))})});export{f as default};
|
package/dist/guidance.json
CHANGED
package/dist/lib/fileItem.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatFileSize as e}from"@webority/ui-elements/helpers";import{useEffect as t,useState as n}from"react";function r(e){return e instanceof File?`${e.name}:${e.size}`:e?.url||e?.name||`item`}function i(e){return e instanceof File?e.name:e?.name}function a(t){if(t instanceof File)return e(t.size);let n=t?.sizeBytes;return Number.isFinite(n)&&n!==void 0&&n>=0?e(n):null}function o(e){return
|
|
1
|
+
import{formatFileSize as e}from"@webority/ui-elements/helpers";import{useEffect as t,useState as n}from"react";function r(e){return e instanceof File?`${e.name}:${e.size}`:e?.url||e?.name||`item`}function i(e){return e instanceof File?e.name:e?.name}function a(t){if(t instanceof File)return e(t.size);let n=t?.sizeBytes;return Number.isFinite(n)&&n!==void 0&&n>=0?e(n):null}function o(e){return typeof e?.url==`string`&&e.url.length>0?e.url:null}function s(e){let t=e?.progress;return typeof t==`number`&&t>=0&&t<=99?t:null}function c(e){return typeof e?.error==`string`&&e.error.length>0?e.error:null}function l(e,r){let[i,a]=n(null);return t(()=>{if(!r)a(null);else{if(e instanceof File){let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)}a(e?.url||null)}},[e,r]),i}export{r as keyOf,o as linkOf,i as nameOf,a as sizeLabelOf,c as uploadErrorOf,s as uploadProgressOf,l as useItemUrl};
|
package/dist/lib/useTableView.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as e,useEffect as t,useState as n}from"react";var r=e=>`wui-view:${e}`;function i(e){return typeof e==`object`&&!!e}function a(e){return i(e)&&typeof e.key==`string`}function o(e,t){try{let n=window.localStorage.getItem(r(e));if(!n)return t;let o=JSON.parse(n);return i(o)?{hidden:Array.isArray(o.hidden)?o.hidden:t.hidden,sort:a(o.sort)?o.sort:t.sort}:t}catch{return t}}function s(i,{sort:a,defaultHidden:s=[]}={}){let[c,l]=n(()=>o(i,{hidden:s,sort:a}));t(()=>{try{window.localStorage.setItem(r(i),JSON.stringify(c))}catch{}},[i,c]);let u=e(e=>l(t=>({...t,hidden:t.hidden.includes(e)?t.hidden.filter(t=>t!==e):[...t.hidden,e]})),[]),d=e(e=>l(t=>({...t,sort:typeof e==`function`?e(t.sort):e})),[]);return{hiddenColumns:c.hidden,toggleColumn:u,sort:c.sort,setSort:d}}export{s as useTableView};
|
|
1
|
+
import{useCallback as e,useEffect as t,useState as n}from"react";var r=e=>`wui-view:${e}`;function i(e){return typeof e==`object`&&!!e}function a(e){return i(e)&&typeof e.key==`string`}function o(e,t){try{let n=window.localStorage.getItem(r(e));if(!n)return t;let o=JSON.parse(n);return i(o)?{hidden:Array.isArray(o.hidden)?o.hidden:t.hidden,sort:a(o.sort)?o.sort:t.sort}:t}catch{return t}}function s(i,{sort:a,defaultHidden:s=[]}={}){let[c,l]=n(()=>o(i,{hidden:s,sort:a}));t(()=>{try{window.localStorage.setItem(r(i),JSON.stringify(c))}catch(e){if(!(e instanceof DOMException))throw e}},[i,c]);let u=e(e=>l(t=>({...t,hidden:t.hidden.includes(e)?t.hidden.filter(t=>t!==e):[...t.hidden,e]})),[]),d=e(e=>l(t=>({...t,sort:typeof e==`function`?e(t.sort):e})),[]);return{hiddenColumns:c.hidden,toggleColumn:u,sort:c.sort,setSort:d}}export{s as useTableView};
|
|
@@ -6,8 +6,8 @@ export interface AppDrawerProps {
|
|
|
6
6
|
*/
|
|
7
7
|
open?: boolean | undefined;
|
|
8
8
|
onClose?: (() => void) | undefined;
|
|
9
|
-
/** The heading,
|
|
10
|
-
title?:
|
|
9
|
+
/** The heading. Text, or a node with an icon or badge. It names the dialog unless ariaLabel is set or a custom header replaces it; give ariaLabel with a custom header. */
|
|
10
|
+
title?: React.ReactNode | undefined;
|
|
11
11
|
/** Library icon beside the title. */
|
|
12
12
|
titleIcon?: string | undefined;
|
|
13
13
|
/** A custom header that replaces the default one (title, subtitle and close button). */
|
|
@@ -37,7 +37,7 @@ export interface AppSectionHeroProps {
|
|
|
37
37
|
actions?: ReactNode | undefined;
|
|
38
38
|
/** An `<img>` with `width` and `height`, beside the copy. */
|
|
39
39
|
media?: ReactNode | undefined;
|
|
40
|
-
/**
|
|
40
|
+
/** The section's id, the target of an in-page link. */
|
|
41
41
|
id?: string | undefined;
|
|
42
42
|
/**
|
|
43
43
|
* Extra class names for the root element.
|