@webority/ui-react 0.175.0 → 0.177.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 +92 -92
- package/dist/canvas-kit/manifest.json +25 -14
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppButton.js +1 -1
- package/dist/components/AppColumnMenu.js +1 -1
- package/dist/components/AppDataTable.js +1 -1
- package/dist/components/AppFilePicker.js +1 -1
- package/dist/components/AppInlineEdit.js +1 -1
- package/dist/components/AppMeter.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppSplitView.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/guidance.json +2 -8
- package/dist/types/components/AppButton.d.ts +5 -5
- package/dist/types/components/AppCheckbox.d.ts +1 -2
- package/dist/types/components/AppDataTable.d.ts +4 -2
- package/dist/types/components/AppFilePicker.d.ts +2 -2
- package/dist/types/components/AppIcon.d.ts +1 -1
- package/dist/types/components/AppShell.d.ts +2 -0
- package/dist/types/components/AppTextarea.d.ts +1 -1
- package/dist/web-core/dist/api/idempotencyKey.js +1 -1
- package/dist/web-core/dist/errors/extractApiError.js +2 -2
- package/package.json +11 -11
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "WeborityWeb",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/ui-react",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.177.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 14,
|
|
8
8
|
"platform": "Web",
|
|
@@ -1860,14 +1860,14 @@
|
|
|
1860
1860
|
"twotone"
|
|
1861
1861
|
],
|
|
1862
1862
|
"required": false,
|
|
1863
|
-
"description": "The iconsax style of a named leftIcon / rightIcon
|
|
1863
|
+
"description": "The iconsax style of a named leftIcon / rightIcon.",
|
|
1864
1864
|
"default": "linear"
|
|
1865
1865
|
},
|
|
1866
1866
|
{
|
|
1867
1867
|
"name": "leftIcon",
|
|
1868
1868
|
"type": "icon",
|
|
1869
1869
|
"required": false,
|
|
1870
|
-
"description": "An icon name,
|
|
1870
|
+
"description": "An icon name, drawn in the icon set."
|
|
1871
1871
|
},
|
|
1872
1872
|
{
|
|
1873
1873
|
"name": "loading",
|
|
@@ -1887,7 +1887,7 @@
|
|
|
1887
1887
|
"name": "rightIcon",
|
|
1888
1888
|
"type": "icon",
|
|
1889
1889
|
"required": false,
|
|
1890
|
-
"description": "An icon name,
|
|
1890
|
+
"description": "An icon name, drawn in the icon set."
|
|
1891
1891
|
},
|
|
1892
1892
|
{
|
|
1893
1893
|
"name": "shape",
|
|
@@ -2071,13 +2071,7 @@
|
|
|
2071
2071
|
{
|
|
2072
2072
|
"component": "AppButton",
|
|
2073
2073
|
"props": {
|
|
2074
|
-
"leftIcon":
|
|
2075
|
-
"component": "AppIcon",
|
|
2076
|
-
"props": {
|
|
2077
|
-
"name": "plus",
|
|
2078
|
-
"size": 16
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2074
|
+
"leftIcon": "plus"
|
|
2081
2075
|
},
|
|
2082
2076
|
"children": "Add member"
|
|
2083
2077
|
}
|
|
@@ -7626,6 +7620,12 @@
|
|
|
7626
7620
|
"required": false,
|
|
7627
7621
|
"description": "Inline styles added to every cell in the column."
|
|
7628
7622
|
},
|
|
7623
|
+
{
|
|
7624
|
+
"name": "columnClassName",
|
|
7625
|
+
"type": "string",
|
|
7626
|
+
"required": false,
|
|
7627
|
+
"description": "added to the header cell and every body cell of the column; use it to target one column from CSS, for example to hide it in a container query"
|
|
7628
|
+
},
|
|
7629
7629
|
{
|
|
7630
7630
|
"name": "grow",
|
|
7631
7631
|
"type": "boolean",
|
|
@@ -8020,8 +8020,8 @@
|
|
|
8020
8020
|
"name": "stackOnMobile",
|
|
8021
8021
|
"type": "boolean",
|
|
8022
8022
|
"required": false,
|
|
8023
|
-
"description": "
|
|
8024
|
-
"default":
|
|
8023
|
+
"description": "Stacks on phones by default: below 768px each row is a card, the first column on top, then label and value lines from the column labels, actions at the bottom. A virtual table defaults to false. Set false to keep the scrolling table.",
|
|
8024
|
+
"default": true
|
|
8025
8025
|
},
|
|
8026
8026
|
{
|
|
8027
8027
|
"name": "stickyActions",
|
|
@@ -11302,7 +11302,7 @@
|
|
|
11302
11302
|
"sm"
|
|
11303
11303
|
],
|
|
11304
11304
|
"required": false,
|
|
11305
|
-
"description": "The control height: sm, md or lg. The button form takes it too
|
|
11305
|
+
"description": "The control height: sm, md or lg, md when unset. The button form takes it too.",
|
|
11306
11306
|
"default": "md"
|
|
11307
11307
|
},
|
|
11308
11308
|
{
|
|
@@ -24840,6 +24840,12 @@
|
|
|
24840
24840
|
"nullable": true,
|
|
24841
24841
|
"description": "Suggestion groups, each with a label and its hits. Null hides the list."
|
|
24842
24842
|
},
|
|
24843
|
+
{
|
|
24844
|
+
"name": "shortcutKey",
|
|
24845
|
+
"type": "string",
|
|
24846
|
+
"required": false,
|
|
24847
|
+
"description": "One letter, a to z. Pressing Ctrl or Cmd with it focuses the field. The placeholder shows (Ctrl+K), or (⌘K) on a Mac, and aria-keyshortcuts names the chord."
|
|
24848
|
+
},
|
|
24843
24849
|
{
|
|
24844
24850
|
"name": "value",
|
|
24845
24851
|
"type": "string",
|
|
@@ -34726,6 +34732,11 @@
|
|
|
34726
34732
|
"version": "0.172.0",
|
|
34727
34733
|
"components": [],
|
|
34728
34734
|
"values": {}
|
|
34735
|
+
},
|
|
34736
|
+
{
|
|
34737
|
+
"version": "0.177.0",
|
|
34738
|
+
"components": [],
|
|
34739
|
+
"values": {}
|
|
34729
34740
|
}
|
|
34730
34741
|
]
|
|
34731
34742
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.177.0",
|
|
4
4
|
"platform": "Web",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 14,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/ui-react",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.177.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "9cbaaaed77a8036b3eb539af6c4d786a05ebd05b0f8ec1139d7f07967f9af7d6",
|
|
14
|
+
"bytes": 1136550
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "b1c009bf0dedd2b88e9cbf34c2b05dac305c267eb4c676f81e3f540b6d611b5c",
|
|
18
|
+
"bytes": 10151045
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buttonClass as e}from"../lib/buttonClass.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{FILL_VARIANTS as r,TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import{FormSubmitContext as
|
|
1
|
+
import{buttonClass as e}from"../lib/buttonClass.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{FILL_VARIANTS as r,TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import{FormSubmitContext as te}from"./AppForm.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import ne from"./warnUnknownProps.js";import s from"./withTooltip.js";import{useContext as c,useRef as l,useState as re}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{Button as ie}from"react-bootstrap";var f={sm:14,md:16,lg:20,xl:20},p=[`sheen`,`fill`,`expand`,`glow`,`roll`,`none`],m=[`rounded`,`pill`,`sharp`],h=[`button`,`submit`,`reset`],ae=/* @__PURE__ */ new Set([!0,!1,...Array.from({length:100},(e,t)=>t+1)]),oe={variant:null},se=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],g=e=>e===`pill`||e===`sharp`?`wui-btn-shape-${e}`:``;function ce(e){return/* @__PURE__ */ d(`span`,{className:`wui-btn-roll`,children:[/* @__PURE__ */ u(`span`,{className:`wui-btn-roll__a`,children:e}),/* @__PURE__ */ u(`span`,{className:`wui-btn-roll__b`,"aria-hidden":`true`,children:e})]})}function le(e,t,n,r){if(!e)return null;let i=n=>/* @__PURE__ */ u(a,{name:e,size:f[t]??f.md,variant:r,className:n});return/* @__PURE__ */ d(`span`,{className:n?`wui-btn-roll-ico wui-btn-pin-icon`:`wui-btn-roll-ico ms-2`,"aria-hidden":`true`,children:[i(),i(`wui-btn-roll-ico__next`)]})}function _(e,t,n,r){if(!e)return null;let i=t===`left`?`me-2`:`ms-2`;return/* @__PURE__ */ u(a,{name:e,size:f[n]??f.md,variant:r,className:i})}function v(e,t,n){return e?/* @__PURE__ */ u(`span`,{className:`wui-btn-pin-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ u(a,{name:e,size:f[t]??f.md,variant:n})}):null}function y(a){let{marker:y,props:ue}=ee(`AppButton`,a),{children:b,tone:x=`primary`,variant:S=`solid`,size:C=`md`,type:w=`button`,loading:T=!1,disabled:E=!1,block:D=!1,leftIcon:O=null,rightIcon:k=null,href:A,static:j=!1,tooltip:M,tooltipPlacement:N,shortcut:P,animation:F,pinRightIcon:I=!1,shape:L=`rounded`,iconVariant:R,className:z=``,onClick:B,onClickCapture:V,vibrate:H,...U}=ue,[de,W]=re(!1),G=l(!1),K=c(te),fe=K!==null&&w===`submit`&&K.submitting,q=T||de||fe;ne(`AppButton`,U),o(`AppButton`,`vibrate`,H,ae);let J=H===!0?10:typeof H==`number`&&Number.isInteger(H)&&H>=1&&H<=100?H:0;F!==void 0&&o(`AppButton`,`animation`,F,p);let Y=F===`roll`&&!j,X=I&&k!=null&&k!==``&&!j&&!q;if(o(`AppButton`,`tone`,x,i),o(`AppButton`,`variant`,S,r),o(`AppButton`,`size`,C,Object.keys(f)),o(`AppButton`,`shape`,L,m),o(`AppButton`,`type`,w,h),R!==void 0&&o(`AppButton`,`iconVariant`,R,se),j){let t=[`btn`,e(x,S),C===`sm`?`btn-sm`:C===`lg`?`btn-lg`:C===`xl`?`btn-xl`:``,D?`w-100`:``,g(L),`btn-static`,z].filter(Boolean).join(` `);return s(/* @__PURE__ */ d(`span`,{className:t,...y,...U,children:[_(O,`left`,C,R),b,_(k,`right`,C,R)]}),M,N)}let pe=[D?`w-100`:``,q?`is-loading`:``,e(x,S),C===`xl`?`btn-xl`:``,F&&p.includes(F)?`btn-anim-${F}`:``,X?`wui-btn-pin-end`:``,g(L),z].filter(Boolean).join(` `),Z=(U.as===void 0||U.as===`button`)&&A===void 0&&U.to===void 0,me=Z?{}:{role:void 0,tabIndex:E||q?-1:void 0},{as:he,...ge}=U,_e={as:he},Q=M!=null&&M!==``,ve=e=>{if(G.current)return;J&&!E&&!q&&navigator.vibrate?.(J);let t=B?.(e);if(!(t instanceof Promise))return;G.current=!0,W(!0);let n=()=>{G.current=!1,W(!1)};t.then(n,e=>{throw n(),e})},$=/* @__PURE__ */ d(ie,{type:Z?w:void 0,href:A,...oe,...C===`sm`||C===`lg`?{size:C}:null,disabled:E||q,"aria-busy":q||void 0,"aria-keyshortcuts":t(P),"data-wui-vibrate":J||void 0,className:pe||void 0,onClick:ve,onClickCapture:E||q?void 0:V,...me,...y,..._e,...ge,children:[q&&/* @__PURE__ */ u(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!q&&_(O,`left`,C,R),Y?ce(b):b,!q&&(Y?le(k,C,X,R):X?v(k,C,R):_(k,`right`,C,R)),!Q&&n(P)]});return s(E&&Q?/* @__PURE__ */ u(`span`,{className:`d-inline-block`,tabIndex:0,children:$}):$,M,N,P)}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppDropdown.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{COLUMN_MENU_TEXT as a}from"@webority/ui-elements/text";function o(o){let{marker:s,props:c}=t(`AppColumnMenu`,o),l=e(`columnMenu`,a),{columns:u,hiddenColumns:d=[],onToggle:f,label:p=l.label,className:m=``,...h}=c,g=u.filter(e=>e.hideable);return/* @__PURE__ */ i(n,{icon:`layout-grid`,label:p,menuClassName:`wui-column-menu${m?` ${m}`:``}`,...s,...h,children:[/* @__PURE__ */ r(`div`,{className:`wui-column-menu-title`,children:p}),g.map(e=>/* @__PURE__ */ i(`label`,{className:`wui-column-menu-item`,children:[/* @__PURE__ */ r(`input`,{type:`checkbox`,className:`
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppDropdown.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{COLUMN_MENU_TEXT as a}from"@webority/ui-elements/text";function o(o){let{marker:s,props:c}=t(`AppColumnMenu`,o),l=e(`columnMenu`,a),{columns:u,hiddenColumns:d=[],onToggle:f,label:p=l.label,className:m=``,...h}=c,g=u.filter(e=>e.hideable);return/* @__PURE__ */ i(n,{icon:`layout-grid`,label:p,menuClassName:`wui-column-menu${m?` ${m}`:``}`,...s,...h,children:[/* @__PURE__ */ r(`div`,{className:`wui-column-menu-title`,children:p}),g.map(e=>/* @__PURE__ */ i(`label`,{className:`wui-column-menu-item`,children:[/* @__PURE__ */ r(`input`,{type:`checkbox`,className:`form-check-input`,checked:!d.includes(e.key),onChange:()=>f(e.key)}),e.label]},e.key))]})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{emptyPlaceholder as t}from"../lib/emptyValue.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppButton.js";import o from"./AppEmptyState.js";import s from"./AppIcon.js";import ee from"./AppInfoTip.js";import c from"./AppRowActions.js";import l from"./AppSkeleton.js";import u from"./AppTablePagination.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as p,COLUMN_MIN_WIDTH as te,PIN_AT_VAR as m,PIN_SIDES as ne,ROW_HEIGHTS as re,ROW_MOVE_LIMIT as ie,ROW_SAVE_ERROR_CLASS as ae,attachRowDrag as oe,attachScrollEdges as se,downloadTable as ce,groupCount as le,groupItems as ue,isImeSafeEnter as de,measureRows as fe,pinAtValue as pe,pinClasses as me,planPins as he,playRowMoves as ge,rowOrderChanged as _e,saveOutcomeText as ve,settledRows as ye,syncTargets as be,tableCsv as xe,tableXlsx as Se,virtualRange as Ce}from"@webority/ui-elements/helpers";import{Children as we,Fragment as Te,isValidElement as Ee,useCallback as De,useEffect as h,useLayoutEffect as Oe,useMemo as ke,useRef as g,useState as _}from"react";import{Fragment as Ae,jsx as v,jsxs as y}from"react/jsx-runtime";import{DATA_TABLE_TEXT as je,ROW_ACTIONS_TEXT as Me,fillText as Ne,pluralText as Pe}from"@webority/ui-elements/text";import{FORCED_STATE_CLASSES as Fe}from"@webority/theme/runtime";var Ie=()=>import(`@webority/ui-elements/elements/data-table`),Le=[`comfortable`,`cozy`,`compact`],Re=[`hover`,`hover-menu`,`column`],ze=`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,Be=[`auto`,`fixed`],Ve=[`hover`,`always`],He=[`hide`,`show`],Ue=[1,2,3,4],We=e=>typeof e==`number`?`${e}px`:e;function Ge(e){let t=e.flatMap(e=>{let t=e.minWidth??e.width;return t===void 0?[]:[We(t)]});if(t.length!==0)return t.length===1?t[0]:`calc(${t.join(` + `)})`}function b(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function Ke(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||Ee(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function qe(e,t){return Ke(b(e,t),t)}var Je=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},x=/* @__PURE__ */ new Set;function S(t,n){!x.has(t)&&Je()&&(x.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Ye=100,Xe=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Ze=()=>{},Qe=()=>({total:0,keys:[]}),$e=[],et=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function C(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function tt(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function nt(e){return e==null||e===``?t():Array.isArray(e)?we.toArray(e):typeof e==`boolean`?String(e):e}function rt(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function w(e){n(`wui-data-table`,Ie);let t=r(`dataTable`,je),we=r(`rowActions`,Me),Ee=e=>e?Ne(t.resizeColumnText,{label:e}):t.resizeColumnLabel,{marker:We,props:Je}=i(`AppDataTable`,e),{columns:x,rows:w=$e,rowKey:it=Xe,sort:at,onSort:ot,sortIcons:st=`hover`,emptyHeader:ct=`hide`,loading:T=!1,refreshing:lt=!1,skeletonRows:ut=5,empty:dt=t.empty,emptyFiltered:ft,error:pt,onRetry:mt,sourceCount:ht,rowActions:E,linkComponent:gt,rowActionsLabel:_t,pagination:D,ariaLabel:vt,className:yt=``,wrapperClassName:bt=``,selectable:O=!1,selectedIds:k,isRowSelectable:xt,onToggleRow:St,onToggleAll:Ct,onSelectRange:wt,renderExpanded:Tt,singleExpand:Et=!1,density:Dt=`cozy`,densitySwitch:Ot=!1,exportable:kt=!1,exportName:At=`table`,onExport:jt,tableLayout:Mt=`auto`,striped:Nt=!1,flush:Pt=!1,pad:Ft,nameLines:A,headerTone:It,rowDrag:j=!1,maxHeight:Lt,stickyFirstColumn:Rt=!1,stickyActions:zt=!1,equalActions:Bt=!1,linkFirstColumn:Vt=!1,stackOnMobile:M=!1,hiddenColumns:Ht,rowStatus:Ut,rowTone:Wt,rowActionsMode:Gt=`hover`,rowHref:N,onRowClick:Kt,activeRowKey:qt,hoverRowKey:Jt,resizableColumns:P=!1,viewKey:Yt,groupBy:F,groupLabel:Xt,virtual:I=!1,rowSaving:L,rowSaveError:Zt,...Qt}=Je;f(`AppDataTable`,Qt);let{style:$t,...en}=Qt,R=De((e,t)=>{let n=it(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[it]),tn=Ht?.length?new Set(Ht):null;x=tn?x.filter(e=>!(e.hideable&&tn.has(e.key))):x,d(`AppDataTable`,`density`,Dt,Le),d(`AppDataTable`,`rowActionsMode`,Gt,Re),d(`AppDataTable`,`tableLayout`,Mt,Be),d(`AppDataTable`,`sortIcons`,st,Ve),d(`AppDataTable`,`emptyHeader`,ct,He),d(`AppDataTable`,`nameLines`,A,Ue);for(let e of x)d(`AppDataTable`,`column.pin`,e.pin,ne);let z=typeof N==`function`||typeof Kt==`function`,[nn,rn]=_(null),B=Ot&&nn?nn:Dt,an=[`table table-ledger`,B===`cozy`||B===`compact`?`wui-table-${B}`:``,Gt===`hover-menu`?`wui-table-actions-menu`:``,Gt===`column`?`wui-table-actions-column`:``,Nt?`wui-table-striped`:``,Rt?`wui-table-sticky-first`:``,st===`always`?`wui-sort-icons-always`:``,ct===`show`?`wui-table-empty-header`:``,zt?`wui-table-sticky-actions`:``,Bt?`wui-table-equal-actions`:``,M?`wui-table-stack`:``,Vt&&z?`wui-table-link-first`:``,yt].filter(Boolean).join(` `),V=typeof Tt==`function`,[on,sn]=_(()=>/* @__PURE__ */ new Set),cn=e=>sn(t=>{if(t.has(e)){let n=new Set(t);return n.delete(e),n}return Et?/* @__PURE__ */ new Set([e]):new Set(t).add(e)}),ln=x.some(e=>typeof e.footer==`function`),un=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),dn=(e,t)=>{if(un(t)||(Kt&&Kt(e),!N))return;let n=N(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},fn=Lt!==void 0,pn=lt&&!T&&w.length>0,mn=[`table-wrap`,fn?`wui-table-scroll`:``,Pt?`wui-table-flush`:``,pn?`wui-table-refreshing`:``,bt].filter(Boolean).join(` `),hn={maxHeight:fn?Lt:void 0,"--wui-table-pad":Ft!=null&&!Pt?`${Ft}px`:void 0,"--wui-name-lines":I?`1`:A?.toString(),"--wui-table-header-bg":It??void 0},gn=Object.values(hn).some(e=>e!==void 0)||$t!==void 0?{...hn,...$t}:void 0,_n=Math.max(1,x.length+ +!!E+ +!!O+ +!!V),vn=x.some(e=>e.pin===`start`||e.pin===`end`),yn=vn||P||!!F||I||kt||Ot,H=+!!V+ +!!O,bn=vn?he([...V?[`lead`]:[],...O?[`lead`]:[],...x.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...E?[null]:[]]):[],U=(e,t=``)=>{let n=bn[e];return n?{className:`${t.trim()} ${me(n)}`.trim(),style:{[m]:pe(n.side,n.ordinal)}}:{className:t,style:void 0}},xn=(e,t)=>bn[e]?{...t,...U(e).style}:t,Sn=x.length-1+ +!!E;Yt&&!P&&S(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),I&&!fn&&S(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),I&&(V||M)&&S(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),I&&A!==void 0&&A!==1&&S(`virtual-name-lines`,"`nameLines` is ignored with `virtual`: a virtual table shows one line per name."),Vt&&!z&&S(`link-first-column`,"`linkFirstColumn` needs rowHref or onRowClick: the row is what opens."),Et&&typeof Tt!=`function`&&S(`single-expand`,"`singleExpand` needs renderExpanded: there are no rows to expand."),!I&&w?.length>500&&S(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let W=I&&fn&&!V&&!M&&!T&&w?.length>0,G=(e,t)=>!xt||!!xt(e,t),Cn=O&&w?w.reduce((e,t,n)=>e+ +!!G(t,n),0):0,K=O&&w?w.reduce((e,t,n)=>e+(G(t,n)&&k?.has(R(t,n))?1:0),0):0,wn=Cn>0&&K===Cn,Tn=K>0&&!wn,En=e=>{e&&(e.indeterminate=Tn)},Dn=g(null),On=(e,t)=>{let n=Dn.current;Dn.current=e;let r=t&&n!==null?w.findIndex((e,t)=>R(e,t)===n):-1,i=w.findIndex((t,n)=>R(t,n)===e);if(r<0||i<0||r===i){St?.(e);return}let a=!k?.has(e),o=Math.min(r,i),s=w.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>G(e,t)).map(([e,t])=>R(e,t)).filter(e=>(k?.has(e)||!1)!==a);if(wt)wt(s,a);else for(let e of s)St?.(e)},kn=e=>{xt?(w||[]).forEach((t,n)=>{let r=R(t,n);G(t,n)&&(k?.has(r)||!1)!==e&&St?.(r)}):Ct?.(e)},[An,jn]=_(()=>/* @__PURE__ */ new Set),Mn=e=>jn(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),q=ke(()=>{let e=(w||[]).map((e,t)=>({row:e,i:t}));return F?ue(e,({row:e})=>String(b(e,F)??``)).flatMap(e=>[{group:e,open:!An.has(e.key)},...An.has(e.key)?[]:e.items]):e},[w,F,An]),Nn=g(null),[J,Pn]=_(null),Fn=De(e=>{Nn.current=e,Pn(e)},[]),In=g(null);h(()=>{let e=J;if(!e)return;let t=e=>{let t=e.target instanceof Element?e.target.closest(`.u-name`):null;t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=(t.textContent??``).trim())},n=e=>{let t=e.target instanceof Element?e.target.closest(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`):null;In.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(In.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=se(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[J]),h(()=>{if(!j||!J)return;let e=oe(J);return be(document),e},[j,J]);let Ln=g(Qe);Oe(()=>{Ln.current=()=>({total:w?.length??0,keys:w?w.flatMap((e,t)=>{let n=R(e,t);return G(e,t)&&k?.has(n)?[String(n)]:[]}):[]})});let Rn=g(!1);h(()=>{if(!Rn.current&&(Rn.current=!0,K===0))return;let{total:e,keys:t}=Ln.current();Nn.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:K,total:e,keys:t}}))},[K]);let[zn,Bn]=_({top:0,height:0}),[Vn,Hn]=_(re[B]??re.cozy);h(()=>{let e=J;if(!W||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};Bn(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[W,J]);let Un=g(null);Oe(()=>{if(!W){Un.current=null;return}let e=`${B}:${w?.length??0}`;if(Un.current===e)return;Un.current=e;let t=(Nn.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;t!==void 0&&t>0&&Math.abs(t-Vn)>.5&&Hn(t)});let Y={start:0,end:q.length,before:0,after:0};if(W){Y=Ce({scrollTop:zn.top,viewport:zn.height||Number.parseFloat(String(Lt))||0,rowHeight:Vn,count:q.length});let e=In.current;e!==null&&e>=0&&e<q.length&&(e<Y.start&&Y.start-e<=Ye&&(Y={...Y,start:e,before:e*Vn}),e>=Y.end&&e-Y.end<Ye&&(Y={...Y,end:e+1,after:(q.length-e-1)*Vn}))}let Wn=g(null),Gn=g(null),Kn=g(null),qn=!I&&!T&&w?.length>0&&w.length<=ie;Oe(()=>{let e=Wn.current;if(!qn||!e){Gn.current=null,Kn.current=null;return}let t=w.map((e,t)=>R(e,t));_e(Kn.current,t)&&ge(e.rows,Gn.current),Gn.current=fe(e.rows),Kn.current=t});let Jn=typeof L==`function`||typeof Zt==`function`,Yn=g(null),Xn=g(null),X=x[0]?.key;h(()=>{if(!Jn){Xn.current=null;return}let e=/* @__PURE__ */ new Map;(w||[]).forEach((t,n)=>{let r=X===void 0?void 0:b(t,X),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(R(t,n),{...et(t,L,Zt),label:i})});let t=ve(ye(Xn.current,e));Xn.current=e,t&&Yn.current&&(Yn.current.textContent=t)},[w,L,Zt,R,Jn,X]);let Zn=ft!==void 0&&(ht===void 0||ht>0)?ft:dt,Z=!T&&pt?pt:null,Qn=e=>{if(jt){jt(e);return}let t=x.map(e=>typeof e.label==`string`?e.label:e.key),n=w.map(e=>x.map(t=>{let n=t.exportValue?t.exportValue(e):b(e,t.key);return n==null?``:String(n)}));e===`csv`?ce([xe(t,n)],`text/csv;charset=utf-8`,`${At}.csv`):ce([Se(t,n)],ze,`${At}.xlsx`)},$n=({group:e,open:n},r)=>{let i=b(e.items[0]?.row,F??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ v(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":W?r+2:void 0,children:/* @__PURE__ */ v(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:_n,children:/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":n,onClick:()=>Mn(e.key),children:[/* @__PURE__ */ v(s,{name:`chevron-down`,size:16}),/* @__PURE__ */ v(`span`,{className:`wui-group-label`,children:Xt?Xt(i,a):nt(Ke(i,F??``))}),/* @__PURE__ */ v(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:le(e.items.length)}),/* @__PURE__ */ v(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${Pe(t,`groupRows`,e.items.length,{count:le(e.items.length)})}`})]})})},`group:${e.key}`)},er=({row:e,i:n},r)=>{let i=R(e,n),a=V&&on.has(i),o=qt!=null&&String(qt)===String(i),ee=Jt!=null&&String(Jt)===String(i),l=String(i).replace(/[^a-z0-9]/gi,`_`),u=U(0,`wui-expand-cell`),d=U(+!!V,`wui-select-cell`),f=Jn?et(e,L,Zt):null,p=G(e,n),te=E?.(e);if(E&&!Array.isArray(te))throw TypeError(`AppDataTable: rowActions returns a list of actions ({ key, label, icon, onClick or href }). It returned something else: restate the buttons as a list, see node scripts/codemods/row-actions.mjs --check.`);let m=X===void 0?void 0:b(e,X),ne=typeof m==`string`||typeof m==`number`?Ne(t.moreActionsForText,{firstValue:m}):we.menuLabel;return/* @__PURE__ */ y(Te,{children:[/* @__PURE__ */ y(`tr`,{className:[O&&p&&k?.has(i)?`is-selected`:``,z?`wui-row-link`:``,o?`wui-row-active`:``,ee?Fe.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":W?r+2:void 0,"aria-busy":f?.state===`saving`?`true`:void 0,"data-wui-save-state":f?.state||void 0,"data-status":Ut?.(e)||void 0,"data-tone":Wt?.(e)||void 0,"data-href":N?.(e)||void 0,"data-row-key":j?String(i):void 0,tabIndex:z?0:void 0,onClick:z?t=>dn(e,t):void 0,onAuxClick:z&&N?t=>t.button===1&&dn(e,t):void 0,onKeyDown:z?t=>{de(t.nativeEvent)&&t.target===t.currentTarget&&dn(e,t)}:void 0,children:[V&&/* @__PURE__ */ v(`td`,{className:u.className,style:u.style,children:/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${l}-expanded`:void 0,"aria-label":a?t.collapseRowLabel:t.expandRowLabel,onClick:()=>cn(i),children:/* @__PURE__ */ v(s,{name:`chevron-down`,size:16})})}),O&&/* @__PURE__ */ v(`td`,{className:d.className,style:d.style,children:/* @__PURE__ */ v(`input`,{type:`checkbox`,className:`wui-check`,checked:p&&(k?.has(i)||!1),disabled:!p,onChange:e=>On(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":t.selectRowLabel})}),x.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ y(r,{scope:t.rowHeader?`row`:void 0,className:U(H+n,(n===0?`wui-name-cell `:``)+(t.rowHeader?`wui-row-header `:``)+(t.nowrap?`text-nowrap `:``)+C(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:xn(H+n,t.cellStyle),"data-label":M&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):nt(qe(e,t.key)),n===0&&f?.state===`error`&&/* @__PURE__ */ v(`span`,{className:ae,children:f.message})]},t.key)}),E&&/* @__PURE__ */ v(`td`,{children:/* @__PURE__ */ v(c,{items:te??[],menuLabel:ne,linkComponent:gt})})]}),a&&/* @__PURE__ */ v(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ v(`td`,{id:`${l}-expanded`,colSpan:_n,children:Tt?.(e)})})]},i)},tr=(e,t)=>`group`in e?$n(e,t):er(e,t),nr=(e,t)=>W?/* @__PURE__ */ v(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ v(`td`,{colSpan:_n,style:{height:t}})},e):null,Q=U(0,`wui-expand-cell`),$=U(+!!V,`wui-select-cell`),rr=()=>Array.from({length:ut},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ y(`tr`,{children:[V&&/* @__PURE__ */ v(`td`,{className:Q.className,style:Q.style}),O&&/* @__PURE__ */ v(`td`,{className:$.className,style:$.style}),x.map((e,t)=>/* @__PURE__ */ v(`td`,{className:U(H+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+C(e.align)).className,style:xn(H+t,void 0),"data-label":M&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ v(l,{width:tt(e.align),height:12,radius:6})},e.key)),E&&/* @__PURE__ */ v(`td`,{children:/* @__PURE__ */ v(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ v(l,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ y(Ae,{children:[/* @__PURE__ */ y(yn?`wui-data-table`:`div`,{ref:Fn,...yn?{class:mn,resizable:P?``:void 0,"view-key":Yt||void 0,"data-wui-row-drag":j?``:void 0,"aria-busy":pn||void 0}:{className:mn,"data-wui-row-drag":j?``:void 0,"aria-busy":pn||void 0},style:gn,tabIndex:0,...We,...en,children:[kt&&/* @__PURE__ */ y(`div`,{className:`wui-table-export`,children:[/* @__PURE__ */ v(a,{variant:`soft`,size:`sm`,onClick:()=>Qn(`csv`),children:t.exportCsvLabel}),/* @__PURE__ */ v(a,{variant:`soft`,size:`sm`,onClick:()=>Qn(`xlsx`),children:t.exportExcelLabel})]}),Ot&&/* @__PURE__ */ y(`div`,{className:`wui-table-density`,role:`group`,"aria-label":t.densityLabel,children:[/* @__PURE__ */ v(a,{variant:`soft`,size:`sm`,"aria-pressed":B===`comfortable`,"aria-label":t.densityComfortableLabel,onClick:()=>rn(`comfortable`),children:/* @__PURE__ */ v(s,{name:`list`,size:16})}),/* @__PURE__ */ v(a,{variant:`soft`,size:`sm`,"aria-pressed":B===`compact`,"aria-label":t.densityCompactLabel,onClick:()=>rn(`compact`),children:/* @__PURE__ */ v(s,{name:`grid`,size:16})})]}),/* @__PURE__ */ y(`table`,{className:an,"aria-label":vt,"aria-rowcount":W?q.length+1:void 0,style:Mt===`fixed`?{tableLayout:`fixed`,minWidth:Ge(x)}:void 0,children:[/* @__PURE__ */ v(`thead`,{children:/* @__PURE__ */ y(`tr`,{"aria-rowindex":W?1:void 0,children:[V&&/* @__PURE__ */ v(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ v(`span`,{className:`visually-hidden`,children:t.expandLabel})}),O&&/* @__PURE__ */ v(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ v(`input`,{ref:En,type:`checkbox`,className:`wui-check`,checked:wn,disabled:T,onChange:e=>kn(e.target.checked),"aria-label":t.selectAllRowsLabel})}),x.map((e,t)=>{let n=e.sortable?ot:void 0,r=n!==void 0,i=at&&at.key===e.key,a=e.align===`num`||e.align===`end`,o=r&&/* @__PURE__ */ v(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:/* @__PURE__ */ v(s,{name:`chevrons-up-down`,size:14})}),c=P&&t!==Sn,l=Mt===`fixed`&&!e.grow?e.minWidth:void 0,u=e.width||e.minWidth?{width:e.width??l,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ y(`th`,{className:U(H+t,(r?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(c?`wui-col-resizable `:``)+C(e.align)).className,style:xn(H+t,u),"data-key":yn?e.key:void 0,"aria-label":c&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:r?0:void 0,"aria-sort":i?at?.dir===`asc`?`ascending`:`descending`:r?`none`:void 0,onClick:n?t=>{t.target instanceof Element&&t.target.closest(`.infotip`)||T||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(de(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),T||n(e.key))}:void 0,children:[a&&o,e.label,!a&&o,e.help?/* @__PURE__ */ v(ee,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null,c&&/* @__PURE__ */ v(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":te,"aria-valuemax":p,tabIndex:0,"aria-label":Ee(typeof e.label==`string`?e.label:e.key)})]},e.key)}),E&&(_t?/* @__PURE__ */ v(`th`,{className:`wui-cell-end`,children:_t}):/* @__PURE__ */ v(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ v(`span`,{className:`visually-hidden`,children:t.rowActionsLabel})}))]})}),/* @__PURE__ */ v(`tbody`,{ref:Wn,children:T?rr():Z?null:w?.length?/* @__PURE__ */ y(Ae,{children:[nr(`before`,Y.before),q.slice(Y.start,Y.end).map((e,t)=>tr(e,Y.start+t)),nr(`after`,Y.after)]}):null}),ln&&!T&&!Z&&w?.length>0&&/* @__PURE__ */ v(`tfoot`,{children:/* @__PURE__ */ y(`tr`,{children:[V&&/* @__PURE__ */ v(`td`,{className:Q.className,style:Q.style}),O&&/* @__PURE__ */ v(`td`,{className:$.className,style:$.style}),x.map((e,t)=>/* @__PURE__ */ v(`td`,{className:U(H+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+C(e.align)).className,style:xn(H+t,void 0),children:e.footer?e.footer(w):null},e.key)),E&&/* @__PURE__ */ v(`td`,{})]})})]}),!T&&(Z||!w?.length)&&/* @__PURE__ */ v(`div`,{className:`tbl-empty-block`,role:Z?`alert`:void 0,children:Z?/* @__PURE__ */ v(o,{variant:`table`,icon:`alert-circle`,description:Z.message,action:mt?/* @__PURE__ */ v(a,{variant:`soft`,size:`sm`,onClick:()=>mt(),children:t.retryLabel}):void 0,className:`wui-table-error`}):typeof Zn==`string`?/* @__PURE__ */ v(`div`,{className:`tbl-empty-plain`,children:Zn}):Zn})]}),rt(D)&&/* @__PURE__ */ v(u,{page:D.page,totalPages:D.totalPages,total:D.total,pageSize:D.pageSize,onPageChange:T?Ze:D.setPage,onPageSizeChange:T?Ze:D.setPageSize,pageSizes:D.pageSizes,mode:D.mode,summary:D.summary}),Jn&&/* @__PURE__ */ v(`div`,{ref:Yn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{w as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{emptyPlaceholder as t}from"../lib/emptyValue.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppButton.js";import o from"./AppEmptyState.js";import s from"./AppIcon.js";import ee from"./AppInfoTip.js";import te from"./AppRowActions.js";import c from"./AppSkeleton.js";import l from"./AppTablePagination.js";import u from"./assertValidValue.js";import d from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as f,COLUMN_MIN_WIDTH as ne,PIN_AT_VAR as p,PIN_SIDES as re,ROW_HEIGHTS as ie,ROW_MOVE_LIMIT as ae,ROW_SAVE_ERROR_CLASS as oe,attachRowDrag as se,attachScrollEdges as ce,downloadTable as le,groupCount as ue,groupItems as de,isImeSafeEnter as fe,measureRows as pe,pinAtValue as me,pinClasses as he,planPins as ge,playRowMoves as _e,rowOrderChanged as ve,saveOutcomeText as ye,settledRows as be,syncTargets as xe,tableCsv as Se,tableXlsx as Ce,virtualRange as we}from"@webority/ui-elements/helpers";import{Children as Te,Fragment as Ee,isValidElement as De,useCallback as Oe,useEffect as m,useLayoutEffect as ke,useMemo as Ae,useRef as h,useState as g}from"react";import{Fragment as je,jsx as _,jsxs as v}from"react/jsx-runtime";import{DATA_TABLE_TEXT as Me,ROW_ACTIONS_TEXT as Ne,fillText as Pe,pluralText as Fe}from"@webority/ui-elements/text";import{FORCED_STATE_CLASSES as Ie}from"@webority/theme/runtime";var Le=()=>import(`@webority/ui-elements/elements/data-table`),Re=[`comfortable`,`cozy`,`compact`],ze=[`hover`,`hover-menu`,`column`],Be=`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,Ve=[`auto`,`fixed`],He=[`hover`,`always`],Ue=[`hide`,`show`],We=[1,2,3,4],Ge=e=>typeof e==`number`?`${e}px`:e;function Ke(e){let t=e.flatMap(e=>{let t=e.minWidth??e.width;return t===void 0?[]:[Ge(t)]});if(t.length!==0)return t.length===1?t[0]:`calc(${t.join(` + `)})`}function y(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function qe(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||De(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function Je(e,t){return qe(y(e,t),t)}var Ye=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},b=/* @__PURE__ */ new Set;function x(t,n){!b.has(t)&&Ye()&&(b.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Xe=100,Ze=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Qe=()=>{},$e=()=>({total:0,keys:[]}),et=[],tt=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function S(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function nt(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function rt(e){return e==null||e===``?t():Array.isArray(e)?Te.toArray(e):typeof e==`boolean`?String(e):e}function it(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function C(e){n(`wui-data-table`,Le);let t=r(`dataTable`,Me),Te=r(`rowActions`,Ne),De=e=>e?Pe(t.resizeColumnText,{label:e}):t.resizeColumnLabel,{marker:Ge,props:Ye}=i(`AppDataTable`,e),{columns:b,rows:C=et,rowKey:at=Ze,sort:ot,onSort:st,sortIcons:ct=`hover`,emptyHeader:lt=`hide`,loading:w=!1,refreshing:ut=!1,skeletonRows:dt=5,empty:ft=t.empty,emptyFiltered:pt,error:mt,onRetry:ht,sourceCount:gt,rowActions:T,linkComponent:_t,rowActionsLabel:vt,pagination:E,ariaLabel:yt,className:bt=``,wrapperClassName:xt=``,selectable:D=!1,selectedIds:O,isRowSelectable:St,onToggleRow:Ct,onToggleAll:wt,onSelectRange:Tt,renderExpanded:Et,singleExpand:Dt=!1,density:Ot=`cozy`,densitySwitch:kt=!1,exportable:At=!1,exportName:jt=`table`,onExport:Mt,tableLayout:Nt=`auto`,striped:Pt=!1,flush:Ft=!1,pad:It,nameLines:Lt,headerTone:Rt,rowDrag:k=!1,maxHeight:zt,stickyFirstColumn:Bt=!1,stickyActions:Vt=!1,equalActions:Ht=!1,linkFirstColumn:Ut=!1,stackOnMobile:Wt,hiddenColumns:Gt,rowStatus:Kt,rowTone:qt,rowActionsMode:Jt=`hover`,rowHref:A,onRowClick:Yt,activeRowKey:Xt,hoverRowKey:Zt,resizableColumns:j=!1,viewKey:Qt,groupBy:M,groupLabel:$t,virtual:N=!1,rowSaving:P,rowSaveError:en,...tn}=Ye;d(`AppDataTable`,tn);let{style:nn,...rn}=tn,an=Wt??!N,F=Oe((e,t)=>{let n=at(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[at]),on=Gt?.length?new Set(Gt):null;b=on?b.filter(e=>!(e.hideable&&on.has(e.key))):b,u(`AppDataTable`,`density`,Ot,Re),u(`AppDataTable`,`rowActionsMode`,Jt,ze),u(`AppDataTable`,`tableLayout`,Nt,Ve),u(`AppDataTable`,`sortIcons`,ct,He),u(`AppDataTable`,`emptyHeader`,lt,Ue),u(`AppDataTable`,`nameLines`,Lt,We);for(let e of b)u(`AppDataTable`,`column.pin`,e.pin,re);let I=typeof A==`function`||typeof Yt==`function`,[sn,cn]=g(null),L=kt&&sn?sn:Ot,ln=[`table table-ledger`,L===`cozy`||L===`compact`?`wui-table-${L}`:``,Jt===`hover-menu`?`wui-table-actions-menu`:``,Jt===`column`?`wui-table-actions-column`:``,Pt?`wui-table-striped`:``,Bt?`wui-table-sticky-first`:``,ct===`always`?`wui-sort-icons-always`:``,lt===`show`?`wui-table-empty-header`:``,Vt?`wui-table-sticky-actions`:``,Ht?`wui-table-equal-actions`:``,an?`wui-table-stack`:``,Ut&&I?`wui-table-link-first`:``,bt].filter(Boolean).join(` `),R=typeof Et==`function`,[un,dn]=g(()=>/* @__PURE__ */ new Set),fn=e=>dn(t=>{if(t.has(e)){let n=new Set(t);return n.delete(e),n}return Dt?/* @__PURE__ */ new Set([e]):new Set(t).add(e)}),pn=b.some(e=>typeof e.footer==`function`),mn=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),hn=(e,t)=>{if(mn(t)||(Yt&&Yt(e),!A))return;let n=A(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},z=zt!==void 0,gn=ut&&!w&&C.length>0,_n=[`table-wrap`,z?`wui-table-scroll`:``,Ft?`wui-table-flush`:``,gn?`wui-table-refreshing`:``,xt].filter(Boolean).join(` `),vn={maxHeight:z?zt:void 0,"--wui-table-pad":It!=null&&!Ft?`${It}px`:void 0,"--wui-name-lines":N?`1`:Lt?.toString(),"--wui-table-header-bg":Rt??void 0},yn=Object.values(vn).some(e=>e!==void 0)||nn!==void 0?{...vn,...nn}:void 0,bn=Math.max(1,b.length+ +!!T+ +!!D+ +!!R),xn=b.some(e=>e.pin===`start`||e.pin===`end`),Sn=xn||j||!!M||N||At||kt,B=+!!R+ +!!D,Cn=xn?ge([...R?[`lead`]:[],...D?[`lead`]:[],...b.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...T?[null]:[]]):[],V=(e,t=``)=>{let n=Cn[e];return n?{className:`${t.trim()} ${he(n)}`.trim(),style:{[p]:me(n.side,n.ordinal)}}:{className:t,style:void 0}},H=(e,t)=>Cn[e]?{...t,...V(e).style}:t,wn=b.length-1+ +!!T;Qt&&!j&&x(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),N&&!z&&x(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),N&&(R||Wt===!0)&&x(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),N&&Lt!==void 0&&Lt!==1&&x(`virtual-name-lines`,"`nameLines` is ignored with `virtual`: a virtual table shows one line per name."),Ut&&!I&&x(`link-first-column`,"`linkFirstColumn` needs rowHref or onRowClick: the row is what opens."),Dt&&typeof Et!=`function`&&x(`single-expand`,"`singleExpand` needs renderExpanded: there are no rows to expand."),!N&&C?.length>500&&x(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let U=N&&z&&!R&&!an&&!w&&C?.length>0,W=(e,t)=>!St||!!St(e,t),Tn=D&&C?C.reduce((e,t,n)=>e+ +!!W(t,n),0):0,G=D&&C?C.reduce((e,t,n)=>e+(W(t,n)&&O?.has(F(t,n))?1:0),0):0,En=Tn>0&&G===Tn,Dn=G>0&&!En,On=e=>{e&&(e.indeterminate=Dn)},kn=h(null),An=(e,t)=>{let n=kn.current;kn.current=e;let r=t&&n!==null?C.findIndex((e,t)=>F(e,t)===n):-1,i=C.findIndex((t,n)=>F(t,n)===e);if(r<0||i<0||r===i){Ct?.(e);return}let a=!O?.has(e),o=Math.min(r,i),s=C.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>W(e,t)).map(([e,t])=>F(e,t)).filter(e=>(O?.has(e)||!1)!==a);if(Tt)Tt(s,a);else for(let e of s)Ct?.(e)},jn=e=>{St?(C||[]).forEach((t,n)=>{let r=F(t,n);W(t,n)&&(O?.has(r)||!1)!==e&&Ct?.(r)}):wt?.(e)},[Mn,Nn]=g(()=>/* @__PURE__ */ new Set),Pn=e=>Nn(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),K=Ae(()=>{let e=(C||[]).map((e,t)=>({row:e,i:t}));return M?de(e,({row:e})=>String(y(e,M)??``)).flatMap(e=>[{group:e,open:!Mn.has(e.key)},...Mn.has(e.key)?[]:e.items]):e},[C,M,Mn]),Fn=h(null),[q,In]=g(null),Ln=Oe(e=>{Fn.current=e,In(e)},[]),Rn=h(null);m(()=>{let e=q;if(!e)return;let t=e=>{let t=e.target instanceof Element?e.target.closest(`.u-name`):null;t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=(t.textContent??``).trim())},n=e=>{let t=e.target instanceof Element?e.target.closest(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`):null;Rn.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(Rn.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=ce(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[q]),m(()=>{if(!k||!q)return;let e=se(q);return xe(document),e},[k,q]);let zn=h($e);ke(()=>{zn.current=()=>({total:C?.length??0,keys:C?C.flatMap((e,t)=>{let n=F(e,t);return W(e,t)&&O?.has(n)?[String(n)]:[]}):[]})});let Bn=h(!1);m(()=>{if(!Bn.current&&(Bn.current=!0,G===0))return;let{total:e,keys:t}=zn.current();Fn.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:G,total:e,keys:t}}))},[G]);let[Vn,Hn]=g({top:0,height:0}),[J,Un]=g(ie[L]??ie.cozy);m(()=>{let e=q;if(!U||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};Hn(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[U,q]);let Wn=h(null);ke(()=>{if(!U){Wn.current=null;return}let e=`${L}:${C?.length??0}`;if(Wn.current===e)return;Wn.current=e;let t=(Fn.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;t!==void 0&&t>0&&Math.abs(t-J)>.5&&Un(t)});let Y={start:0,end:K.length,before:0,after:0};if(U){Y=we({scrollTop:Vn.top,viewport:Vn.height||Number.parseFloat(String(zt))||0,rowHeight:J,count:K.length});let e=Rn.current;e!==null&&e>=0&&e<K.length&&(e<Y.start&&Y.start-e<=Xe&&(Y={...Y,start:e,before:e*J}),e>=Y.end&&e-Y.end<Xe&&(Y={...Y,end:e+1,after:(K.length-e-1)*J}))}let Gn=h(null),Kn=h(null),qn=h(null),Jn=!N&&!w&&C?.length>0&&C.length<=ae;ke(()=>{let e=Gn.current;if(!Jn||!e){Kn.current=null,qn.current=null;return}let t=C.map((e,t)=>F(e,t));ve(qn.current,t)&&_e(e.rows,Kn.current),Kn.current=pe(e.rows),qn.current=t});let Yn=typeof P==`function`||typeof en==`function`,Xn=h(null),Zn=h(null),X=b[0]?.key;m(()=>{if(!Yn){Zn.current=null;return}let e=/* @__PURE__ */ new Map;(C||[]).forEach((t,n)=>{let r=X===void 0?void 0:y(t,X),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(F(t,n),{...tt(t,P,en),label:i})});let t=ye(be(Zn.current,e));Zn.current=e,t&&Xn.current&&(Xn.current.textContent=t)},[C,P,en,F,Yn,X]);let Qn=pt!==void 0&&(gt===void 0||gt>0)?pt:ft,Z=!w&&mt?mt:null,$n=e=>{if(Mt){Mt(e);return}let t=b.map(e=>typeof e.label==`string`?e.label:e.key),n=C.map(e=>b.map(t=>{let n=t.exportValue?t.exportValue(e):y(e,t.key);return n==null?``:String(n)}));e===`csv`?le([Se(t,n)],`text/csv;charset=utf-8`,`${jt}.csv`):le([Ce(t,n)],Be,`${jt}.xlsx`)},er=({group:e,open:n},r)=>{let i=y(e.items[0]?.row,M??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ _(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":U?r+2:void 0,children:/* @__PURE__ */ _(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:bn,children:/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":n,onClick:()=>Pn(e.key),children:[/* @__PURE__ */ _(s,{name:`chevron-down`,size:16}),/* @__PURE__ */ _(`span`,{className:`wui-group-label`,children:$t?$t(i,a):rt(qe(i,M??``))}),/* @__PURE__ */ _(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:ue(e.items.length)}),/* @__PURE__ */ _(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${Fe(t,`groupRows`,e.items.length,{count:ue(e.items.length)})}`})]})})},`group:${e.key}`)},tr=({row:e,i:n},r)=>{let i=F(e,n),a=R&&un.has(i),o=Xt!=null&&String(Xt)===String(i),ee=Zt!=null&&String(Zt)===String(i),c=String(i).replace(/[^a-z0-9]/gi,`_`),l=V(0,`wui-expand-cell`),u=V(+!!R,`wui-select-cell`),d=Yn?tt(e,P,en):null,f=W(e,n),ne=T?.(e);if(T&&!Array.isArray(ne))throw TypeError(`AppDataTable: rowActions returns a list of actions ({ key, label, icon, onClick or href }). It returned something else: restate the buttons as a list, see node scripts/codemods/row-actions.mts --check.`);let p=X===void 0?void 0:y(e,X),re=typeof p==`string`||typeof p==`number`?Pe(t.moreActionsForText,{firstValue:p}):Te.menuLabel;return/* @__PURE__ */ v(Ee,{children:[/* @__PURE__ */ v(`tr`,{className:[D&&f&&O?.has(i)?`is-selected`:``,I?`wui-row-link`:``,o?`wui-row-active`:``,ee?Ie.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":U?r+2:void 0,"aria-busy":d?.state===`saving`?`true`:void 0,"data-wui-save-state":d?.state||void 0,"data-status":Kt?.(e)||void 0,"data-tone":qt?.(e)||void 0,"data-href":A?.(e)||void 0,"data-row-key":k?String(i):void 0,tabIndex:I?0:void 0,onClick:I?t=>hn(e,t):void 0,onAuxClick:I&&A?t=>t.button===1&&hn(e,t):void 0,onKeyDown:I?t=>{fe(t.nativeEvent)&&t.target===t.currentTarget&&hn(e,t)}:void 0,children:[R&&/* @__PURE__ */ _(`td`,{className:l.className,style:l.style,children:/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${c}-expanded`:void 0,"aria-label":a?t.collapseRowLabel:t.expandRowLabel,onClick:()=>fn(i),children:/* @__PURE__ */ _(s,{name:`chevron-down`,size:16})})}),D&&/* @__PURE__ */ _(`td`,{className:u.className,style:u.style,children:/* @__PURE__ */ _(`input`,{type:`checkbox`,className:`form-check-input`,checked:f&&(O?.has(i)||!1),disabled:!f,onChange:e=>An(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":t.selectRowLabel})}),b.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ v(r,{scope:t.rowHeader?`row`:void 0,className:V(B+n,(n===0?`wui-name-cell `:``)+(t.rowHeader?`wui-row-header `:``)+(t.nowrap?`text-nowrap `:``)+S(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)+(t.columnClassName?` ${t.columnClassName}`:``)).className,style:H(B+n,t.cellStyle),"data-label":an&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):rt(Je(e,t.key)),n===0&&d?.state===`error`&&/* @__PURE__ */ _(`span`,{className:oe,children:d.message})]},t.key)}),T&&/* @__PURE__ */ _(`td`,{children:/* @__PURE__ */ _(te,{items:ne??[],menuLabel:re,linkComponent:_t})})]}),a&&/* @__PURE__ */ _(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ _(`td`,{id:`${c}-expanded`,colSpan:bn,children:Et?.(e)})})]},i)},nr=(e,t)=>`group`in e?er(e,t):tr(e,t),rr=(e,t)=>U?/* @__PURE__ */ _(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ _(`td`,{colSpan:bn,style:{height:t}})},e):null,Q=V(0,`wui-expand-cell`),$=V(+!!R,`wui-select-cell`),ir=()=>Array.from({length:dt},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ v(`tr`,{children:[R&&/* @__PURE__ */ _(`td`,{className:Q.className,style:Q.style}),D&&/* @__PURE__ */ _(`td`,{className:$.className,style:$.style}),b.map((e,t)=>/* @__PURE__ */ _(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+S(e.align)+(e.columnClassName?` ${e.columnClassName}`:``)).className,style:H(B+t,void 0),"data-label":an&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ _(c,{width:nt(e.align),height:12,radius:6})},e.key)),T&&/* @__PURE__ */ _(`td`,{children:/* @__PURE__ */ _(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ _(c,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ v(je,{children:[/* @__PURE__ */ v(Sn?`wui-data-table`:`div`,{ref:Ln,...Sn?{class:_n,resizable:j?``:void 0,"view-key":Qt||void 0,"data-wui-row-drag":k?``:void 0,"aria-busy":gn||void 0}:{className:_n,"data-wui-row-drag":k?``:void 0,"aria-busy":gn||void 0},style:yn,tabIndex:0,...Ge,...rn,children:[At&&/* @__PURE__ */ v(`div`,{className:`wui-table-export`,children:[/* @__PURE__ */ _(a,{variant:`soft`,size:`sm`,onClick:()=>$n(`csv`),children:t.exportCsvLabel}),/* @__PURE__ */ _(a,{variant:`soft`,size:`sm`,onClick:()=>$n(`xlsx`),children:t.exportExcelLabel})]}),kt&&/* @__PURE__ */ v(`div`,{className:`wui-table-density`,role:`group`,"aria-label":t.densityLabel,children:[/* @__PURE__ */ _(a,{variant:`soft`,size:`sm`,"aria-pressed":L===`comfortable`,"aria-label":t.densityComfortableLabel,onClick:()=>cn(`comfortable`),children:/* @__PURE__ */ _(s,{name:`list`,size:16})}),/* @__PURE__ */ _(a,{variant:`soft`,size:`sm`,"aria-pressed":L===`compact`,"aria-label":t.densityCompactLabel,onClick:()=>cn(`compact`),children:/* @__PURE__ */ _(s,{name:`grid`,size:16})})]}),/* @__PURE__ */ v(`table`,{className:ln,"aria-label":yt,"aria-rowcount":U?K.length+1:void 0,style:Nt===`fixed`?{tableLayout:`fixed`,minWidth:Ke(b)}:void 0,children:[/* @__PURE__ */ _(`thead`,{children:/* @__PURE__ */ v(`tr`,{"aria-rowindex":U?1:void 0,children:[R&&/* @__PURE__ */ _(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ _(`span`,{className:`visually-hidden`,children:t.expandLabel})}),D&&/* @__PURE__ */ _(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ _(`input`,{ref:On,type:`checkbox`,className:`form-check-input`,checked:En,disabled:w,onChange:e=>jn(e.target.checked),"aria-label":t.selectAllRowsLabel})}),b.map((e,t)=>{let n=e.sortable?st:void 0,r=n!==void 0,i=ot&&ot.key===e.key,a=e.align===`num`||e.align===`end`,o=r&&/* @__PURE__ */ _(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:/* @__PURE__ */ _(s,{name:`chevrons-up-down`,size:14})}),te=j&&t!==wn,c=Nt===`fixed`&&!e.grow?e.minWidth:void 0,l=e.width||e.minWidth?{width:e.width??c,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ v(`th`,{className:V(B+t,(r?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(te?`wui-col-resizable `:``)+S(e.align)+(e.columnClassName?` ${e.columnClassName}`:``)).className,style:H(B+t,l),"data-key":Sn?e.key:void 0,"aria-label":te&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:r?0:void 0,"aria-sort":i?ot?.dir===`asc`?`ascending`:`descending`:r?`none`:void 0,onClick:n?t=>{t.target instanceof Element&&t.target.closest(`.infotip`)||w||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(fe(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),w||n(e.key))}:void 0,children:[a&&o,e.label,!a&&o,e.help?/* @__PURE__ */ _(ee,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null,te&&/* @__PURE__ */ _(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":ne,"aria-valuemax":f,tabIndex:0,"aria-label":De(typeof e.label==`string`?e.label:e.key)})]},e.key)}),T&&(vt?/* @__PURE__ */ _(`th`,{className:`wui-cell-end`,children:vt}):/* @__PURE__ */ _(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ _(`span`,{className:`visually-hidden`,children:t.rowActionsLabel})}))]})}),/* @__PURE__ */ _(`tbody`,{ref:Gn,children:w?ir():Z?null:C?.length?/* @__PURE__ */ v(je,{children:[rr(`before`,Y.before),K.slice(Y.start,Y.end).map((e,t)=>nr(e,Y.start+t)),rr(`after`,Y.after)]}):null}),pn&&!w&&!Z&&C?.length>0&&/* @__PURE__ */ _(`tfoot`,{children:/* @__PURE__ */ v(`tr`,{children:[R&&/* @__PURE__ */ _(`td`,{className:Q.className,style:Q.style}),D&&/* @__PURE__ */ _(`td`,{className:$.className,style:$.style}),b.map((e,t)=>/* @__PURE__ */ _(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+S(e.align)+(e.columnClassName?` ${e.columnClassName}`:``)).className,style:H(B+t,void 0),children:e.footer?e.footer(C):null},e.key)),T&&/* @__PURE__ */ _(`td`,{})]})})]}),!w&&(Z||!C?.length)&&/* @__PURE__ */ _(`div`,{className:`tbl-empty-block`,role:Z?`alert`:void 0,children:Z?/* @__PURE__ */ _(o,{variant:`table`,icon:`alert-circle`,description:Z.message,action:ht?/* @__PURE__ */ _(a,{variant:`soft`,size:`sm`,onClick:()=>ht(),children:t.retryLabel}):void 0,className:`wui-table-error`}):typeof Qn==`string`?/* @__PURE__ */ _(`div`,{className:`tbl-empty-plain`,children:Qn}):Qn})]}),it(E)&&/* @__PURE__ */ _(l,{page:E.page,totalPages:E.totalPages,total:E.total,pageSize:E.pageSize,onPageChange:w?Qe:E.setPage,onPageSizeChange:w?Qe:E.setPageSize,pageSizes:E.pageSizes,mode:E.mode,summary:E.summary}),Yn&&/* @__PURE__ */ _(`div`,{ref:Xn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{C 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{BOX_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import{useFieldError as a}from"../lib/formFields.js";import ee from"../lib/useFileDrop.js";import te from"../lib/useWuiText.js";import{splitMarkerProps as ne}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import re from"./AppInfoTip.js";import ie from"./AppRequiredMark.js";import ae from"./AppSpinner.js";import oe from"./assertValidValue.js";import se from"./warnUnknownProps.js";import ce from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as le,acceptDroppedFiles as ue,acceptLabel as s,isImageFile as c,isImageOnlyAccept as de,isPdfFile as fe}from"@webority/ui-elements/helpers";import{useEffect as l,useId as pe,useRef as me,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{FILE_PICKER_TEXT as he,fillText as p}from"@webority/ui-elements/text";var ge=[`dropzone`,`button`],_e={sm:` wui-input-sm`,md:``,lg:` wui-input-lg`}
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{BOX_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import{useFieldError as a}from"../lib/formFields.js";import ee from"../lib/useFileDrop.js";import te from"../lib/useWuiText.js";import{splitMarkerProps as ne}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import re from"./AppInfoTip.js";import ie from"./AppRequiredMark.js";import ae from"./AppSpinner.js";import oe from"./assertValidValue.js";import se from"./warnUnknownProps.js";import ce from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as le,acceptDroppedFiles as ue,acceptLabel as s,isImageFile as c,isImageOnlyAccept as de,isPdfFile as fe}from"@webority/ui-elements/helpers";import{useEffect as l,useId as pe,useRef as me,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{FILE_PICKER_TEXT as he,fillText as p}from"@webority/ui-elements/text";var ge=[`dropzone`,`button`],_e={sm:` wui-input-sm`,md:``,lg:` wui-input-lg`};function m(e){return e instanceof File?e:{url:e.url,...e.name===void 0?null:{name:e.name}}}function h(h){let{marker:ve,props:ye}=ne(`AppFilePicker`,h),g=te(`filePicker`,he),{label:_,value:v,name:be,id:xe,onChange:Se,multiple:y=!1,variant:b=`dropzone`,buttonLabel:Ce=g.buttonLabel,browseLabel:we=g.browseLabel,dropLabel:Te=g.dropLabel,maxSizeText:Ee=g.maxSizeText,optionalLabel:De=g.optionalLabel,changeImageLabel:Oe=g.changeImageLabel,changeFileLabel:ke=g.changeFileLabel,maxFilesText:Ae=g.maxFilesText,removeFileLabel:je=g.removeFileLabel,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=le,required:w,optional:Me=!1,error:Ne,helperText:T,help:E,helpLabel:Pe=g.helpLabel,loading:D=!1,readOnly:O=!1,size:k,disabled:A=!1,className:j=``,fieldClassName:M=``,style:N,...P}=ye,Fe=a(be),Ie=Ne??Fe;if(se(`AppFilePicker`,P),oe(`AppFilePicker`,`variant`,b,ge),oe(`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?``:_e[k]??``,I=O?{"aria-readonly":`true`,"data-wui-readonly":``}:null,[Le,L]=u(null),[Re,R]=u(null),[z,ze]=u(null),[Be,B]=u(``),V=me(null),Ve=pe(),H=xe||Ve,U=A||D;l(()=>{if(!y&&v instanceof File&&c(v)){let e=URL.createObjectURL(v);return L(e),()=>URL.revokeObjectURL(e)}L(null)},[v,y]);let W=y||Array.isArray(v)?void 0:v,G=W&&!c(m(W))&&fe(m(W))?W instanceof File?W:W.url:null;l(()=>{if(!G){R(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof G==`string`?{url:G}:G)).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)}},[G]);let K=y?Array.isArray(v)?v:v?[v]:[]:[],q=Ie||Be,He=q?`${H}-error`:void 0,Ue=T&&!q?`${H}-hint`:void 0,We=He||Ue,Ge=de(S),Ke=b===`button`,qe=`btn btn-outline-primary${k===`sm`?` btn-sm`:k===`lg`?` btn-lg`:``}`,Je=!y&&!!v,J=!!W&&(W instanceof File?c(W):Ge||c(m(W))),Ye=W?.name,Xe=W instanceof File?void 0:W?.url,Y=J?Xe||Le:Re,X=J?g.imageLabel:g.fileLabel,Ze=p(g.changeNamedText,{label:_||X}),Qe=p(g.removeNamedText,{label:_||X}),$e=_?p(g.previewAltText,{label:_}):p(g.selectedPreviewText,{noun:X}),et={accept:S,maxSizeMb:C,multiple:y},tt=e=>{h.multiple||h.onChange(e)},nt=e=>{h.multiple&&h.onChange(e)},rt=e=>{if(B(``),!y){tt(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 a=t.concat(r);x&&a.length>x&&(a=a.slice(0,x),B(p(Ae,{count:x}))),nt(a)},Z=e=>B(e.message),{dragOver:it,dropProps:at}=ee({...et,disabled:U||O,onFiles:rt,onReject:Z}),ot=e=>{if(O)return;let{files:t,rejections:n}=ue(e,et);t.length&&rt(t);let[r]=n;r&&Z(r)},st=e=>ot(e.target.files),ct=e=>{O||(B(``),nt(K.filter((t,n)=>n!==e)))},lt=()=>{O||V.current?.click()},Q=D?/* @__PURE__ */ d(`span`,{className:`wui-file-busy`,children:/* @__PURE__ */ d(ae,{size:`sm`})}):null,$=/* @__PURE__ */ d(`input`,{id:H,name:be,ref:V,type:`file`,"aria-describedby":We,accept:S,multiple:y||void 0,disabled:U||void 0,className:`visually-hidden`,onClick:e=>{O?e.preventDefault():e.currentTarget.value=``},onChange:st,...P});return/* @__PURE__ */ f(`div`,{...ve,className:`field${M?` ${M}`:``}`,children:[_?/* @__PURE__ */ f(`label`,{className:`label`,htmlFor:H,children:[_,Me&&!w&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${De}`}),w&&/* @__PURE__ */ d(ie,{}),E&&/* @__PURE__ */ d(re,{label:Pe,children:E})]}):null,Ke?/* @__PURE__ */ f(`div`,{className:`file-input wui-file-input-button-field${F}${q?` error`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,...I,children:[/* @__PURE__ */ f(`label`,{htmlFor:H,className:qe,children:[/* @__PURE__ */ d(o,{name:`paperclip`,size:16}),Ce]}),$,Q]}):Je?/* @__PURE__ */ f(`div`,{className:`file-preview${F}${q?` error`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,...I,children:[/* @__PURE__ */ f(`button`,{type:`button`,className:`file-preview-open`,"aria-label":Ze,onClick:lt,disabled:U||O,children:[Y?/* @__PURE__ */ d(`img`,{src:Y,alt:$e,className:`file-preview-img`,width:z?.src===Y?z.width:void 0,height:z?.src===Y?z.height:void 0,onLoad:e=>{let t=e.currentTarget;ze({src:Y,width:t.naturalWidth,height:t.naturalHeight})}}):/* @__PURE__ */ f(`span`,{className:`file-preview-file`,children:[/* @__PURE__ */ d(o,{name:`file-text`,size:28}),/* @__PURE__ */ d(`span`,{className:`file-preview-file-name`,children:Ye})]}),/* @__PURE__ */ d(`span`,{className:`file-preview-overlay`,children:/* @__PURE__ */ f(`span`,{className:`file-preview-cta`,children:[/* @__PURE__ */ d(o,{name:J?`image`:`file-text`,size:16}),` `,J?Oe:ke]})})]}),ce(/* @__PURE__ */ d(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":Qe,onClick:()=>tt(null),disabled:U||O,children:/* @__PURE__ */ d(o,{name:`x`,size:16})}),Qe),$,Q]}):/* @__PURE__ */ f(`div`,{className:`file-input file-input-tall${F}${it?` dragging`:``}${q?` error`:``}${y&&K.length>0?` has-files`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,"aria-disabled":A||void 0,...I,...at,children:[/* @__PURE__ */ f(`label`,{htmlFor:H,className:`file-input-zone-label`,children:[/* @__PURE__ */ d(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ d(o,{name:`upload`,size:24})}),/* @__PURE__ */ f(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ d(`span`,{className:`browse`,children:we}),` ${Te}`]}),/* @__PURE__ */ d(`span`,{className:`file-input-text`,children:C>0?`${s(S)}, ${p(Ee,{size:C})}`:s(S)})]}),$,Q,y&&K.length>0&&/* @__PURE__ */ d(`div`,{className:`attach-list`,children:K.map((e,t)=>/* @__PURE__ */ d(n,{item:e,isImage:e instanceof File?c(e):Ge||c(m(e)),noun:g.fileLabel,removeFileLabel:je,readOnly:O,onRemove:()=>ct(t)},i(e)))})]}),/* @__PURE__ */ d(t,{error:q,hint:T,errorId:He,hintId:Ue})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{groupIndianText as e}from"../lib/indianGrouping.js";import t from"../lib/useElementEntry.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import te from"./AppSelect.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{INLINE_EDIT_TYPES as o,inlineEditText as s}from"@webority/ui-elements/helpers";import{useEffect as c,useId as l,useRef as u,useState as d}from"react";import{flushSync as ne}from"react-dom";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{INLINE_EDIT_TEXT as re,fillText as ie}from"@webority/ui-elements/text";var m=()=>import(`@webority/ui-elements/elements/datepicker`),h=()=>import(`@webority/ui-elements/elements/inline-edit`),ae=[`none`,`indian`],g=e=>e==null?``:String(e),_=(e,t)=>t===`number`?e===``?null:Number(e):e;function v(v){let y=t(`wui-inline-edit`,h);t(`wui-datepicker`,m);let{marker:b,props:x}=n(`AppInlineEdit`,v),S=ee(`inlineEdit`,re),{value:C,onSave:w,type:T,options:E=[],label:D,placeholder:O,validate:k,renderValue:A,grouping:j=`none`,wrap:M=!0,disabled:N=!1,className:P=``,id:F,...I}=x;a(`AppInlineEdit`,I),i(`AppInlineEdit`,`type`,T,o),i(`AppInlineEdit`,`grouping`,j,ae);let L=T??`text`,R=l(),z=F||`inline-edit-${R.replace(/[^a-zA-Z0-9_-]/g,``)}`,B=`${z}-error`,V=`${z}-control`,H=u(null),U=g(C),[W,G]=d(U),[K,q]=d(U);W!==U&&(G(U),q(U));let[oe,J]=d(null),Y=u({onSave:w,validate:k,kind:L});Y.current={onSave:w,validate:k,kind:L},c(()=>{let e=H.current;if(e&&y)return e.save=async e=>{J(e);let t=!1;try{await Y.current.onSave?.(_(e,Y.current.kind)),t=!0}finally{ne(()=>{t&&q(e),J(null)})}},e.validate=e=>Y.current.validate?.(_(e,Y.current.kind))||null,()=>{e.save=void 0,e.validate=void 0}},[y]);let X=oe??K,Z=s(X,{type:L,options:E,...O===void 0?null:{placeholder:O}}),se=L===`number`&&j===`indian`?e(Z.text):Z.text,ce=A&&!Z.empty?A(_(X,L)):se,Q={id:V,"data-wui-control":``,"aria-label":D},$;if(L===`select`){let e=E.map(e=>({value:String(e.value),label:g(e.label??e.value)}));$=/* @__PURE__ */ f(te,{id:V,"data-wui-control":``,"aria-label":D,size:`sm`,placeholder:O||void 0,options:e})}else $=L===`date`?/* @__PURE__ */ f(`wui-datepicker`,{...Q,size:`sm`,"aria-describedby":B,placeholder:O||void 0}):L===`textarea`?/* @__PURE__ */ f(`textarea`,{...Q,className:`form-control
|
|
1
|
+
import{groupIndianText as e}from"../lib/indianGrouping.js";import t from"../lib/useElementEntry.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import te from"./AppSelect.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{INLINE_EDIT_TYPES as o,inlineEditText as s}from"@webority/ui-elements/helpers";import{useEffect as c,useId as l,useRef as u,useState as d}from"react";import{flushSync as ne}from"react-dom";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{INLINE_EDIT_TEXT as re,fillText as ie}from"@webority/ui-elements/text";var m=()=>import(`@webority/ui-elements/elements/datepicker`),h=()=>import(`@webority/ui-elements/elements/inline-edit`),ae=[`none`,`indian`],g=e=>e==null?``:String(e),_=(e,t)=>t===`number`?e===``?null:Number(e):e;function v(v){let y=t(`wui-inline-edit`,h);t(`wui-datepicker`,m);let{marker:b,props:x}=n(`AppInlineEdit`,v),S=ee(`inlineEdit`,re),{value:C,onSave:w,type:T,options:E=[],label:D,placeholder:O,validate:k,renderValue:A,grouping:j=`none`,wrap:M=!0,disabled:N=!1,className:P=``,id:F,...I}=x;a(`AppInlineEdit`,I),i(`AppInlineEdit`,`type`,T,o),i(`AppInlineEdit`,`grouping`,j,ae);let L=T??`text`,R=l(),z=F||`inline-edit-${R.replace(/[^a-zA-Z0-9_-]/g,``)}`,B=`${z}-error`,V=`${z}-control`,H=u(null),U=g(C),[W,G]=d(U),[K,q]=d(U);W!==U&&(G(U),q(U));let[oe,J]=d(null),Y=u({onSave:w,validate:k,kind:L});Y.current={onSave:w,validate:k,kind:L},c(()=>{let e=H.current;if(e&&y)return e.save=async e=>{J(e);let t=!1;try{await Y.current.onSave?.(_(e,Y.current.kind)),t=!0}finally{ne(()=>{t&&q(e),J(null)})}},e.validate=e=>Y.current.validate?.(_(e,Y.current.kind))||null,()=>{e.save=void 0,e.validate=void 0}},[y]);let X=oe??K,Z=s(X,{type:L,options:E,...O===void 0?null:{placeholder:O}}),se=L===`number`&&j===`indian`?e(Z.text):Z.text,ce=A&&!Z.empty?A(_(X,L)):se,Q={id:V,"data-wui-control":``,"aria-label":D},$;if(L===`select`){let e=E.map(e=>({value:String(e.value),label:g(e.label??e.value)}));$=/* @__PURE__ */ f(te,{id:V,"data-wui-control":``,"aria-label":D,size:`sm`,placeholder:O||void 0,options:e})}else $=L===`date`?/* @__PURE__ */ f(`wui-datepicker`,{...Q,size:`sm`,"aria-describedby":B,placeholder:O||void 0}):L===`textarea`?/* @__PURE__ */ f(`textarea`,{...Q,className:`form-control`,rows:3,"aria-describedby":B,placeholder:O||void 0}):/* @__PURE__ */ f(`input`,{...Q,type:L===`number`?`number`:`text`,inputMode:L===`number`?`decimal`:void 0,className:`form-control input wui-input-sm`,"aria-describedby":B,placeholder:O||void 0});let le=[`wui-inline-edit`,M===!1?`wui-inline-edit--nowrap`:``,P].filter(Boolean).join(` `);return/* @__PURE__ */ p(`wui-inline-edit`,{ref:H,id:z,class:le,type:L,label:D,value:K,placeholder:O||void 0,disabled:N?``:void 0,controlled:``,...b,...I,children:[/* @__PURE__ */ p(`button`,{type:`button`,className:`wui-inline-edit-display`,"data-wui-display":``,"aria-describedby":B,disabled:N,children:[/* @__PURE__ */ f(`span`,{className:`visually-hidden`,children:ie(N?S.readOnlyText:S.editText,{label:D})}),/* @__PURE__ */ f(`span`,{className:`wui-inline-edit-value`,"data-wui-value":``,"data-wui-empty":Z.empty?``:void 0,children:ce}),/* @__PURE__ */ f(`span`,{className:`wui-inline-edit-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ f(r,{name:`edit`,size:14})})]}),/* @__PURE__ */ f(`span`,{className:`wui-inline-edit-editor`,"data-wui-editor":``,hidden:!0,children:$}),/* @__PURE__ */ p(`span`,{className:`wui-inline-edit-status`,"aria-hidden":`true`,children:[/* @__PURE__ */ f(`span`,{className:`wui-inline-edit-spinner spinner-border spinner-border-sm`}),/* @__PURE__ */ f(`span`,{className:`wui-inline-edit-saved`,children:/* @__PURE__ */ f(r,{name:`tick-circle`,size:16})})]}),/* @__PURE__ */ f(`span`,{className:`wui-inline-edit-error`,id:B,"data-wui-error":``,hidden:!0}),/* @__PURE__ */ f(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{cloneElement as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=[`high`,`low`],c=[`sm`,`md`],l=e.filter(e=>e!==`primary`);function u(e,t,n){let r=n-t;if(!(r>0))return 0;let i=Math.min(100,Math.max(0,(e-t)/r*100));return Number(i.toFixed(2))}function d(e,t,n,r,i){if(t==null&&n==null)return i;let a=`mid`;return t!=null&&e<=t?a=`low`:n!=null&&e>=n&&(a=`high`),r===`low`?a===`low`?`success`:a===`high`?`danger`:`warning`:a===`high`?`success`:a===`low`?`danger`:`warning`}function f(e){let{marker:f,props:p}=t(`AppMeter`,e),{value:m=0,min:h=0,max:g=100,tone:_=`info`,optimum:v=`high`,low:y,high:b,size:x=`md`,label:S,showLabel:C=!1,className:w=``,...T}=p;r(`AppMeter`,T),n(`AppMeter`,`tone`,_,l),n(`AppMeter`,`optimum`,v,s),n(`AppMeter`,`size`,x,c);let E=d(m,y,b,v,
|
|
1
|
+
import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{cloneElement as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=[`high`,`low`],c=[`sm`,`md`],l=e.filter(e=>e!==`primary`);function u(e,t,n){let r=n-t;if(!(r>0))return 0;let i=Math.min(100,Math.max(0,(e-t)/r*100));return Number(i.toFixed(2))}function d(e,t,n,r,i){if(t==null&&n==null)return i;let a=`mid`;return t!=null&&e<=t?a=`low`:n!=null&&e>=n&&(a=`high`),r===`low`?a===`low`?`success`:a===`high`?`danger`:`warning`:a===`high`?`success`:a===`low`?`danger`:`warning`}function f(e){let{marker:f,props:p}=t(`AppMeter`,e),{value:m=0,min:h=0,max:g=100,tone:_=`info`,optimum:v=`high`,low:y,high:b,size:x=`md`,label:S,showLabel:C=!1,className:w=``,...T}=p;r(`AppMeter`,T),n(`AppMeter`,`tone`,_,l),n(`AppMeter`,`optimum`,v,s),n(`AppMeter`,`size`,x,c);let E=d(m,y,b,v,_),D=u(m,h,g),O=C&&!!S,k=`progress${x===`sm`?` progress-sm`:``}${!O&&w?` ${w}`:``}`,A=/* @__PURE__ */ a(`div`,{className:k,role:`meter`,"aria-valuenow":m,"aria-valuemin":h,"aria-valuemax":g,"aria-label":S||void 0,...T,children:/* @__PURE__ */ a(`div`,{className:`progress-bar wui-progress-${E}`,style:{width:`${D}%`}})});return O?/* @__PURE__ */ o(`div`,{...f,className:`wui-progress-labelled${w?` ${w}`:``}`,children:[/* @__PURE__ */ a(`div`,{className:`wui-progress-label`,"aria-hidden":`true`,children:S}),A]}):i(A,f)}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{IST_TIME_ZONE as y,initScrollEdges as b,isImeSafeEnter as x,revealActiveNavItem as S,setPopoverOpen as C}from"@webority/ui-elements/helpers";import{useEffect as w,useId as T,useMemo as E,useRef as D,useState as O}from"react";import{Fragment as k,jsx as A,jsxs as j}from"react/jsx-runtime";import{SHELL_TEXT as ee,fillText as M}from"@webority/ui-elements/text";var N=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,B=[],V=[`prefix`,`exact`],H=[`comfortable`,`compact`],U=[`neutral`,`primary`],te=[`default`,`brand`],ne=[`side`,`top`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ie=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`,`header`,`description`]),W=e=>e>F?`${F}+`:String(e),ae=new Intl.DateTimeFormat(`en-CA`,{timeZone:y}),oe=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:ae.format(/* @__PURE__ */ new Date)<=e},se=({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(` `)},ce=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i,logoLightWidth:a,logoLightHeight:o,logoDarkWidth:s,logoDarkHeight:c,markLightWidth:l,markLightHeight:u,markDarkWidth:d,markDarkHeight:f})=>{let p=i??``,m=[e&&/* @__PURE__ */ A(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:p,width:a,height:o},`logo-light`),t&&/* @__PURE__ */ A(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`,width:s,height:c},`logo-dark`)],h=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n,l,u],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r,d,f]].filter(e=>!!e).map(([t,n,r,i,a],o)=>o===0&&!e?/* @__PURE__ */ A(`img`,{className:n,src:r,alt:p,width:i,height:a},t):/* @__PURE__ */ A(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`,width:i,height:a},t));return[...m,...h].filter(Boolean)};function le(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,ee),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:y,markDark:x,logoLightWidth:T,logoLightHeight:M,logoDarkWidth:N,logoDarkHeight:P,markLightWidth:F,markLightHeight:I,markDarkWidth:L,markDarkHeight:R,brandName:z,brandHref:V,brandLabel:ie,sidebarStart:W,sidebarStartCompact:ae,sidebarFooter:oe,sidebarFooterItems:le=B,topbarStart:de,topbarEnd:G,footer:fe,launcher:K,children:pe,collapsed:q,onCollapsedChange:ye,noSidebar:Y=!1,nav:Ce=`side`,topNavDetail:we=!1,capBadges:Te=!1,density:Ee=`comfortable`,itemHeight:De,iconVariant:Oe=`twotone`,topbarTone:ke=`neutral`,tone:Ae=`default`,navLabel:je=c.navLabel,linkComponent:X,currentPath:Me,rememberCollapsed:Ne=!1,collapsedCookie:Pe=`wui-shell-collapsed`,foldedCookie:Fe=r,tabBarLabel:Ie=c.tabBarLabel,moreLabel:Le=c.moreLabel,skipLabel:Re=c.skipLabel,openNavLabel:ze=c.openNavLabel,expandNavLabel:Be=c.expandNavLabel,collapseNavLabel:Ve=c.collapseNavLabel,newLabel:He=c.newLabel,togglePagesLabel:Ue=c.togglePagesLabel,accountMenuLabel:We=c.accountMenuLabel,roleLabel:Ge=c.roleLabel,rolesLabel:Ke=c.rolesLabel,unreadLabel:qe=c.unreadLabel,markAllReadLabel:Je=c.markAllReadLabel,viewAllLabel:Ye=c.viewAllLabel,loadingNotificationsText:Xe=c.loadingNotificationsText,noUnreadText:Ze=c.noUnreadText,unreadNotificationsText:Qe=c.unreadNotificationsText,unreadBellLabel:$e=c.unreadBellLabel,searchResultsLabel:et=c.searchResultsLabel,noResultsText:tt=c.noResultsText,noResultsForText:nt=c.noResultsForText,resultsCountText:rt=c.resultsCountText,resultCountText:it=c.resultCountText,userMenu:at,notifications:ot,search:st,className:ct=``,style:lt,...ut}=n;if(v(`AppShell`,ut),_(`AppShell`,`density`,Ee,H),_(`AppShell`,`topbarTone`,ke,U),_(`AppShell`,`tone`,Ae,te),_(`AppShell`,`nav`,Ce,ne),_(`AppShell`,`iconVariant`,Oe,re),ie!==void 0&&!V)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(V){if(!ie&&!z)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||y||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let dt=(De??0)>0?{...lt,"--wui-nav-item-height":`${De}px`}:lt,[ft,pt]=O(()=>Ne&&q===void 0&&typeof document<`u`?a(Pe)??!1:!1),[Z,Q]=O(!1),mt=D(null),[ht,gt]=O(!1),[_t,vt]=O(!1),yt=D(null),bt=q??ft,xt=e=>V?/* @__PURE__ */ A(ge,{href:V,label:ie||z,linkComponent:X,onNavigate:()=>Q(!1),children:e}):e,St=()=>{let e=!bt;q===void 0&&pt(e),Ne&&s(e,Pe),ye?.(e)},Ct=l.some(e=>e.collapsible),[wt,Tt]=O(()=>Ct&&typeof document<`u`?i(Fe):/* @__PURE__ */ new Set),Et=e=>{let t=new Set(wt);t.has(e)?t.delete(e):t.add(e),Tt(t),o(t,Fe)},Dt=E(()=>ue(l,le,Me),[l,le,Me]),$=Dt.groups,Ot=Dt.footer,kt=Y?null:me($,Ot.some(e=>e.active));w(()=>{let e=()=>gt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),w(()=>{b()},[]),w(()=>{S(yt.current)},[]),w(()=>{let e=yt.current;if(!e)return;let t=()=>vt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),w(()=>{let e=mt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),w(()=>{let e=mt.current;e?.hasAttribute(`popover`)&&C(e,Z)},[Z]);let At=[`app-shell`,bt?`collapsed`:``,Y?`no-sidebar`:``,Ce===`top`?`wui-shell-top`:``,Z?`mobile-open`:``,ct].filter(Boolean).join(` `);return/* @__PURE__ */ j(`div`,{className:At,"data-density":Ee===`compact`?`compact`:void 0,"data-shell-tone":Ae===`brand`?`brand`:void 0,"data-wui-folded-cookie":Ct?Fe:void 0,style:dt,...t,...ut,children:[/* @__PURE__ */ A(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Re}),/* @__PURE__ */ j(`aside`,{className:`app-sidebar`,ref:mt,children:[(d||p||m||y||x)&&/* @__PURE__ */ A(`div`,{className:se({logoLight:p,logoDark:m,markLight:y,markDark:x}),children:xt(/* @__PURE__ */ j(k,{children:[ce({logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:z,logoLightWidth:T,logoLightHeight:M,logoDarkWidth:N,logoDarkHeight:P,markLightWidth:F,markLightHeight:I,markDarkWidth:L,markDarkHeight:R}),d]}))}),W&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start`,children:W}),ae&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-start-compact`,children:ae}),/* @__PURE__ */ A(`nav`,{className:`app-sidebar-scroll`,"aria-label":je,ref:yt,tabIndex:_t?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ A(ve,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label):/* @__PURE__ */ A(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ j(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!wt.has(e.key??``)||!!J(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ j(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>Et(e.key??``),children:[/* @__PURE__ */ A(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ A(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ j(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ A(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(oe||Ot.length>0)&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-foot`,children:[Ot.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-sidebar-foot-links`,children:Ot.map(e=>/* @__PURE__ */ A(ve,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label))}),oe]}),!Y&&/* @__PURE__ */ A(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:St,"aria-label":bt?Be:Ve,"aria-expanded":!bt,children:/* @__PURE__ */ A(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ j(`div`,{className:`app-main`,children:[/* @__PURE__ */ j(`header`,{className:`app-topbar${ht?` wui-scrolled`:``}`,"data-tone":ke===`primary`?`primary`:void 0,children:[/* @__PURE__ */ j(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":ze,"aria-expanded":Z,children:/* @__PURE__ */ A(h,{name:`menu`,size:18})}),Ce===`top`&&d&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-brand`,children:xt(d)}),Ce===`top`&&/* @__PURE__ */ A(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ A(g,{items:he($,we),ariaLabel:je,linkComponent:X})}),de,st&&/* @__PURE__ */ A(Se,{config:st,searchResultsLabel:et,noResultsText:tt,noResultsForText:nt,resultsCountText:rt,resultCountText:it,moreLabel:Le})]}),/* @__PURE__ */ j(`div`,{className:`app-topbar-end`,children:[G,ot&&/* @__PURE__ */ A(xe,{config:ot,unreadLabel:qe,markAllReadLabel:Je,viewAllLabel:Ye,loadingNotificationsText:Xe,noUnreadText:Ze,unreadNotificationsText:Qe,unreadBellLabel:$e}),at&&/* @__PURE__ */ A(be,{config:at,linkComponent:X,accountMenuLabel:We,roleLabel:Ge,rolesLabel:Ke})]})]}),/* @__PURE__ */ A(`main`,{className:`app-content`,id:`main-content`,children:pe}),fe&&/* @__PURE__ */ A(`footer`,{className:`app-footer`,children:fe})]}),K&&/* @__PURE__ */ A(`div`,{className:`wui-shell-launcher`,children:K}),kt&&/* @__PURE__ */ j(`nav`,{className:`wui-tabbar`,"aria-label":Ie,children:[kt.tabs.map(e=>/* @__PURE__ */ A(_e,{tab:e,linkComponent:X,iconVariant:Oe,capBadges:Te},e.key??e.href)),kt.hasMore&&/* @__PURE__ */ j(`button`,{type:`button`,className:`wui-tabbar-item${kt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ A(h,{name:`more`,size:24})}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:Le})]})]})]})}function ue(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&pe(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>G(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:z,items:t}].map(e=>({...e,items:fe(a(e.items,!0))})).filter(e=>e.items.some(e=>!G(e))),s=[],c=e=>{for(let t of e)G(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,de(e)),_(`AppShell`,`match`,e.match,V),_(`AppShell`,`iconVariant`,e.iconVariant,re),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==z),footer:o.find(e=>e.key===z)?.items??[]}}function de(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ie.has(e)))}var G=e=>e.header!=null;function fe(e){return e.filter((t,n)=>{if(!G(t))return!0;let r=e.findIndex((e,t)=>t>n&&G(e));return e.slice(n+1,r<0?void 0:r).length>0})}var K=/* @__PURE__ */ new Set;function pe(t){if(t.key!=null&&R.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||K.has(n)||(K.add(n),e(n))}function me(e,t){let n=[],r=e=>{for(let t of e)G(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?I:L;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function he(e,t){let n=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},r=e=>e.key??e.href??n(e),i=(e,i)=>({key:r(e),label:n(e),to:i,current:!!e.active,...t&&e.description?{description:e.description}:{}}),a=e=>e.flatMap(e=>G(e)?[]:[...e.href?[{...i(e,e.href),icon:e.icon}]:[],...a(e.children??[])]),o=[];for(let s of e)for(let e of s.items){if(G(e))continue;let c=t&&s.label?{group:s.label}:{},l=a(e.children??[]);if(l.length>0){let a=e.href?[{...i(e,e.href),icon:e.icon}]:[],s=t&&(!!e.active||!!J(e.children??[]));o.push({key:r(e),label:n(e),links:[...a,...l],...c,...t?{current:s}:{}})}else e.href&&o.push({...i(e,e.href),...c})}return o}function q(e,t){return t&&typeof e==`number`&&e>F?`${F}+`:e}function ge({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ A(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function _e({tab:e,linkComponent:n,iconVariant:r,capBadges:i}){let a=`wui-tabbar-item${e.active?` active`:``}`,o=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ A(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:q(e.badge,i)})]}),s=e.active?`page`:void 0;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:a,"aria-current":s,children:o})}function J(e){for(let t of e){if(t.active)return t;let e=t.children?.length?J(t.children):void 0;if(e)return e}}function ve({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l}){let u=i>0,d=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?J(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=O(m);w(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ A(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ A(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ A(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:q(e.badge,l)}),S=oe(e.newUntil)&&/* @__PURE__ */ A(`span`,{className:`wui-nav-new`,children:o}),C=/* @__PURE__ */ j(k,{children:[b,/* @__PURE__ */ A(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ A(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ A(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ A(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ A(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ A(ve,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:r,children:C});return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[i,/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":M(s,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ A(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ A(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ A(h,{name:`chevron-right`,size:16})})]}),f]})}let E=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ A(c,{link:t(n,{to:e.href}),className:E,"aria-current":T,"data-label":y,onClick:r,children:C})}function ye(e){l(`wui-dropdown`,P);let[t,n]=O(!1),r=D(null);return w(()=>{r.current?.toggleAttribute(`open`,t)},[t]),w(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function be({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,ee),s=T(),{open:l,setOpen:d,ref:f}=ye(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:w=o.profileLabel,onLogout:E,logoutAction:D,logoutLabel:O=o.logoutLabel,head:N,section:P,logoutVariant:F=`item`,items:I=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,F,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let L=y.map(e=>(e??``).trim()).filter(Boolean),R=()=>d(!1),z=(e,r,i,a)=>/* @__PURE__ */ A(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),B=/* @__PURE__ */ A(h,{name:`log-out`,size:18}),V=/* @__PURE__ */ j(k,{children:[B,O]});return/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":M(r,{name:g}),children:[/* @__PURE__ */ A(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ j(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ A(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ A(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ j(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ A(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ j(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-role`,children:v}),L.length>0&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ A(`span`,{className:`wui-usermenu-roles-label`,children:L.length===1?i:a}),` ${L.join(`, `)}`]}),N?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-extra`,children:N}):null]})]}),P?/* @__PURE__ */ A(`div`,{className:`wui-usermenu-section`,children:P}):null,C&&z(C,/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(h,{name:`user`,size:18}),w]}),void 0,R),I.map(e=>{if(e.divider)return/* @__PURE__ */ A(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ j(k,{children:[e.icon&&/* @__PURE__ */ A(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),R()};return e.href?z(e.href,t,e.key,n):/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),F===`button`?(D||E)&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:B,children:O})}):/* @__PURE__ */ A(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:B,onClick:()=>{R(),E?.()},children:O})}):D?/* @__PURE__ */ A(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ A(`button`,{type:`submit`,className:`dropdown-item danger`,children:V})}):E&&/* @__PURE__ */ A(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{R(),E()},children:V})]})]})}function xe({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,ee),l=T(),{open:d,ref:f}=ye(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=O(``),C=D(p);w(()=>{C.current!==p&&(C.current=p,S(p===0?a:M(o,{count:W(p)})))},[p,a,o]);let E=null;return m?.length?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ j(k,{children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ j(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ A(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ A(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ A(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ A(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:i}):m&&(E=/* @__PURE__ */ A(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ j(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ j(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:M(s,{label:y,count:W(p)}),children:[/* @__PURE__ */ A(h,{name:`notification`,size:20}),/* @__PURE__ */ A(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:W(p)})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ j(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ j(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ A(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ A(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:E}),v&&/* @__PURE__ */ A(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var Y=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function Se({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,N);let s=u(`shell`,ee),c=T(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder}=e,[b,S]=O(!1),[C,k]=O(!1),[P,F]=O({results:null,index:-1}),I=P.results===p?P.index:-1,L=e=>F({results:p,index:e}),R=D(null),z=D(null),B=D([]),V=E(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),H=p!=null&&!C,U=V.length;w(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||Y(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),S(!0),z.current?.focus())},t=e=>{R.current?.contains(e.target instanceof Node?e.target:null)||(k(!0),S(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let te=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!H||U===0)return;e.preventDefault(),L((I+(e.key===`ArrowDown`?1:-1)+U)%U)}else x(e.nativeEvent)?H&&I>=0&&B.current[I]?(e.preventDefault(),B.current[I].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(H?(e.preventDefault(),k(!0)):b&&(e.preventDefault(),S(!1)))},ne=-1;return B.current=[],/* @__PURE__ */ A(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ A(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ j(`div`,{className:`wui-topsearch${b?` is-open`:``}${m?` is-loading`:``}`,ref:R,"data-overflow-label":y,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":b,"aria-controls":`${c}-panel`,onClick:()=>{let e=!b;S(e),e&&z.current?.focus()},children:/* @__PURE__ */ A(h,{name:`search`,size:20})}),/* @__PURE__ */ j(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ j(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ A(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ A(`input`,{ref:z,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y,"aria-label":y,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":H,"aria-controls":`${c}-list`,"aria-activedescendant":H&&I>=0?`${c}-opt-${I}`:void 0,autoComplete:`off`,value:d,onChange:e=>{k(!1),f?.(e.target.value)},onKeyDown:te,onFocus:v})]}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!H,children:H&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[U===0&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:M(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ j(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{ne+=1;let t=ne;return/* @__PURE__ */ j(`a`,{className:`wui-topsearch-hit${t===I?` is-active`:``}`,role:`option`,"aria-selected":t===I,id:`${c}-opt-${t}`,href:e.href,ref:e=>{B.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ A(h,{name:e.icon,size:18})}),/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ A(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:H?U===0?n:M(U===1?a:i,{count:U}):``})]})})})}export{le as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{IST_TIME_ZONE as y,initScrollEdges as b,isApplePlatform as x,isCommandChord as S,isImeSafeEnter as C,revealActiveNavItem as w,setPopoverOpen as T}from"@webority/ui-elements/helpers";import{useEffect as E,useId as ee,useMemo as D,useRef as O,useState as k}from"react";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import{SHELL_TEXT as te,fillText as N}from"@webority/ui-elements/text";var ne=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,re=[],B=[`prefix`,`exact`],V=[`comfortable`,`compact`],H=[`neutral`,`primary`],ie=[`default`,`brand`],U=[`side`,`top`],W=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ae=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`,`header`,`description`]),G=e=>e>F?`${F}+`:String(e),oe=new Intl.DateTimeFormat(`en-CA`,{timeZone:y}),se=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:oe.format(/* @__PURE__ */ new Date)<=e},ce=({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(` `)},le=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i,logoLightWidth:a,logoLightHeight:o,logoDarkWidth:s,logoDarkHeight:c,markLightWidth:l,markLightHeight:u,markDarkWidth:d,markDarkHeight:f})=>{let p=i??``,m=[e&&/* @__PURE__ */ j(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:p,width:a,height:o},`logo-light`),t&&/* @__PURE__ */ j(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`,width:s,height:c},`logo-dark`)],h=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n,l,u],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r,d,f]].filter(e=>!!e).map(([t,n,r,i,a],o)=>o===0&&!e?/* @__PURE__ */ j(`img`,{className:n,src:r,alt:p,width:i,height:a},t):/* @__PURE__ */ j(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`,width:i,height:a},t));return[...m,...h].filter(Boolean)};function ue(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,te),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:y,markDark:x,logoLightWidth:S,logoLightHeight:C,logoDarkWidth:ee,logoDarkHeight:N,markLightWidth:ne,markLightHeight:P,markDarkWidth:F,markDarkHeight:I,brandName:L,brandHref:R,brandLabel:z,sidebarStart:B,sidebarStartCompact:ae,sidebarFooter:G,sidebarFooterItems:oe=re,topbarStart:se,topbarEnd:ue,footer:fe,launcher:K,children:pe,collapsed:q,onCollapsedChange:me,noSidebar:J=!1,nav:Y=`side`,topNavDetail:Ce=!1,capBadges:Te=!1,density:Ee=`comfortable`,itemHeight:De,iconVariant:Oe=`twotone`,topbarTone:ke=`neutral`,tone:Ae=`default`,navLabel:je=c.navLabel,linkComponent:X,currentPath:Me,rememberCollapsed:Ne=!1,collapsedCookie:Pe=`wui-shell-collapsed`,foldedCookie:Fe=r,tabBarLabel:Ie=c.tabBarLabel,moreLabel:Le=c.moreLabel,skipLabel:Re=c.skipLabel,openNavLabel:ze=c.openNavLabel,expandNavLabel:Be=c.expandNavLabel,collapseNavLabel:Ve=c.collapseNavLabel,newLabel:He=c.newLabel,togglePagesLabel:Ue=c.togglePagesLabel,accountMenuLabel:We=c.accountMenuLabel,roleLabel:Ge=c.roleLabel,rolesLabel:Ke=c.rolesLabel,unreadLabel:qe=c.unreadLabel,markAllReadLabel:Je=c.markAllReadLabel,viewAllLabel:Ye=c.viewAllLabel,loadingNotificationsText:Xe=c.loadingNotificationsText,noUnreadText:Ze=c.noUnreadText,unreadNotificationsText:Qe=c.unreadNotificationsText,unreadBellLabel:$e=c.unreadBellLabel,searchResultsLabel:et=c.searchResultsLabel,noResultsText:tt=c.noResultsText,noResultsForText:nt=c.noResultsForText,resultsCountText:rt=c.resultsCountText,resultCountText:it=c.resultCountText,userMenu:at,notifications:ot,search:st,className:ct=``,style:lt,...ut}=n;if(v(`AppShell`,ut),_(`AppShell`,`density`,Ee,V),_(`AppShell`,`topbarTone`,ke,H),_(`AppShell`,`tone`,Ae,ie),_(`AppShell`,`nav`,Y,U),_(`AppShell`,`iconVariant`,Oe,W),z!==void 0&&!R)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(R){if(!z&&!L)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||y||x))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let dt=(De??0)>0?{...lt,"--wui-nav-item-height":`${De}px`}:lt,[ft,pt]=k(()=>Ne&&q===void 0&&typeof document<`u`?a(Pe)??!1:!1),[Z,Q]=k(!1),mt=O(null),[ht,gt]=k(!1),[_t,vt]=k(!1),yt=O(null),bt=q??ft,xt=e=>R?/* @__PURE__ */ j(_e,{href:R,label:z||L,linkComponent:X,onNavigate:()=>Q(!1),children:e}):e,St=()=>{let e=!bt;q===void 0&&pt(e),Ne&&s(e,Pe),me?.(e)},Ct=l.some(e=>e.collapsible),[wt,Tt]=k(()=>Ct&&typeof document<`u`?i(Fe):/* @__PURE__ */ new Set),Et=e=>{let t=new Set(wt);t.has(e)?t.delete(e):t.add(e),Tt(t),o(t,Fe)},Dt=D(()=>de(l,oe,Me),[l,oe,Me]),$=Dt.groups,Ot=Dt.footer,kt=J?null:he($,Ot.some(e=>e.active));E(()=>{let e=()=>gt(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),E(()=>{b()},[]),E(()=>{w(yt.current)},[]),E(()=>{let e=yt.current;if(!e)return;let t=()=>vt($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),E(()=>{let e=mt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),E(()=>{let e=mt.current;e?.hasAttribute(`popover`)&&T(e,Z)},[Z]);let At=[`app-shell`,bt?`collapsed`:``,J?`no-sidebar`:``,Y===`top`?`wui-shell-top`:``,Z?`mobile-open`:``,ct].filter(Boolean).join(` `);return/* @__PURE__ */ M(`div`,{className:At,"data-density":Ee===`compact`?`compact`:void 0,"data-shell-tone":Ae===`brand`?`brand`:void 0,"data-wui-folded-cookie":Ct?Fe:void 0,style:dt,...t,...ut,children:[/* @__PURE__ */ j(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Re}),/* @__PURE__ */ M(`aside`,{className:`app-sidebar`,ref:mt,children:[(d||p||m||y||x)&&/* @__PURE__ */ j(`div`,{className:ce({logoLight:p,logoDark:m,markLight:y,markDark:x}),children:xt(/* @__PURE__ */ M(A,{children:[le({logoLight:p,logoDark:m,markLight:y,markDark:x,brandName:L,logoLightWidth:S,logoLightHeight:C,logoDarkWidth:ee,logoDarkHeight:N,markLightWidth:ne,markLightHeight:P,markDarkWidth:F,markDarkHeight:I}),d]}))}),B&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-start`,children:B}),ae&&/* @__PURE__ */ j(`div`,{className:`app-sidebar-start-compact`,children:ae}),/* @__PURE__ */ j(`nav`,{className:`app-sidebar-scroll`,"aria-label":je,ref:yt,tabIndex:_t?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ j(be,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label):/* @__PURE__ */ j(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ M(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ j(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ j(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!wt.has(e.key??``)||!!ye(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ M(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ M(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>Et(e.key??``),children:[/* @__PURE__ */ j(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ j(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ j(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ M(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ j(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(G||Ot.length>0)&&/* @__PURE__ */ M(`div`,{className:`app-sidebar-foot`,children:[Ot.length>0&&/* @__PURE__ */ j(`div`,{className:`wui-sidebar-foot-links`,children:Ot.map(e=>/* @__PURE__ */ j(be,{item:e,linkComponent:X,onNavigate:()=>Q(!1),iconVariant:Oe,newLabel:He,togglePagesLabel:Ue,capBadges:Te},e.key??e.href??e.label))}),G]}),!J&&/* @__PURE__ */ j(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:St,"aria-label":bt?Be:Ve,"aria-expanded":!bt,children:/* @__PURE__ */ j(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ M(`div`,{className:`app-main`,children:[/* @__PURE__ */ M(`header`,{className:`app-topbar${ht?` wui-scrolled`:``}`,"data-tone":ke===`primary`?`primary`:void 0,children:[/* @__PURE__ */ M(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":ze,"aria-expanded":Z,children:/* @__PURE__ */ j(h,{name:`menu`,size:18})}),Y===`top`&&d&&/* @__PURE__ */ j(`div`,{className:`wui-shell-top-brand`,children:xt(d)}),Y===`top`&&/* @__PURE__ */ j(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ j(g,{items:ge($,Ce),ariaLabel:je,linkComponent:X})}),se,st&&/* @__PURE__ */ j(we,{config:st,searchResultsLabel:et,noResultsText:tt,noResultsForText:nt,resultsCountText:rt,resultCountText:it,moreLabel:Le})]}),/* @__PURE__ */ M(`div`,{className:`app-topbar-end`,children:[ue,ot&&/* @__PURE__ */ j(Se,{config:ot,unreadLabel:qe,markAllReadLabel:Je,viewAllLabel:Ye,loadingNotificationsText:Xe,noUnreadText:Ze,unreadNotificationsText:Qe,unreadBellLabel:$e}),at&&/* @__PURE__ */ j(xe,{config:at,linkComponent:X,accountMenuLabel:We,roleLabel:Ge,rolesLabel:Ke})]})]}),/* @__PURE__ */ j(`main`,{className:`app-content`,id:`main-content`,children:pe}),fe&&/* @__PURE__ */ j(`footer`,{className:`app-footer`,children:fe})]}),K&&/* @__PURE__ */ j(`div`,{className:`wui-shell-launcher`,children:K}),kt&&/* @__PURE__ */ M(`nav`,{className:`wui-tabbar`,"aria-label":Ie,"data-wui-cap-badges":Te||void 0,children:[kt.tabs.map(e=>/* @__PURE__ */ j(ve,{tab:e,linkComponent:X,iconVariant:Oe,capBadges:Te},e.key??e.href)),kt.hasMore&&/* @__PURE__ */ M(`button`,{type:`button`,className:`wui-tabbar-item${kt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ j(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ j(h,{name:`more`,size:24})}),/* @__PURE__ */ j(`span`,{className:`wui-tabbar-label`,children:Le})]})]})]})}function de(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&me(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>K(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:z,items:t}].map(e=>({...e,items:pe(a(e.items,!0))})).filter(e=>e.items.some(e=>!K(e))),s=[],c=e=>{for(let t of e)K(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,fe(e)),_(`AppShell`,`match`,e.match,B),_(`AppShell`,`iconVariant`,e.iconVariant,W),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==z),footer:o.find(e=>e.key===z)?.items??[]}}function fe(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!ae.has(e)))}var K=e=>e.header!=null;function pe(e){return e.filter((t,n)=>{if(!K(t))return!0;let r=e.findIndex((e,t)=>t>n&&K(e));return e.slice(n+1,r<0?void 0:r).length>0})}var q=/* @__PURE__ */ new Set;function me(t){if(t.key!=null&&R.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||q.has(n)||(q.add(n),e(n))}function he(e,t){let n=[],r=e=>{for(let t of e)K(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?I:L;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function ge(e,t){let n=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},r=e=>e.key??e.href??n(e),i=(e,i)=>({key:r(e),label:n(e),to:i,current:!!e.active,...t&&e.description?{description:e.description}:{}}),a=e=>e.flatMap(e=>K(e)?[]:[...e.href?[{...i(e,e.href),icon:e.icon}]:[],...a(e.children??[])]),o=[];for(let s of e)for(let e of s.items){if(K(e))continue;let c=t&&s.label?{group:s.label}:{},l=a(e.children??[]);if(l.length>0){let a=e.href?[{...i(e,e.href),icon:e.icon}]:[],s=t&&(!!e.active||!!ye(e.children??[]));o.push({key:r(e),label:n(e),links:[...a,...l],...c,...t?{current:s}:{}})}else e.href&&o.push({...i(e,e.href),...c})}return o}function J(e,t){return t&&typeof e==`number`&&e>F?`${F}+`:e}function _e({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ j(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function ve({tab:e,linkComponent:n,iconVariant:r,capBadges:i}){let a=`wui-tabbar-item${e.active?` active`:``}`,o=/* @__PURE__ */ M(A,{children:[e.icon&&/* @__PURE__ */ j(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ j(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ j(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ j(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:J(e.badge,i)}),e.badge!=null&&e.badgeTitle&&/* @__PURE__ */ j(`span`,{className:`visually-hidden`,children:e.badgeTitle})]}),s=e.active?`page`:void 0;return/* @__PURE__ */ j(c,{link:t(n,{to:e.href}),className:a,"aria-current":s,children:o})}function ye(e){for(let t of e){if(t.active)return t;let e=t.children?.length?ye(t.children):void 0;if(e)return e}}function be({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l}){let u=i>0,d=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?ye(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=k(m);E(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ j(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ j(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ j(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:J(e.badge,l)}),S=se(e.newUntil)&&/* @__PURE__ */ j(`span`,{className:`wui-nav-new`,children:o}),C=/* @__PURE__ */ M(A,{children:[b,/* @__PURE__ */ j(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ j(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ j(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ j(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ j(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ j(be,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s,capBadges:l},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ j(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":w,onClick:r,children:C});return/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ M(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[i,/* @__PURE__ */ j(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":N(s,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ j(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ M(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ j(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ j(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ j(h,{name:`chevron-right`,size:16})})]}),f]})}let T=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ j(c,{link:t(n,{to:e.href}),className:T,"aria-current":w,"data-label":y,onClick:r,children:C})}function Y(e){l(`wui-dropdown`,P);let[t,n]=k(!1),r=O(null);return E(()=>{r.current?.toggleAttribute(`open`,t)},[t]),E(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function xe({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,te),s=ee(),{open:l,setOpen:d,ref:f}=Y(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:w=o.profileLabel,onLogout:T,logoutAction:E,logoutLabel:D=o.logoutLabel,head:O,section:k,logoutVariant:ne=`item`,items:P=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,ne,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let F=y.map(e=>(e??``).trim()).filter(Boolean),I=()=>d(!1),L=(e,r,i,a)=>/* @__PURE__ */ j(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),R=/* @__PURE__ */ j(h,{name:`log-out`,size:18}),z=/* @__PURE__ */ M(A,{children:[R,D]});return/* @__PURE__ */ M(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ M(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":N(r,{name:g}),children:[/* @__PURE__ */ j(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ M(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ j(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ j(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ j(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ M(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ M(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ j(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ M(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ j(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-role`,children:v}),F.length>0&&/* @__PURE__ */ M(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ j(`span`,{className:`wui-usermenu-roles-label`,children:F.length===1?i:a}),` ${F.join(`, `)}`]}),O?/* @__PURE__ */ j(`div`,{className:`wui-usermenu-extra`,children:O}):null]})]}),k?/* @__PURE__ */ j(`div`,{className:`wui-usermenu-section`,children:k}):null,C&&L(C,/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ j(h,{name:`user`,size:18}),w]}),void 0,I),P.map(e=>{if(e.divider)return/* @__PURE__ */ j(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ M(A,{children:[e.icon&&/* @__PURE__ */ j(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),I()};return e.href?L(e.href,t,e.key,n):/* @__PURE__ */ j(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),ne===`button`?(E||T)&&/* @__PURE__ */ j(`div`,{className:`wui-usermenu-foot`,children:E?/* @__PURE__ */ j(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ M(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,children:[/* @__PURE__ */ j(`span`,{className:`d-inline-flex me-2`,children:R}),D]})}):/* @__PURE__ */ M(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,onClick:()=>{I(),T?.()},children:[/* @__PURE__ */ j(`span`,{className:`d-inline-flex me-2`,children:R}),D]})}):E?/* @__PURE__ */ j(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ j(`button`,{type:`submit`,className:`dropdown-item danger`,children:z})}):T&&/* @__PURE__ */ j(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{I(),T()},children:z})]})]})}function Se({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,te),l=ee(),{open:d,ref:f}=Y(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=k(``),C=O(p);E(()=>{C.current!==p&&(C.current=p,S(p===0?a:N(o,{count:G(p)})))},[p,a,o]);let w=null;return m?.length?w=/* @__PURE__ */ j(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ M(A,{children:[/* @__PURE__ */ j(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ j(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ j(h,{name:e.icon,size:18})}),/* @__PURE__ */ M(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ M(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ j(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ j(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ j(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ j(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?w=/* @__PURE__ */ j(`div`,{className:`wui-bell-state`,children:i}):m&&(w=/* @__PURE__ */ j(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ M(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ M(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:N(s,{label:y,count:G(p)}),children:[/* @__PURE__ */ j(h,{name:`notification`,size:20}),/* @__PURE__ */ j(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:G(p)})]}),/* @__PURE__ */ j(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ M(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ M(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ j(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ j(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ j(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:w}),v&&/* @__PURE__ */ j(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var Ce=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function we({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,ne);let s=u(`shell`,te),c=ee(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder,shortcutKey:b}=e;if(b!==void 0&&!/^[a-z]$/.test(b))throw Error(`<AppShell>: search shortcutKey must be one letter, a to z; got "${b}".`);let w=b?.toUpperCase(),T=w===void 0?``:` (${x()?`⌘${w}`:`Ctrl+${w}`})`;E(()=>{if(b===void 0)return;let e=e=>{S(e,b)&&(e.preventDefault(),P(!0),V.current?.focus(),V.current?.select())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[b]);let[A,P]=k(!1),[F,I]=k(!1),[L,R]=k({results:null,index:-1}),z=L.results===p?L.index:-1,re=e=>R({results:p,index:e}),B=O(null),V=O(null),H=O([]),ie=D(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),U=p!=null&&!F,W=ie.length;E(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||Ce(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),P(!0),V.current?.focus())},t=e=>{B.current?.contains(e.target instanceof Node?e.target:null)||(I(!0),P(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ae=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!U||W===0)return;e.preventDefault(),re((z+(e.key===`ArrowDown`?1:-1)+W)%W)}else C(e.nativeEvent)?U&&z>=0&&H.current[z]?(e.preventDefault(),H.current[z].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(U?(e.preventDefault(),I(!0)):A&&(e.preventDefault(),P(!1)))},G=-1;return H.current=[],/* @__PURE__ */ j(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ j(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ M(`div`,{className:`wui-topsearch${A?` is-open`:``}${m?` is-loading`:``}`,ref:B,"data-overflow-label":y,children:[/* @__PURE__ */ j(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":A,"aria-controls":`${c}-panel`,onClick:()=>{let e=!A;P(e),e&&V.current?.focus()},children:/* @__PURE__ */ j(h,{name:`search`,size:20})}),/* @__PURE__ */ M(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ M(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ j(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ j(`input`,{ref:V,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y+T,"aria-label":y,"aria-keyshortcuts":w===void 0?void 0:`Control+${w} Meta+${w}`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":U,"aria-controls":`${c}-list`,"aria-activedescendant":U&&z>=0?`${c}-opt-${z}`:void 0,autoComplete:`off`,value:d,onChange:e=>{I(!1),f?.(e.target.value)},onKeyDown:ae,onFocus:v})]}),/* @__PURE__ */ j(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!U,children:U&&/* @__PURE__ */ M(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[W===0&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:N(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ M(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ j(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{G+=1;let t=G;return/* @__PURE__ */ M(`a`,{className:`wui-topsearch-hit${t===z?` is-active`:``}`,role:`option`,"aria-selected":t===z,id:`${c}-opt-${t}`,href:e.href,ref:e=>{H.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ j(h,{name:e.icon,size:18})}),/* @__PURE__ */ M(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ j(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ j(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:U?W===0?n:N(W===1?a:i,{count:W}):``})]})})})}export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppRecordPager.js";import a from"./AppShortcutLegend.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{listKeys as c,selectKey as l,shortcutKey as ee}from"@webority/ui-elements/helpers";import{useEffect as te,useMemo as u,useRef as d}from"react";import{Fragment as ne,jsx as f,jsxs as p}from"react/jsx-runtime";import{KBD_TEXT as m,SPLIT_VIEW_TEXT as re,fillText as h}from"@webority/ui-elements/text";var g={sm:576,md:768,lg:992,xl:1200,xxl:1400},ie=Object.keys(g),_=[3,4,5,6,7,8],ae=Array.from({length:6},(e,t)=>`skeleton-placeholder-${t}`),v=`.wui-split-items > .wui-split-item > .wui-split-link`,y=(e,t)=>e!=null&&String(e)===String(t),oe=e=>{let t=window.matchMedia?.(`(min-width: ${g[e]}px)`);return!t||t.matches},se=(e,t)=>typeof e==`string`||typeof e==`number`?String(e):t;function b(b){let{marker:ce,props:le}=r(`AppSplitView`,b),x=n(`splitView`,re),S=n(`kbd`,m),{items:C=[],currentKey:w,onSelect:T,selectable:E=!1,selectedKeys:D,onToggle:ue,onToggleAll:de,bulkActions:fe,header:O,chips:k,pane:pe,paneHeader:A,pager:me=!0,shortcuts:j,shortcutsEnabled:M=!0,empty:N=x.empty,loading:P=!1,listWidth:F=5,stackBelow:I=`xl`,linkComponent:L,loadingLabel:R=x.loadingLabel,itemsLabel:z=x.itemsLabel,selectItemLabel:he=x.selectItemLabel,selectAllLabel:B=x.selectAllLabel,readingPaneLabel:ge=x.readingPaneLabel,previousItemLabel:_e=x.previousItemLabel,nextItemLabel:ve=x.nextItemLabel,openLabel:ye=x.openLabel,moveLabel:be=x.moveLabel,selectedLabel:xe=x.selectedLabel,untitledItemLabel:Se=x.untitledItemLabel,className:Ce=``,...V}=le,H=u(()=>new Set(D),[D]);s(`AppSplitView`,V),o(`AppSplitView`,`stackBelow`,I,ie),o(`AppSplitView`,`listWidth`,F,_);let U=g[I]?I:`xl`,we=_.includes(F)?F:5,W=d(null),Te=w!=null,G=E?H?.size??0:0,K=G>0,q=E&&C.length>0&&C.every(e=>H?.has(e.key)),Ee=E&&!q&&C.some(e=>H?.has(e.key)),De=e=>{e&&(e.indeterminate=Ee)},J=d(w);te(()=>{J.current!==w&&(J.current=w,w!=null&&W.current?.querySelector(`.wui-split-link[aria-current="true"]`)?.scrollIntoView?.({block:`nearest`}))},[w]);let Y=(e,t)=>{t.button>0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||T&&(!e.href||oe(U))&&(t.preventDefault(),T(e.key))},X=e=>{let t=[...W.current?.querySelectorAll(v)??[]];t[t.findIndex(e=>e.getAttribute(`aria-current`)===`true`)+e]?.click()},Oe=[`wui-split-view`,Te?`wui-split-reading`:``,Ce].filter(Boolean).join(` `),ke=E?[...c(),l()]:c(),Ae=/* @__PURE__ */ new Set([`J`,`K`,`Enter`,`?`,...E?[`X`]:[]]),je=[...ke,...(j??[]).filter(e=>!Ae.has(ee(e.key))).map(e=>({key:e.key,label:e.label,onPress:()=>e.onPress?.(w)}))],Z=C.findIndex(e=>y(w,e.key)),Q=me&&!P&&C.length>0?/* @__PURE__ */ f(i,{"data-split-pager":``,index:Z>=0?Z+1:void 0,total:C.length,onPrev:()=>X(-1),onNext:()=>X(1),prevLabel:_e,nextLabel:ve}):null,Me=n=>{let r=y(w,n.key),i=E&&!!H?.has(n.key),a=n.badge!==void 0&&n.badge!==null&&n.badge!==``,o=e(L,{href:n.href}),s=/* @__PURE__ */ p(ne,{children:[/* @__PURE__ */ p(`span`,{className:`wui-split-item-main`,children:[/* @__PURE__ */ f(`span`,{className:`wui-split-item-title`,children:n.title}),n.meta!==void 0&&n.meta!==null&&/* @__PURE__ */ f(`span`,{className:`wui-split-item-meta`,children:n.meta})]}),(n.trailing||a)&&/* @__PURE__ */ p(`span`,{className:`wui-split-item-end`,children:[n.trailing,a&&/* @__PURE__ */ f(`span`,{className:`wui-split-badge`,children:n.badge})]})]});return/* @__PURE__ */ p(`li`,{className:[`wui-split-item`,r?`is-active`:``,i?`is-selected`:``].filter(Boolean).join(` `),"data-key":n.key,children:[E&&/* @__PURE__ */ f(`input`,{type:`checkbox`,className:`
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppRecordPager.js";import a from"./AppShortcutLegend.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{listKeys as c,selectKey as l,shortcutKey as ee}from"@webority/ui-elements/helpers";import{useEffect as te,useMemo as u,useRef as d}from"react";import{Fragment as ne,jsx as f,jsxs as p}from"react/jsx-runtime";import{KBD_TEXT as m,SPLIT_VIEW_TEXT as re,fillText as h}from"@webority/ui-elements/text";var g={sm:576,md:768,lg:992,xl:1200,xxl:1400},ie=Object.keys(g),_=[3,4,5,6,7,8],ae=Array.from({length:6},(e,t)=>`skeleton-placeholder-${t}`),v=`.wui-split-items > .wui-split-item > .wui-split-link`,y=(e,t)=>e!=null&&String(e)===String(t),oe=e=>{let t=window.matchMedia?.(`(min-width: ${g[e]}px)`);return!t||t.matches},se=(e,t)=>typeof e==`string`||typeof e==`number`?String(e):t;function b(b){let{marker:ce,props:le}=r(`AppSplitView`,b),x=n(`splitView`,re),S=n(`kbd`,m),{items:C=[],currentKey:w,onSelect:T,selectable:E=!1,selectedKeys:D,onToggle:ue,onToggleAll:de,bulkActions:fe,header:O,chips:k,pane:pe,paneHeader:A,pager:me=!0,shortcuts:j,shortcutsEnabled:M=!0,empty:N=x.empty,loading:P=!1,listWidth:F=5,stackBelow:I=`xl`,linkComponent:L,loadingLabel:R=x.loadingLabel,itemsLabel:z=x.itemsLabel,selectItemLabel:he=x.selectItemLabel,selectAllLabel:B=x.selectAllLabel,readingPaneLabel:ge=x.readingPaneLabel,previousItemLabel:_e=x.previousItemLabel,nextItemLabel:ve=x.nextItemLabel,openLabel:ye=x.openLabel,moveLabel:be=x.moveLabel,selectedLabel:xe=x.selectedLabel,untitledItemLabel:Se=x.untitledItemLabel,className:Ce=``,...V}=le,H=u(()=>new Set(D),[D]);s(`AppSplitView`,V),o(`AppSplitView`,`stackBelow`,I,ie),o(`AppSplitView`,`listWidth`,F,_);let U=g[I]?I:`xl`,we=_.includes(F)?F:5,W=d(null),Te=w!=null,G=E?H?.size??0:0,K=G>0,q=E&&C.length>0&&C.every(e=>H?.has(e.key)),Ee=E&&!q&&C.some(e=>H?.has(e.key)),De=e=>{e&&(e.indeterminate=Ee)},J=d(w);te(()=>{J.current!==w&&(J.current=w,w!=null&&W.current?.querySelector(`.wui-split-link[aria-current="true"]`)?.scrollIntoView?.({block:`nearest`}))},[w]);let Y=(e,t)=>{t.button>0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||T&&(!e.href||oe(U))&&(t.preventDefault(),T(e.key))},X=e=>{let t=[...W.current?.querySelectorAll(v)??[]];t[t.findIndex(e=>e.getAttribute(`aria-current`)===`true`)+e]?.click()},Oe=[`wui-split-view`,Te?`wui-split-reading`:``,Ce].filter(Boolean).join(` `),ke=E?[...c(),l()]:c(),Ae=/* @__PURE__ */ new Set([`J`,`K`,`Enter`,`?`,...E?[`X`]:[]]),je=[...ke,...(j??[]).filter(e=>!Ae.has(ee(e.key))).map(e=>({key:e.key,label:e.label,onPress:()=>e.onPress?.(w)}))],Z=C.findIndex(e=>y(w,e.key)),Q=me&&!P&&C.length>0?/* @__PURE__ */ f(i,{"data-split-pager":``,index:Z>=0?Z+1:void 0,total:C.length,onPrev:()=>X(-1),onNext:()=>X(1),prevLabel:_e,nextLabel:ve}):null,Me=n=>{let r=y(w,n.key),i=E&&!!H?.has(n.key),a=n.badge!==void 0&&n.badge!==null&&n.badge!==``,o=e(L,{href:n.href}),s=/* @__PURE__ */ p(ne,{children:[/* @__PURE__ */ p(`span`,{className:`wui-split-item-main`,children:[/* @__PURE__ */ f(`span`,{className:`wui-split-item-title`,children:n.title}),n.meta!==void 0&&n.meta!==null&&/* @__PURE__ */ f(`span`,{className:`wui-split-item-meta`,children:n.meta})]}),(n.trailing||a)&&/* @__PURE__ */ p(`span`,{className:`wui-split-item-end`,children:[n.trailing,a&&/* @__PURE__ */ f(`span`,{className:`wui-split-badge`,children:n.badge})]})]});return/* @__PURE__ */ p(`li`,{className:[`wui-split-item`,r?`is-active`:``,i?`is-selected`:``].filter(Boolean).join(` `),"data-key":n.key,children:[E&&/* @__PURE__ */ f(`input`,{type:`checkbox`,className:`form-check-input wui-split-check`,checked:i,onChange:()=>ue?.(n.key),"aria-label":h(he,{title:se(n.title,Se)})}),n.href?/* @__PURE__ */ f(t,{link:o,className:`wui-split-link`,"aria-current":r?`true`:void 0,onClick:e=>Y(n,e),children:s}):/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-split-link`,"aria-current":r?`true`:void 0,onClick:e=>Y(n,e),children:s})]},n.key)},$;return $=P?/* @__PURE__ */ p(`div`,{className:`wui-split-items`,"aria-busy":`true`,tabIndex:0,children:[/* @__PURE__ */ f(`span`,{className:`visually-hidden`,children:R}),ae.map(e=>/* @__PURE__ */ p(`div`,{className:`wui-split-skeleton`,"aria-hidden":`true`,children:[/* @__PURE__ */ f(`span`,{className:`skeleton wui-split-skeleton-title`}),/* @__PURE__ */ f(`span`,{className:`skeleton wui-split-skeleton-meta`})]},e))]}):C.length?/* @__PURE__ */ f(`ul`,{className:`wui-split-items`,"aria-label":z,children:C.map(Me)}):/* @__PURE__ */ f(`div`,{className:`wui-split-empty`,children:N}),/* @__PURE__ */ p(`div`,{ref:W,className:Oe,"data-stack-below":U,"data-list-width":we,"data-shortcut-scope":M?``:void 0,...ce,...V,children:[/* @__PURE__ */ p(`div`,{className:`wui-split-list`,children:[(O||E)&&/* @__PURE__ */ p(`div`,{className:`wui-split-head`,children:[E&&/* @__PURE__ */ f(`input`,{ref:De,type:`checkbox`,className:`form-check-input wui-split-all`,checked:q,onChange:e=>de?.(e.target.checked),"aria-label":B}),/* @__PURE__ */ f(`div`,{className:`wui-split-head-main`,hidden:K,children:O}),E&&/* @__PURE__ */ p(`div`,{className:`wui-split-head-bulk`,hidden:!K,children:[/* @__PURE__ */ f(`span`,{className:`wui-split-count`,"aria-live":`polite`,children:h(xe,{count:G})}),fe]})]}),k&&/* @__PURE__ */ f(`div`,{className:`wui-split-chips`,children:k}),$,M&&/* @__PURE__ */ p(`div`,{className:`wui-split-legend`,children:[/* @__PURE__ */ p(`span`,{children:[/* @__PURE__ */ f(`kbd`,{className:`wui-kbd`,children:`J`}),` `,/* @__PURE__ */ f(`kbd`,{className:`wui-kbd`,children:`K`}),` ${be}`]}),/* @__PURE__ */ p(`span`,{children:[/* @__PURE__ */ f(`kbd`,{className:`wui-kbd`,children:S.enterLabel}),` ${ye}`]}),/* @__PURE__ */ f(a,{items:v,shortcuts:je})]})]}),/* @__PURE__ */ p(`div`,{className:`wui-split-pane`,children:[(A||Q)&&/* @__PURE__ */ p(`div`,{className:`wui-split-pane-head`,children:[A,Q]}),/* @__PURE__ */ f(`section`,{className:`wui-split-pane-body`,"aria-label":ge,tabIndex:0,children:pe})]})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,FIELD_SIZES as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppInfoTip.js";import s from"./AppRequiredMark.js";import te from"./assertValidValue.js";import ne from"./warnUnknownProps.js";import{useCallback as re,useEffect as c,useId as l,useLayoutEffect as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{TEXTAREA_TEXT as h}from"@webority/ui-elements/text";import{Form as g}from"react-bootstrap";var _=e=>e!=null&&e!==``&&e!==!1;function v({ref:v,...ie}){let{marker:y,props:b}=a(`AppTextarea`,ie),x=ee(`textarea`,h),{label:S,required:C=!1,optional:w=!1,optionalLabel:T=x.optionalLabel,error:ae,helperText:E,help:D,helpLabel:oe=x.helpLabel,id:se,name:O,rows:ce=4,autoGrow:k=!1,monospace:A=!1,showCount:j=!1,maxLength:M,disabled:N=!1,readOnly:P=!1,loading:F=!1,size:I=`md`,className:L=``,fieldClassName:R=``,controlOnly:z=!1,value:B,...V}=b,H=i(O),U=ae??H,{onChange:W,...le}=V;if(z){let e=[[`label`,S],[`error`,U],[`helperText`,E],[`fieldClassName`,R],[`showCount`,j],[`help`,D],[`optional`,w]];for(let[t,n]of e)if(_(n))throw Error(`<AppTextarea> controlOnly draws no field, so it takes no ${t}; draw the label or message on the page.`)}ne(`AppTextarea`,V),te(`AppTextarea`,`size`,I,r),c(()=>{w&&C&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppTextarea: optional and required together; optional ignored`)},[w,C]);let ue=l(),G=se||ue,de=[
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,FIELD_SIZES as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppInfoTip.js";import s from"./AppRequiredMark.js";import te from"./assertValidValue.js";import ne from"./warnUnknownProps.js";import{useCallback as re,useEffect as c,useId as l,useLayoutEffect as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{TEXTAREA_TEXT as h}from"@webority/ui-elements/text";import{Form as g}from"react-bootstrap";var _=e=>e!=null&&e!==``&&e!==!1;function v({ref:v,...ie}){let{marker:y,props:b}=a(`AppTextarea`,ie),x=ee(`textarea`,h),{label:S,required:C=!1,optional:w=!1,optionalLabel:T=x.optionalLabel,error:ae,helperText:E,help:D,helpLabel:oe=x.helpLabel,id:se,name:O,rows:ce=4,autoGrow:k=!1,monospace:A=!1,showCount:j=!1,maxLength:M,disabled:N=!1,readOnly:P=!1,loading:F=!1,size:I=`md`,className:L=``,fieldClassName:R=``,controlOnly:z=!1,value:B,...V}=b,H=i(O),U=ae??H,{onChange:W,...le}=V;if(z){let e=[[`label`,S],[`error`,U],[`helperText`,E],[`fieldClassName`,R],[`showCount`,j],[`help`,D],[`optional`,w]];for(let[t,n]of e)if(_(n))throw Error(`<AppTextarea> controlOnly draws no field, so it takes no ${t}; draw the label or message on the page.`)}ne(`AppTextarea`,V),te(`AppTextarea`,`size`,I,r),c(()=>{w&&C&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppTextarea: optional and required together; optional ignored`)},[w,C]);let ue=l(),G=se||ue,de=[k?`autosize`:``,A?`wui-mono`:``,U?`error`:``,I===`sm`?`wui-input-sm`:``,I===`lg`?`wui-input-lg`:``,I===`xl`?`wui-input-xl`:``,F?n:``,L].filter(Boolean).join(` `),K=U&&G?`${G}-error`:void 0,q=E&&G?`${G}-hint`:void 0,fe=K||q,J=d(null),pe=e=>{J.current=e,typeof v==`function`?v(e):v&&(v.current=e)},Y=d(void 0),X=re(()=>{let e=J.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,Y.current=`${e.value}|${e.clientWidth}`)},[]);u(()=>{let e=J.current;!k||!e?Y.current=void 0:`${String(B??e.value)}|${e.clientWidth}`!==Y.current&&X()});let[Z,Q]=f(()=>String(B??V.defaultValue??``).length);c(()=>{j&&B!==void 0&&Q(String(B??``).length)},[B,j]);let me=e=>{k&&X(),j&&Q(e.currentTarget.value.length),V.onInput?.(e)},$=/* @__PURE__ */ p(g.Control,{as:`textarea`,id:G,name:O,rows:ce,className:de,"aria-invalid":U?`true`:`false`,"aria-describedby":fe,"aria-busy":F||void 0,required:C,maxLength:M,disabled:N,readOnly:P||F,...z?y:null,...B===void 0?null:{value:B},...le,...W?{onChange:W}:null,ref:pe,onInput:me});return z?$:/* @__PURE__ */ m(g.Group,{...y,className:`field${R?` ${R}`:``}`,children:[S&&/* @__PURE__ */ m(g.Label,{className:`label`,htmlFor:G,children:[S,w&&!C&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${T}`}),C&&/* @__PURE__ */ p(s,{}),D&&/* @__PURE__ */ p(o,{label:oe,children:D})]}),$,/* @__PURE__ */ p(t,{error:U,hint:E,errorId:K,hintId:q}),j&&/* @__PURE__ */ m(`div`,{className:`field-count${M&&Z>=M?` at-limit`:``}`,children:[Z,M?` / ${M}`:``]})]})}export{v as default};
|