@webority/ui-react 0.163.0 → 0.164.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/README.md +2 -2
- package/dist/canvas-kit/kit.js +191 -191
- package/dist/canvas-kit/manifest.json +72 -14
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAccountSwitcher.js +1 -1
- package/dist/components/AppAlert.js +1 -1
- package/dist/components/AppBreadcrumbs.js +1 -1
- package/dist/components/AppButton.js +1 -1
- package/dist/components/AppCard.js +1 -1
- package/dist/components/AppChartCard.js +1 -1
- package/dist/components/AppChoiceChip.js +1 -1
- package/dist/components/AppCodeBlock.js +1 -1
- package/dist/components/AppCommentThread.js +1 -1
- package/dist/components/AppContextMenu.js +1 -1
- package/dist/components/AppDataTable.js +1 -1
- package/dist/components/AppDrawer.js +1 -1
- package/dist/components/AppDropdown.js +1 -1
- package/dist/components/AppDueDate.js +1 -1
- package/dist/components/AppFileViewer.js +1 -1
- package/dist/components/AppFilterBar.js +1 -1
- package/dist/components/AppFloatingButton.js +1 -1
- package/dist/components/AppHoverCard.js +1 -1
- package/dist/components/AppImagePicker.js +1 -1
- package/dist/components/AppInlineEdit.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppMarkdown.js +1 -1
- package/dist/components/AppModal.js +1 -1
- package/dist/components/AppNotificationCenter.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppPageHeader.js +1 -1
- package/dist/components/AppPopover.js +1 -1
- package/dist/components/AppSearch.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppSparkline.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppThemeToggle.js +1 -1
- package/dist/components/AppToast.js +1 -1
- package/dist/components/AppTooltip.js +1 -1
- package/dist/components/AppWhatsNew.js +1 -1
- package/dist/components/AppWorkspaceSwitcher.js +1 -1
- package/dist/components/warnUnknownProps.js +1 -1
- package/dist/guidance.json +5 -5
- package/dist/lib/indianGrouping.js +1 -0
- package/dist/lib/useOverlayRoot.js +1 -0
- package/dist/types/components/AppAccordion.d.ts +1 -1
- package/dist/types/components/AppAlert.d.ts +1 -1
- package/dist/types/components/AppBreadcrumbs.d.ts +6 -0
- package/dist/types/components/AppCard.d.ts +1 -1
- package/dist/types/components/AppChip.d.ts +2 -2
- package/dist/types/components/AppCodeBlock.d.ts +1 -1
- package/dist/types/components/AppCommandPalette.d.ts +2 -2
- package/dist/types/components/AppDataTable.d.ts +3 -1
- package/dist/types/components/AppDescriptions.d.ts +1 -1
- package/dist/types/components/AppDrawer.d.ts +1 -1
- package/dist/types/components/AppDropdown.d.ts +7 -7
- package/dist/types/components/AppFilePicker.d.ts +1 -1
- package/dist/types/components/AppFloatingDock.d.ts +2 -2
- package/dist/types/components/AppFormActions.d.ts +1 -1
- package/dist/types/components/AppFormSection.d.ts +1 -1
- package/dist/types/components/AppIcon.d.ts +2 -2
- package/dist/types/components/AppInfoTip.d.ts +1 -1
- package/dist/types/components/AppInlineEdit.d.ts +5 -0
- package/dist/types/components/AppKpiTile.d.ts +1 -1
- package/dist/types/components/AppMeter.d.ts +1 -1
- package/dist/types/components/AppModal.d.ts +4 -4
- package/dist/types/components/AppNumberInput.d.ts +7 -0
- package/dist/types/components/AppPageHeader.d.ts +5 -0
- package/dist/types/components/AppPopover.d.ts +3 -3
- package/dist/types/components/AppRequiredMark.d.ts +1 -1
- package/dist/types/components/AppResourceCard.d.ts +1 -1
- package/dist/types/components/AppResult.d.ts +2 -2
- package/dist/types/components/AppScrollbar.d.ts +1 -1
- package/dist/types/components/AppShell.d.ts +6 -6
- package/dist/types/components/AppSparkline.d.ts +3 -0
- package/dist/types/components/AppSpinner.d.ts +2 -2
- package/dist/types/components/AppSplash.d.ts +2 -2
- package/dist/types/components/AppTabs.d.ts +3 -3
- package/dist/types/components/AppToast.d.ts +1 -1
- package/dist/types/components/AppToolbar.d.ts +5 -5
- package/dist/types/components/AppTooltip.d.ts +5 -5
- package/dist/types/components/AppWorkspaceSwitcher.d.ts +3 -3
- package/dist/types/components/toastStore.d.ts +2 -2
- package/dist/types/components/warnUnknownProps.d.ts +3 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/CheckField.d.ts +1 -1
- package/dist/types/lib/FieldMessage.d.ts +1 -1
- package/dist/types/lib/FileItemRow.d.ts +1 -1
- package/dist/types/lib/fileItem.d.ts +3 -3
- package/dist/types/lib/indianGrouping.d.ts +2 -0
- package/dist/types/lib/useOverlayRoot.d.ts +2 -0
- package/dist/ui-react.js +1 -1
- package/package.json +9 -9
- package/dist/lib/FocusPanel.js +0 -1
- package/dist/lib/pageScrollLock.js +0 -1
- package/dist/types/lib/FocusPanel.d.ts +0 -11
- package/dist/types/lib/pageScrollLock.d.ts +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "WeborityWeb",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/ui-react",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.164.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 14,
|
|
8
8
|
"platform": "Web",
|
|
@@ -1707,6 +1707,13 @@
|
|
|
1707
1707
|
"required": false,
|
|
1708
1708
|
"description": "The accessible name of the ellipsis button.",
|
|
1709
1709
|
"default": "Show hidden levels"
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
"name": "wrap",
|
|
1713
|
+
"type": "boolean",
|
|
1714
|
+
"required": false,
|
|
1715
|
+
"description": "false keeps the trail on one line; items do not wrap.",
|
|
1716
|
+
"default": true
|
|
1710
1717
|
}
|
|
1711
1718
|
],
|
|
1712
1719
|
"itemsTakeAction": [
|
|
@@ -4769,6 +4776,7 @@
|
|
|
4769
4776
|
"http",
|
|
4770
4777
|
"js",
|
|
4771
4778
|
"json",
|
|
4779
|
+
"razor",
|
|
4772
4780
|
"sql",
|
|
4773
4781
|
"text"
|
|
4774
4782
|
],
|
|
@@ -7398,7 +7406,7 @@
|
|
|
7398
7406
|
"name": "groupBy",
|
|
7399
7407
|
"type": "string",
|
|
7400
7408
|
"required": false,
|
|
7401
|
-
"description": "A column key: rows gather under a header row per value of it, in the order each value first appears, each header collapsing its rows and showing their count."
|
|
7409
|
+
"description": "A column key: rows gather under a header row per value of it, in the order each value first appears, each header collapsing its rows and showing their count. On a server-paged list each page's rows gather the same way, and the count is the rows on that page."
|
|
7402
7410
|
},
|
|
7403
7411
|
{
|
|
7404
7412
|
"name": "headerTone",
|
|
@@ -7437,6 +7445,12 @@
|
|
|
7437
7445
|
"required": false,
|
|
7438
7446
|
"description": "Caps the table's height; the body scrolls inside it with the header pinned. Without it there is no scroll box for the header to stick to."
|
|
7439
7447
|
},
|
|
7448
|
+
{
|
|
7449
|
+
"name": "nameLines",
|
|
7450
|
+
"type": "number",
|
|
7451
|
+
"required": false,
|
|
7452
|
+
"description": "Lines a ledger name wraps to before it is cut, 1 to 4; the default is 2. A compact or virtual table shows one line."
|
|
7453
|
+
},
|
|
7440
7454
|
{
|
|
7441
7455
|
"name": "pad",
|
|
7442
7456
|
"type": "number",
|
|
@@ -8760,9 +8774,9 @@
|
|
|
8760
8774
|
"do": [],
|
|
8761
8775
|
"dont": [],
|
|
8762
8776
|
"a11y": [
|
|
8763
|
-
"The panel
|
|
8777
|
+
"The panel is a native dialog, named by ariaLabel, else by the title.",
|
|
8764
8778
|
"The sheet handle is a vertical slider labelled Sheet height, and the close button is labelled Close.",
|
|
8765
|
-
"Focus moves in on open, Tab
|
|
8779
|
+
"Focus moves in on open, Tab moves through the drawer, then on to the browser, without wrapping, Escape leaves it open unless staticBackdrop is false, and focus returns to what opened it."
|
|
8766
8780
|
]
|
|
8767
8781
|
}
|
|
8768
8782
|
},
|
|
@@ -12181,6 +12195,17 @@
|
|
|
12181
12195
|
"description": "Shows the value without the edit affordance.",
|
|
12182
12196
|
"default": false
|
|
12183
12197
|
},
|
|
12198
|
+
{
|
|
12199
|
+
"name": "grouping",
|
|
12200
|
+
"type": "enum",
|
|
12201
|
+
"enum": [
|
|
12202
|
+
"indian",
|
|
12203
|
+
"none"
|
|
12204
|
+
],
|
|
12205
|
+
"required": false,
|
|
12206
|
+
"description": "Digit grouping of a number at rest: indian shows 15,00,000, none shows 1500000.",
|
|
12207
|
+
"default": "none"
|
|
12208
|
+
},
|
|
12184
12209
|
{
|
|
12185
12210
|
"name": "id",
|
|
12186
12211
|
"type": "string",
|
|
@@ -14750,8 +14775,8 @@
|
|
|
14750
14775
|
}
|
|
14751
14776
|
],
|
|
14752
14777
|
"a11y": [
|
|
14753
|
-
"Focus
|
|
14754
|
-
"The
|
|
14778
|
+
"Focus opens on the first control. Tab moves through the dialog and then to the browser's bar, without wrapping.",
|
|
14779
|
+
"The dialog is named by a plain-text title or by ariaLabel; a headerless dialog with neither warns in development.",
|
|
14755
14780
|
"An outside click leaves it open by default (staticBackdrop); Escape closes it unless closeOnEscape is false."
|
|
14756
14781
|
]
|
|
14757
14782
|
}
|
|
@@ -15170,6 +15195,17 @@
|
|
|
15170
15195
|
"description": "Extra classes on the field wrapper.",
|
|
15171
15196
|
"default": ""
|
|
15172
15197
|
},
|
|
15198
|
+
{
|
|
15199
|
+
"name": "grouping",
|
|
15200
|
+
"type": "enum",
|
|
15201
|
+
"enum": [
|
|
15202
|
+
"indian",
|
|
15203
|
+
"none"
|
|
15204
|
+
],
|
|
15205
|
+
"required": false,
|
|
15206
|
+
"description": "Digit grouping while the number is shown: indian writes 3,00,000 and posts the plain digits; none writes 300000.",
|
|
15207
|
+
"default": "none"
|
|
15208
|
+
},
|
|
15173
15209
|
{
|
|
15174
15210
|
"name": "help",
|
|
15175
15211
|
"type": "node",
|
|
@@ -15971,6 +16007,13 @@
|
|
|
15971
16007
|
"required": false,
|
|
15972
16008
|
"description": "Small kicker label above the title."
|
|
15973
16009
|
},
|
|
16010
|
+
{
|
|
16011
|
+
"name": "foldActions",
|
|
16012
|
+
"type": "boolean",
|
|
16013
|
+
"required": false,
|
|
16014
|
+
"description": "Folds the actions that do not fit into a More menu, keeping the solid primary action in the row while it fits (size bar only).",
|
|
16015
|
+
"default": false
|
|
16016
|
+
},
|
|
15974
16017
|
{
|
|
15975
16018
|
"name": "icon",
|
|
15976
16019
|
"type": "icon",
|
|
@@ -21691,13 +21734,6 @@
|
|
|
21691
21734
|
"description": "Extra classes on the shell root.",
|
|
21692
21735
|
"default": ""
|
|
21693
21736
|
},
|
|
21694
|
-
{
|
|
21695
|
-
"name": "closeNavLabel",
|
|
21696
|
-
"type": "string",
|
|
21697
|
-
"required": false,
|
|
21698
|
-
"description": "Replaces the built-in English text, for other languages.",
|
|
21699
|
-
"default": "Close navigation"
|
|
21700
|
-
},
|
|
21701
21737
|
{
|
|
21702
21738
|
"name": "collapseNavLabel",
|
|
21703
21739
|
"type": "string",
|
|
@@ -22405,6 +22441,17 @@
|
|
|
22405
22441
|
"description": "Replaces the built-in English text, for other languages. {name} is the nav item's label.",
|
|
22406
22442
|
"default": "Show or hide {name} pages"
|
|
22407
22443
|
},
|
|
22444
|
+
{
|
|
22445
|
+
"name": "tone",
|
|
22446
|
+
"type": "enum",
|
|
22447
|
+
"enum": [
|
|
22448
|
+
"brand",
|
|
22449
|
+
"default"
|
|
22450
|
+
],
|
|
22451
|
+
"required": false,
|
|
22452
|
+
"description": "brand paints the sidebar and its parts with the --color-shell-* tokens.",
|
|
22453
|
+
"default": "default"
|
|
22454
|
+
},
|
|
22408
22455
|
{
|
|
22409
22456
|
"name": "topbarEnd",
|
|
22410
22457
|
"type": "node",
|
|
@@ -23559,6 +23606,12 @@
|
|
|
23559
23606
|
"required": false,
|
|
23560
23607
|
"description": "Width in px.",
|
|
23561
23608
|
"default": 48
|
|
23609
|
+
},
|
|
23610
|
+
{
|
|
23611
|
+
"name": "yMin",
|
|
23612
|
+
"type": "number",
|
|
23613
|
+
"required": false,
|
|
23614
|
+
"description": "The lowest value of the line's range. Unset: the lowest data value."
|
|
23562
23615
|
}
|
|
23563
23616
|
],
|
|
23564
23617
|
"itemsTakeAction": [],
|
|
@@ -27251,7 +27304,7 @@
|
|
|
27251
27304
|
"top"
|
|
27252
27305
|
],
|
|
27253
27306
|
"required": false,
|
|
27254
|
-
"description": "Where the tooltip appears. A named side is preferred but flips if needed to stay in view; `auto`
|
|
27307
|
+
"description": "Where the tooltip appears. A named side is preferred but flips if needed to stay in view; `auto` picks the side with the most room outright. The bubble is a native popover in the top layer, so it never clips off-screen.",
|
|
27255
27308
|
"default": "top"
|
|
27256
27309
|
},
|
|
27257
27310
|
{
|
|
@@ -31288,6 +31341,11 @@
|
|
|
31288
31341
|
"version": "0.160.0",
|
|
31289
31342
|
"components": [],
|
|
31290
31343
|
"values": {}
|
|
31344
|
+
},
|
|
31345
|
+
{
|
|
31346
|
+
"version": "0.164.0",
|
|
31347
|
+
"components": [],
|
|
31348
|
+
"values": {}
|
|
31291
31349
|
}
|
|
31292
31350
|
]
|
|
31293
31351
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.164.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.164.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "00de08cc45a1cb06e9528be7b69e1df8fbfe808006acae6e85a8f849adfb88ab",
|
|
14
|
+
"bytes": 1017644
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "b423c89fbd40bd3cd2fa22b2d48190e6ab11fbce2a59223dee3f34c529fb1bc8",
|
|
18
|
+
"bytes": 9824141
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppAvatar.js";import n from"./AppIcon.js";import r from"./warnUnknownProps.js";import{
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppAvatar.js";import n from"./AppIcon.js";import r from"./warnUnknownProps.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";function o(t){let{marker:n,props:o}=e(`AppAccountSwitcher`,t),{accounts:c=[],currentId:l,onSelect:u,label:d=`Switch account`,linkComponent:f,...p}=o;if(r(`AppAccountSwitcher`,p),c.length===0)return null;let m=c.find(e=>e.id===l)??c[0];if(!m)throw Error(`AppAccountSwitcher: no account to mark as current`);return/* @__PURE__ */ a(`div`,{className:`wui-account-switcher`,role:`group`,"aria-label":d,...n,children:[/* @__PURE__ */ i(`div`,{className:`wui-account-switcher-label`,children:d}),/* @__PURE__ */ i(`div`,{className:`wui-account-switcher-list`,children:c.map(e=>/* @__PURE__ */ i(s,{account:e,current:e.id===m.id,onSelect:u,linkComponent:f},e.id))})]})}function s({account:e,current:r,onSelect:o,linkComponent:s}){let{id:c,name:l,description:u,photo:d,badge:f,href:p}=e;return/* @__PURE__ */ a(p?s??`a`:`button`,{className:`dropdown-item wui-account-switcher-option${r?` is-active`:``}`,"data-account-id":c,"aria-current":r?`true`:void 0,...p?s?{to:p}:{href:p}:{type:`button`,onClick:()=>o?.(e)},children:[/* @__PURE__ */ i(t,{name:l,src:d,size:`md`,tone:`auto`}),/* @__PURE__ */ a(`span`,{className:`wui-account-switcher-option-text`,children:[/* @__PURE__ */ i(`span`,{className:`wui-account-switcher-option-name`,children:l}),u?/* @__PURE__ */ i(`span`,{className:`wui-account-switcher-option-note`,children:u}):null]}),f?/* @__PURE__ */ i(`span`,{className:`wui-account-switcher-badge`,children:f}):null,r?/* @__PURE__ */ i(n,{name:`check`,size:16,className:`wui-account-switcher-tick`}):null]})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{
|
|
1
|
+
import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";import{Alert as c}from"react-bootstrap";var l={info:`info`,success:`check`,warning:`alert-triangle`,danger:`x`},u=e.filter(e=>e!==`primary`),d=[`sm`,`md`,`lg`],f=[`alert`,`status`,`none`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function m(e,t,r,i,a,s){return i?/* @__PURE__ */ o(`span`,{className:`alert-icon alert-icon-image`,style:s!==void 0&&s>0?{width:s,height:s}:void 0,children:/* @__PURE__ */ o(`img`,{src:i,alt:a})}):e?typeof e==`string`?/* @__PURE__ */ o(`span`,{className:`alert-icon`,children:/* @__PURE__ */ o(n,{name:e,size:t,variant:r})}):/* @__PURE__ */ o(`span`,{className:`alert-icon`,children:e}):null}function h(e){let{marker:n,props:h}=t(`AppAlert`,e),{tone:g=`info`,children:_,title:v,icon:y,iconVariant:b,iconSize:x,image:S,imageAlt:C=``,imageSize:w,className:T=``,onClose:E,dismissible:D,bordered:O=!0,accent:k=!1,size:A=`md`,action:j,role:M=`alert`,...N}=h;i(`AppAlert`,N),r(`AppAlert`,`tone`,g,u),r(`AppAlert`,`size`,A,d),r(`AppAlert`,`role`,M,f),r(`AppAlert`,`iconVariant`,b,p);let P=y===void 0?l[g]:y===`none`?null:y,F=!!S||!!P,I=j!=null&&j!==!1,L=v?/* @__PURE__ */ o(`div`,{className:`alert-heading`,children:v}):null,R=F&&!!L&&!!_,z=x!==void 0&&x>0?x:A===`lg`?R?17:15:R?13:11,B=[F?`alert-has-icon`:``,I?`alert-has-action`:``,R?`alert-stack`:``,O?``:`alert-borderless`,k?`alert-accent`:``,A===`sm`?`alert-sm`:``,A===`lg`?`alert-lg`:``,T].filter(Boolean).join(` `);return/* @__PURE__ */ o(c,{className:B||void 0,...E?{onClose:E}:null,dismissible:D??typeof E==`function`,transition:!1,role:M===`none`?void 0:M,...n,...N,variant:g,children:F||I?/* @__PURE__ */ s(a,{children:[F&&m(P,z,b,S,C,w),/* @__PURE__ */ s(`div`,{className:`alert-content`,children:[L,_]}),I&&/* @__PURE__ */ o(`div`,{className:`alert-action`,children:j})]}):/* @__PURE__ */ s(a,{children:[L,_]})})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppDropdown.js";import i from"./renderIconProp.js";import a from"./warnUnknownProps.js";import{createContext as o,useContext as s}from"react";import{
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppDropdown.js";import i from"./renderIconProp.js";import a from"./warnUnknownProps.js";import{createContext as o,useContext as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{Breadcrumb as u}from"react-bootstrap";var d=o(!1);function f(o){let{marker:f,props:p}=n(`AppBreadcrumbs`,o),{items:m=[],linkComponent:h,className:g=``,maxItems:_,moreLabel:v=`Show hidden levels`,wrap:y=!0,...b}=p;a(`AppBreadcrumbs`,b);let x=s(d);if(_!==void 0&&(!Number.isInteger(_)||_<1))throw RangeError(`AppBreadcrumbs: maxItems must be a whole number of 1 or more.`);let S=_!==void 0&&m.length>_?m.length-_:0,C=m.slice(0,S).map((e,t)=>{if(typeof e.label!=`string`)throw RangeError(`AppBreadcrumbs: with maxItems, every hidden crumb's label must be a string.`);let n=e.key??`${e.label}-${t}`;return e.to?{key:n,label:e.label,icon:e.icon,to:e.to}:e.href?{key:n,label:e.label,icon:e.icon,href:e.href}:{key:n,header:e.label}}),w=[S>0?`wui-breadcrumb-collapse`:``,y?``:`wui-breadcrumb-nowrap`].filter(Boolean).join(` `);return/* @__PURE__ */ l(u,{className:g||void 0,...w?{listProps:{className:w}}:{},...f,...b,children:[S>0?/* @__PURE__ */ c(`li`,{className:`breadcrumb-item wui-breadcrumb-more`,children:/* @__PURE__ */ c(r,{icon:`more-horizontal`,iconSize:14,label:v,align:`start`,toggleClassName:`wui-breadcrumb-more-toggle`,linkComponent:h,items:C})}):null,m.map((n,r)=>{let a=!x&&r===m.length-1,o=n.icon?i(n.icon,{size:14}):null,s={};if(!a){let r=n.to||n.href;s=n.to&&h?{linkAs:t,linkProps:{link:e(h,{to:n.to})}}:r?{href:r}:{linkAs:`span`}}return/* @__PURE__ */ l(u.Item,{active:a,className:r<S?`wui-breadcrumb-collapsible`:void 0,...s,children:[o,n.label]},n.key??`${n.label}-${r}`)})]})}export{d as BreadcrumbTrailContext,f as default};
|
|
@@ -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 a}from"./AppForm.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import
|
|
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 a}from"./AppForm.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import te from"./warnUnknownProps.js";import c from"./withTooltip.js";import{useContext as l,useRef as u,useState as ne}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{Button as p}from"react-bootstrap";var m={sm:14,md:16,lg:20,xl:20},h=[`sheen`,`fill`,`expand`,`glow`,`roll`,`none`],re=[`rounded`,`pill`,`sharp`],ie=[`button`,`submit`,`reset`],ae=/* @__PURE__ */ new Set([!0,!1,...Array.from({length:100},(e,t)=>t+1)]),oe={variant:null},g=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],_=e=>e===`pill`||e===`sharp`?`wui-btn-shape-${e}`:``;function v(e){return/* @__PURE__ */ f(`span`,{className:`wui-btn-roll`,children:[/* @__PURE__ */ d(`span`,{className:`wui-btn-roll__a`,children:e}),/* @__PURE__ */ d(`span`,{className:`wui-btn-roll__b`,"aria-hidden":`true`,children:e})]})}function se(e,t,n,r){if(!e)return null;let i=n=>typeof e==`string`?/* @__PURE__ */ d(o,{name:e,size:m[t]??m.md,variant:r,className:n}):/* @__PURE__ */ d(`span`,{className:[`d-inline-flex`,n].filter(Boolean).join(` `),children:e});return/* @__PURE__ */ f(`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 y(e,t,n,r){if(!e)return null;let i=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?/* @__PURE__ */ d(o,{name:e,size:m[n]??m.md,variant:r,className:i}):/* @__PURE__ */ d(`span`,{className:`d-inline-flex ${i}`,children:e})}function ce(e,t,n){return e?/* @__PURE__ */ d(`span`,{className:`wui-btn-pin-icon`,"aria-hidden":`true`,children:typeof e==`string`?/* @__PURE__ */ d(o,{name:e,size:m[t]??m.md,variant:n}):e}):null}function b(o){let{marker:b,props:le}=ee(`AppButton`,o),{children:x,tone:S=`primary`,variant:C=`solid`,size:w=`md`,type:T=`button`,loading:E=!1,disabled:D=!1,block:O=!1,leftIcon:k=null,rightIcon:A=null,href:j,static:M=!1,tooltip:N,tooltipPlacement:P,shortcut:F,animation:I,pinRightIcon:L=!1,shape:R=`rounded`,iconVariant:z,className:B=``,onClick:V,onClickCapture:H,vibrate:U,...W}=le,[ue,G]=ne(!1),K=u(!1),q=l(a),de=q!==null&&T===`submit`&&q.submitting,J=E||ue||de;te(`AppButton`,W),s(`AppButton`,`vibrate`,U,ae);let Y=U===!0?10:typeof U==`number`&&Number.isInteger(U)&&U>=1&&U<=100?U:0;I!==void 0&&s(`AppButton`,`animation`,I,h);let X=I===`roll`&&!M,Z=L&&A!=null&&A!==``&&!M&&!J;if(s(`AppButton`,`tone`,S,i),s(`AppButton`,`variant`,C,r),s(`AppButton`,`size`,w,Object.keys(m)),s(`AppButton`,`shape`,R,re),s(`AppButton`,`type`,T,ie),z!==void 0&&s(`AppButton`,`iconVariant`,z,g),M){let t=[`btn`,e(S,C),w===`sm`?`btn-sm`:w===`lg`?`btn-lg`:w===`xl`?`btn-xl`:``,O?`w-100`:``,_(R),`btn-static`,B].filter(Boolean).join(` `);return c(/* @__PURE__ */ f(`span`,{className:t,...b,...W,children:[y(k,`left`,w,z),x,y(A,`right`,w,z)]}),N,P)}let Q=[O?`w-100`:``,J?`is-loading`:``,e(S,C),w===`xl`?`btn-xl`:``,I&&h.includes(I)?`btn-anim-${I}`:``,Z?`wui-btn-pin-end`:``,_(R),B].filter(Boolean).join(` `),$=(W.as===void 0||W.as===`button`)&&j===void 0&&W.to===void 0,fe=$?{}:{role:void 0,tabIndex:D||J?-1:void 0},{as:pe,...me}=W,he={as:pe},ge=N!=null&&N!==``,_e=e=>{if(K.current)return;Y&&!D&&!J&&navigator.vibrate?.(Y);let t=V?.(e);if(!(t instanceof Promise))return;K.current=!0,G(!0);let n=()=>{K.current=!1,G(!1)};t.then(n,e=>{throw n(),e})};return c(/* @__PURE__ */ f(p,{type:$?T:void 0,href:j,...oe,...w===`sm`||w===`lg`?{size:w}:null,disabled:D||J,"aria-busy":J||void 0,"aria-keyshortcuts":t(F),"data-wui-vibrate":Y||void 0,className:Q||void 0,onClick:_e,onClickCapture:D||J?void 0:H,...fe,...b,...he,...me,children:[J&&/* @__PURE__ */ d(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!J&&y(k,`left`,w,z),X?v(x):x,!J&&(X?se(A,w,Z,z):Z?ce(A,w,z):y(A,`right`,w,z)),!ge&&n(F)]}),N,P,F)}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{isImeSafeEnter as te}from"@webority/ui-elements/helpers";import{useState as i}from"react";import{Fragment as ne,jsx as a,jsxs as o}from"react/jsx-runtime";import{Card as s}from"react-bootstrap";var c=[`flat`,`elevated`,`outline`,`filled`,`accent`],l={elevated:`card-elevated`,outline:`card-outlined`,filled:`card-muted`,accent:`card-accent`},u=[`primary`,`success`,`warning`,`danger`,`info`],d=[`none`,`sm`,`md`,`lg`],f=[`sans`,`serif`],re={xs:320,sm:420,md:560,lg:720};function p(p){let{marker:ie,props:ae}=t(`AppCard`,p),{title:m,subtitle:h,headerIcon:g,titleClassName:_=``,titleFont:v=`sans`,header:y,headerExtra:b,headerActions:x,footer:S,media:C,children:w,variant:T=`flat`,tone:E=`primary`,padding:D=`md`,maxWidth:O,className:k=``,bodyClassName:A=``,headerClassName:j=``,body:M=!0,lifted:N=!1,flush:P=!1,divided:F=!1,href:I,onClick:L,linkComponent:R,onClose:z,dismissible:B,closeLabel:V=`Close`,...H}=ae,[U,W]=i(!1);ee(`AppCard`,H),r(`AppCard`,`variant`,T,c),r(`AppCard`,`tone`,E,u),r(`AppCard`,`padding`,D,d),r(`AppCard`,`titleFont`,v,f);let{style:G,as:K,...q}=H,oe=I!=null||L!=null,se=[l[T]??``,T===`accent`&&E&&E!==`primary`?`tone-${E}`:``,D&&D!==`md`?`card-pad-${D}`:``,P?`card-flush`:``,F?`card-divided`:``,N?`card-lifted`:``,O==null?``:`card-constrained`,oe?`card-clickable`:``,k].filter(Boolean).join(` `)||void 0,J=O==null?void 0:re[String(O)],Y=O==null?void 0:J==null?typeof O==`number`?`${O}px`:O:`${J}px`,ce=Y?{"--card-max-width":Y,...G}:G,X={};if(I!=null){let t=e(R,{href:I});X=t.Tag===`a`?{as:`a`,href:t.linkProps.href}:{as:t.Tag,to:t.linkProps.to},L&&(X.onClick=L)}else L!=null&&(X={role:`button`,tabIndex:0,onClick:L,onKeyDown:e=>{(te(e.nativeEvent)||e.key===` `)&&(e.preventDefault(),L(e))}});let Z=B??typeof z==`function`,le=Z?/* @__PURE__ */ a(`button`,{type:`button`,className:`card-close`,"aria-label":V,onClick:e=>{e.preventDefault(),e.stopPropagation(),W(!0),z?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ a(n,{name:`x`,size:16})}):null,Q=m!=null||h!=null||g!=null,ue=y!=null||Q||b!=null||x!=null||Z,$=g==null?null:typeof g==`string`?/* @__PURE__ */ a(n,{name:g,size:18}):g;return U?null:/* @__PURE__ */ o(s,{className:se,style:ce,...ie,...q,...K===void 0?null:{as:K},...X,children:[C!=null&&/* @__PURE__ */ a(`div`,{className:`card-media`,children:C}),ue&&/* @__PURE__ */ o(s.Header,{className:j||void 0,children:[y??/* @__PURE__ */ o(ne,{children:[Q&&/* @__PURE__ */ o(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ a(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ o(`div`,{className:`card-header-titles`,children:[m!=null&&/* @__PURE__ */ a(`div`,{className:[`card-title`,_].filter(Boolean).join(` `),style:v===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:m}),h!=null&&/* @__PURE__ */ a(`div`,{className:`card-subtitle`,children:h})]})]}),b,x!=null&&/* @__PURE__ */ a(`div`,{className:`card-header-actions`,children:x})]}),le]}),M?/* @__PURE__ */ a(s.Body,{className:A||void 0,children:w}):w,S!=null&&/* @__PURE__ */ a(`div`,{className:`card-footer`,children:S})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppButton.js";import i from"./AppCard.js";import a from"./AppDropdown.js";import o from"./AppIcon.js";import s from"./AppSegmented.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{useLayoutEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppButton.js";import i from"./AppCard.js";import a from"./AppDropdown.js";import o from"./AppIcon.js";import s from"./AppSegmented.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{useLayoutEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";var _=e=>e instanceof HTMLElement,v=e=>{let t=e.querySelector(`wui-chart`);return t&&_(t)?t:null},y=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},b=!1;function x(){!b&&y()&&(b=!0,e("[@webority/ui-react] <AppChartCard> has no `title`, which is the card's heading and names its menu button."))}var S=e=>e.getAttribute(`view`)===`table`?`table`:`chart`,C=e=>e===`chart`||e===`table`;function w(e){let{marker:_,props:y}=n(`AppChartCard`,e),{title:b,subtitle:w,toolbar:T=!0,onRetry:E,footer:D,children:O,className:k=``,legendLabel:A=`Show legend`,legendTitle:j=`Show or hide the legend`,viewLabel:M=`View`,chartViewLabel:N=`Chart`,tableViewLabel:P=`Table`,moreActionsLabel:F=`More actions`,moreActionsForLabel:I=`More actions for {title}`,downloadPngLabel:L=`Download PNG`,downloadCsvLabel:R=`Download CSV`,retryLabel:z=`Try again`,...B}=y;l(`AppChartCard`,B),b||x();let V=f(null),H=f(null),[U,W]=p(`chart`),G=f(U);G.current=U;let[K,q]=p(!0),J=()=>V.current?v(V.current):null;u(()=>{let e=V.current;if(!e)throw Error(`AppChartCard: the chart body is not mounted`);let t=()=>{let t=v(e);t&&(t===H.current?W(S(t)):(H.current=t,t.hasAttribute(`view`)?W(S(t)):G.current!==`chart`&&t.setAttribute(`view`,G.current)))};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`view`]}),()=>n.disconnect()},[]);let Y=e=>{if(c(`AppChartCard`,`view`,e,[`chart`,`table`]),!C(e))throw TypeError(`[@webority/ui-react] <AppChartCard> received no view`);W(e),J()?.setAttribute(`view`,e)},X=d(()=>[{value:`chart`,label:N,icon:`chart`},{value:`table`,label:P,icon:`grid`}],[N,P]),Z=/* @__PURE__ */ g(m,{children:[/* @__PURE__ */ h(`button`,{type:`button`,className:`topbar-icon-btn wui-chart-card-tool wui-chart-card-legend-tool`,"aria-pressed":K,"aria-label":A,title:j,onClick:()=>q(!K),children:/* @__PURE__ */ h(o,{name:`list`,size:16})}),/* @__PURE__ */ h(s,{size:`sm`,label:M,options:X,value:U,onChange:Y}),/* @__PURE__ */ h(a,{icon:`more-horizontal`,label:b?t(I,{title:b}):F,items:[{key:`png`,label:L,icon:`image`,onClick:()=>J()?.exportPng?.()},{key:`csv`,label:R,icon:`download`,onClick:()=>J()?.exportCsv?.()}]})]}),Q=[`wui-chart-card`,K?``:`wui-chart-card-legend-off`,k].filter(Boolean).join(` `);return/* @__PURE__ */ g(i,{title:b,subtitle:w,headerActions:T?Z:void 0,footer:D,className:Q,..._,...B,children:[/* @__PURE__ */ h(`div`,{ref:V,children:O}),E&&/* @__PURE__ */ h(`div`,{className:`wui-chart-card-retry`,children:/* @__PURE__ */ h(r,{variant:`outline`,size:`sm`,onClick:E,children:z})})]})}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`sm`,`md`,`lg`],u=[`soft`,`solid`];function d(d){let{marker:f,props:p}=n(`AppChoiceChip`,d),{multiple:m=!0,label:h,name:g,value:_,checked:v,onChange:y,children:b,count:x,help:S,helpLabel:C=`More information`,size:w=`md`,variant:T=`soft`,disabled:E=!1,readOnly:D=!1,loading:O=!1,className:k=``,ref:A,...j}=p;return a(`AppChoiceChip`,j),i(`AppChoiceChip`,`size`,w,l),i(`AppChoiceChip`,`variant`,T,u),/* @__PURE__ */ c(o,{children:[/* @__PURE__ */ c(`label`,{className:`choice-chip${
|
|
1
|
+
import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`sm`,`md`,`lg`],u=[`soft`,`solid`];function d(d){let{marker:f,props:p}=n(`AppChoiceChip`,d),{multiple:m=!0,label:h,name:g,value:_,checked:v,onChange:y,children:b,count:x,help:S,helpLabel:C=`More information`,size:w=`md`,variant:T=`soft`,disabled:E=!1,readOnly:D=!1,loading:O=!1,className:k=``,ref:A,...j}=p;return a(`AppChoiceChip`,j),i(`AppChoiceChip`,`size`,w,l),i(`AppChoiceChip`,`variant`,T,u),/* @__PURE__ */ c(o,{children:[/* @__PURE__ */ c(`label`,{className:`choice-chip${w===`sm`?` choice-chip-sm`:w===`lg`?` choice-chip-lg`:``}${T===`solid`?` wui-choice-chip-solid`:``}${k?` ${k}`:``}${O?` ${e}`:``}`,"aria-busy":O||void 0,...f,...j,children:[/* @__PURE__ */ s(`input`,{ref:A,type:m?`checkbox`:`radio`,name:g,value:_,checked:v,disabled:E||O,"aria-readonly":D||void 0,onClick:t(D||O),onChange:y}),/* @__PURE__ */ s(`span`,{children:h??b}),x!=null&&/* @__PURE__ */ s(`span`,{className:`count`,children:x})]}),S&&/* @__PURE__ */ s(r,{label:C,children:S})]})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{jsx as i}from"react/jsx-runtime";var a=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`],o=()=>import(`@webority/ui-elements/elements/code-block`);function s(s){e(`wui-code-block`,o);let{marker:c,props:l}=t(`AppCodeBlock`,s),{code:u,language:d=`text`,lineNumbers:f=!1,wrap:p=!1,label:m,copyLabel:h,copiedLabel:g,className:_=``,...v}=l;return r(`AppCodeBlock`,v),n(`AppCodeBlock`,`language`,d,a),/* @__PURE__ */ i(`wui-code-block`,{class:[`wui-code-block`,_].filter(Boolean).join(` `),language:d===`text`?void 0:d,"line-numbers":f?``:void 0,wrap:p?``:void 0,label:m||void 0,"copy-label":h||void 0,"copied-label":g||void 0,...c,...v,children:/* @__PURE__ */ i(`pre`,{className:`wui-code-source`,children:/* @__PURE__ */ i(`code`,{children:u??``})})})}export{s as default};
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{jsx as i}from"react/jsx-runtime";var a=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`],o=()=>import(`@webority/ui-elements/elements/code-block`);function s(s){e(`wui-code-block`,o);let{marker:c,props:l}=t(`AppCodeBlock`,s),{code:u,language:d=`text`,lineNumbers:f=!1,wrap:p=!1,label:m,copyLabel:h,copiedLabel:g,className:_=``,...v}=l;return r(`AppCodeBlock`,v),n(`AppCodeBlock`,`language`,d,a),/* @__PURE__ */ i(`wui-code-block`,{class:[`wui-code-block`,_].filter(Boolean).join(` `),language:d===`text`?void 0:d,"line-numbers":f?``:void 0,wrap:p?``:void 0,label:m||void 0,"copy-label":h||void 0,"copied-label":g||void 0,...c,...v,children:/* @__PURE__ */ i(`pre`,{className:`wui-code-source`,children:/* @__PURE__ */ i(`code`,{children:u??``})})})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/fillLabel.js";import{initialsOf as t}from"../lib/initials.js";import{linkTarget as n}from"../lib/linkTarget.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAvatar.js";import s from"./AppBadge.js";import c from"./AppButton.js";import l from"./AppIcon.js";import u from"./AppMarkdown.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COMMENT_REACTIONS as p,COMMENT_TEXT as m,formatDate as h,formatFileSize as g,formatNumber as _,mentionTextFromValue as v,parseMentionValue as y,toInstant as b}from"@webority/ui-elements/helpers";import{Fragment as x,useEffect as S,useId as C,useRef as w}from"react";import{jsx as T,jsxs as E}from"react/jsx-runtime";var D=[`stacked`,`inline`],O=[`list`,`conversation`],k=()=>import(`@webority/ui-elements/elements/comment-thread`),A=()=>import(`@webority/ui-elements/elements/mention-input`),j=e=>y(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),M=e=>e.localName===`wui-mention-input`;function N(e){let{marker:t,props:n}=a(`AppCommentThread`,e),{comments:r=[],onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,people:_,loadPeople:v,reactionChoices:y,allowReplies:b=!0,allowReactions:x=!0,composerPlaceholder:j,variant:N=`list`,composer:F=`stacked`,author:I,postLabel:L=m.post,composerRows:R,readOnly:z=!1,markdown:B=!1,linkComponent:V,label:H=m.listName,internalLabel:U=`Internal note`,attachmentsLabel:W=`Attachments`,composerLabel:G=`Add a comment`,noCommentsText:K=`No comments yet.`,reactionsLabel:ee=`Reactions`,repliesToLabel:te=`Replies to {name}`,editedLabel:ne=`Edited`,deletedText:re=`This comment was deleted.`,replyLabel:ie=`Reply`,editLabel:ae=`Edit`,deleteLabel:oe=`Delete`,deleteConfirmText:se=`Delete this comment?`,cancelLabel:ce=`Cancel`,addReactionLabel:le=`Add a reaction`,chooseReactionLabel:ue=`Choose a reaction`,peopleLabel:de=`People`,id:fe,className:pe=``,...q}=n;f(`AppCommentThread`,q),d(`AppCommentThread`,`variant`,N,O),d(`AppCommentThread`,`composer`,F,D);let J=i(`wui-comment-thread`,k);i(`wui-mention-input`,A);let me=C(),Y=fe||`comment-thread-${me.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=w(null),Z=typeof v==`function`,he=y?.length?y:p,Q=F===`inline`,ge=R??(Q?1:3),_e={reactionsLabel:ee,repliesToLabel:te,editedLabel:ne,deletedText:re,replyLabel:ie,editLabel:ae,deleteLabel:oe,deleteConfirmText:se,cancelLabel:ce,addReactionLabel:le},$=w({onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,loadPeople:v});return $.current={onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,loadPeople:v},S(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),S(()=>{let e=X.current;e&&J&&!Z&&(e.people=_||[])},[_,Z,J]),S(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!M(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ E(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,N===`conversation`&&`wui-comment-thread--conversation`,pe].filter(Boolean).join(` `),controlled:``,"read-only":z?``:void 0,remote:Z?``:void 0,"reaction-choices":y?.length?y.join(` `):void 0,"no-replies":b?void 0:``,"no-reactions":x?void 0:``,"composer-placeholder":j,...t,...q,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:r.length?/* @__PURE__ */ T(`ol`,{className:`wui-comment-list`,"aria-label":H,children:r.map(e=>/* @__PURE__ */ T(P,{comment:e,topLevel:!0,readOnly:z,allowReplies:b,allowReactions:x,markdown:B,linkComponent:V,internalLabel:U,attachmentsLabel:W,text:_e},e.id))}):/* @__PURE__ */ T(`p`,{className:`wui-comment-empty`,children:K})}),!z&&x&&/* @__PURE__ */ T(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":ue,"data-wui-picker":``,hidden:!0,children:he.map(e=>/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!z&&/* @__PURE__ */ E(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&I?/* @__PURE__ */ T(o,{name:I,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ T(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:G,"people-label":de,placeholder:j??m.composerPlaceholder,rows:String(ge),remote:Z?``:void 0}),/* @__PURE__ */ T(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ T(c,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:L})}),/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ T(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function P({comment:i,topLevel:a=!1,readOnly:o,allowReplies:d,allowReactions:f,markdown:p,linkComponent:m,internalLabel:y,attachmentsLabel:S,text:C}){let{id:w,author:D,at:O,value:k,edited:A,mine:M,internal:N,attachments:F=[],deleted:I,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=i,V=D?.name||``,H=b(O),U=!o&&!I&&L,W=!o&&!I&&R,G=a&&d,K=[`wui-comment`,N&&`wui-comment--internal`,M&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ E(`li`,{className:K,"data-wui-comment":w,"data-value":k??``,"data-wui-deleted":I?``:void 0,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ E(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ T(`span`,{className:`avatar-face`,children:t(V)||`?`}),D?.src&&/* @__PURE__ */ T(`img`,{className:`avatar-img`,src:D.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ E(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ T(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:h(O,{pattern:`datetime`})}),A&&!I&&/* @__PURE__ */ T(`span`,{className:`wui-comment-edited`,children:C.editedLabel}),N&&/* @__PURE__ */ T(s,{className:`wui-comment-internal-badge`,children:y})]}),I?/* @__PURE__ */ T(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:C.deletedText}):/* @__PURE__ */ T(`div`,{className:p?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:p?/* @__PURE__ */ T(u,{value:v(k??``).text,headings:`text`}):j(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ T(x,{children:t.text},e):/* @__PURE__ */ E(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!I&&F.length>0&&/* @__PURE__ */ T(`ul`,{className:`wui-comment-attachments`,"aria-label":S,children:F.map(e=>{let t=n(m,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ E(`li`,{children:[/* @__PURE__ */ E(r,{link:t,className:`wui-comment-attachment`,...e.to?{}:{download:!0},children:[/* @__PURE__ */ T(l,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ T(`span`,{className:`wui-comment-attachment-size`,children:g(e.sizeBytes)})]},e.to??e.href)})}),U&&/* @__PURE__ */ T(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),f&&!I&&(z.length>0||!o)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":C.reactionsLabel,children:[z.map(e=>o?/* @__PURE__ */ E(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:_(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ E(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:_(e.count,{decimals:0})})]},e.emoji)),!o&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":C.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ T(l,{name:`emoji-smile`,size:16})})]}),!o&&!I&&(G||U||W)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:C.replyLabel}),U&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:C.editLabel}),W&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:C.deleteLabel})]}),W&&/* @__PURE__ */ E(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-confirm-text`,children:C.deleteConfirmText}),/* @__PURE__ */ T(c,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:C.deleteLabel}),/* @__PURE__ */ T(c,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:C.cancelLabel})]}),!o&&/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),a&&B.length>0&&/* @__PURE__ */ T(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":e(C.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ T(P,{comment:e,readOnly:o,allowReactions:f,markdown:p,linkComponent:m,internalLabel:y,attachmentsLabel:S,text:C},e.id))}),G&&!o&&!I&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{N as default};
|
|
1
|
+
import e from"../lib/fillLabel.js";import{initialsOf as t}from"../lib/initials.js";import{linkTarget as n}from"../lib/linkTarget.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAvatar.js";import s from"./AppBadge.js";import c from"./AppButton.js";import l from"./AppIcon.js";import u from"./AppMarkdown.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COMMENT_REACTIONS as p,COMMENT_TEXT as m,formatDate as h,formatFileSize as g,formatNumber as _,mentionTextFromValue as v,parseMentionValue as y,toInstant as b}from"@webority/ui-elements/helpers";import{Fragment as x,useEffect as S,useId as C,useRef as w}from"react";import{jsx as T,jsxs as E}from"react/jsx-runtime";var D=[`stacked`,`inline`],O=[`list`,`conversation`],k=()=>import(`@webority/ui-elements/elements/comment-thread`),A=()=>import(`@webority/ui-elements/elements/mention-input`),j=e=>y(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),M=e=>e.localName===`wui-mention-input`;function N(e){let{marker:t,props:n}=a(`AppCommentThread`,e),{comments:r=[],onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,people:_,loadPeople:v,reactionChoices:y,allowReplies:b=!0,allowReactions:x=!0,composerPlaceholder:j,variant:N=`list`,composer:F=`stacked`,author:I,postLabel:L=m.post,composerRows:R,readOnly:z=!1,markdown:B=!1,linkComponent:V,label:H=m.listName,internalLabel:U=`Internal note`,attachmentsLabel:W=`Attachments`,composerLabel:G=`Add a comment`,noCommentsText:K=`No comments yet.`,reactionsLabel:ee=`Reactions`,repliesToLabel:te=`Replies to {name}`,editedLabel:ne=`Edited`,deletedText:re=`This comment was deleted.`,replyLabel:ie=`Reply`,editLabel:ae=`Edit`,deleteLabel:oe=`Delete`,deleteConfirmText:se=`Delete this comment?`,cancelLabel:ce=`Cancel`,addReactionLabel:le=`Add a reaction`,chooseReactionLabel:ue=`Choose a reaction`,peopleLabel:de=`People`,id:fe,className:pe=``,...q}=n;f(`AppCommentThread`,q),d(`AppCommentThread`,`variant`,N,O),d(`AppCommentThread`,`composer`,F,D);let J=i(`wui-comment-thread`,k);i(`wui-mention-input`,A);let me=C(),Y=fe||`comment-thread-${me.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=w(null),Z=typeof v==`function`,he=y?.length?y:p,Q=F===`inline`,ge=R??(Q?1:3),_e={reactionsLabel:ee,repliesToLabel:te,editedLabel:ne,deletedText:re,replyLabel:ie,editLabel:ae,deleteLabel:oe,deleteConfirmText:se,cancelLabel:ce,addReactionLabel:le},$=w({onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,loadPeople:v});return $.current={onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,loadPeople:v},S(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),S(()=>{let e=X.current;e&&J&&!Z&&(e.people=_||[])},[_,Z,J]),S(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!M(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ E(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,N===`conversation`&&`wui-comment-thread--conversation`,pe].filter(Boolean).join(` `),controlled:``,"read-only":z?``:void 0,remote:Z?``:void 0,"reaction-choices":y?.length?y.join(` `):void 0,"no-replies":b?void 0:``,"no-reactions":x?void 0:``,"composer-placeholder":j,...t,...q,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:r.length?/* @__PURE__ */ T(`ol`,{className:`wui-comment-list`,"aria-label":H,children:r.map(e=>/* @__PURE__ */ T(P,{comment:e,topLevel:!0,readOnly:z,allowReplies:b,allowReactions:x,markdown:B,linkComponent:V,internalLabel:U,attachmentsLabel:W,text:_e},e.id))}):/* @__PURE__ */ T(`p`,{className:`wui-comment-empty`,children:K})}),!z&&x&&/* @__PURE__ */ T(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":ue,"data-wui-picker":``,popover:`auto`,children:he.map(e=>/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!z&&/* @__PURE__ */ E(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&I?/* @__PURE__ */ T(o,{name:I,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ T(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:G,"people-label":de,placeholder:j??m.composerPlaceholder,rows:String(ge),remote:Z?``:void 0}),/* @__PURE__ */ T(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ T(c,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:L})}),/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ T(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function P({comment:i,topLevel:a=!1,readOnly:o,allowReplies:d,allowReactions:f,markdown:p,linkComponent:m,internalLabel:y,attachmentsLabel:S,text:C}){let{id:w,author:D,at:O,value:k,edited:A,mine:M,internal:N,attachments:F=[],deleted:I,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=i,V=D?.name||``,H=b(O),U=!o&&!I&&L,W=!o&&!I&&R,G=a&&d,K=[`wui-comment`,N&&`wui-comment--internal`,M&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ E(`li`,{className:K,"data-wui-comment":w,"data-value":k??``,"data-wui-deleted":I?``:void 0,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ E(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ T(`span`,{className:`avatar-face`,children:t(V)||`?`}),D?.src&&/* @__PURE__ */ T(`img`,{className:`avatar-img`,src:D.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ E(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ T(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:h(O,{pattern:`datetime`})}),A&&!I&&/* @__PURE__ */ T(`span`,{className:`wui-comment-edited`,children:C.editedLabel}),N&&/* @__PURE__ */ T(s,{className:`wui-comment-internal-badge`,children:y})]}),I?/* @__PURE__ */ T(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:C.deletedText}):/* @__PURE__ */ T(`div`,{className:p?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:p?/* @__PURE__ */ T(u,{value:v(k??``).text,headings:`text`}):j(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ T(x,{children:t.text},e):/* @__PURE__ */ E(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!I&&F.length>0&&/* @__PURE__ */ T(`ul`,{className:`wui-comment-attachments`,"aria-label":S,children:F.map(e=>{let t=n(m,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ E(`li`,{children:[/* @__PURE__ */ E(r,{link:t,className:`wui-comment-attachment`,...e.to?{}:{download:!0},children:[/* @__PURE__ */ T(l,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ T(`span`,{className:`wui-comment-attachment-size`,children:g(e.sizeBytes)})]},e.to??e.href)})}),U&&/* @__PURE__ */ T(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),f&&!I&&(z.length>0||!o)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":C.reactionsLabel,children:[z.map(e=>o?/* @__PURE__ */ E(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:_(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ E(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:_(e.count,{decimals:0})})]},e.emoji)),!o&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":C.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ T(l,{name:`emoji-smile`,size:16})})]}),!o&&!I&&(G||U||W)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:C.replyLabel}),U&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:C.editLabel}),W&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:C.deleteLabel})]}),W&&/* @__PURE__ */ E(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-confirm-text`,children:C.deleteConfirmText}),/* @__PURE__ */ T(c,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:C.deleteLabel}),/* @__PURE__ */ T(c,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:C.cancelLabel})]}),!o&&/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),a&&B.length>0&&/* @__PURE__ */ T(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":e(C.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ T(P,{comment:e,readOnly:o,allowReactions:f,markdown:p,linkComponent:m,internalLabel:y,attachmentsLabel:S,text:C},e.id))}),G&&!o&&!I&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import{useEffect as c,useLayoutEffect as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=()=>import(`@webority/ui-elements/elements/context-menu`);function h(e){i(`wui-context-menu`,m);let{marker:t,props:n}=a(`AppContextMenu`,e),{items:r=[],target:o,trigger:d,children:h,ariaLabel:_=`Context menu`,disabled:y=!1,open:b,onOpen:x,onBeforeOpen:S,menuClassName:C=``,linkComponent:w,...T}=n;s(`AppContextMenu`,T);let E=u(null);return c(()=>{let e=E.current;if(!e||!x)return;let t=e=>{if(!g(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:open without a CustomEvent.`);x(e.detail)};return e.addEventListener(`wui-context-menu:open`,t),()=>e.removeEventListener(`wui-context-menu:open`,t)},[x]),c(()=>{let e=E.current;if(!e||!S)return;let t=e=>{if(!g(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:beforeopen without a CustomEvent.`);S(e)};return e.addEventListener(`wui-context-menu:beforeopen`,t),()=>e.removeEventListener(`wui-context-menu:beforeopen`,t)},[S]),l(()=>{let e=E.current;if(!e)throw Error(`<AppContextMenu> has no menu element to open.`);e.toggleAttribute(`open`,!!b)},[b]),/* @__PURE__ */ p(`wui-context-menu`,{ref:E,target:o,trigger:d,disabled:y,...t,...T,children:[h,/* @__PURE__ */ f(`div`,{className:`dropdown-menu wui-context-menu-panel${C?` ${C}`:``}`,role:`menu`,"aria-label":_,tabIndex:-1,children:v(r,w)})]})}function g(e){return e instanceof CustomEvent}var _=e=>`dropdown-item${e.tone===`danger`?` danger`:``}${e.disabled?` disabled`:``}`;function v(i,a){return i.map(i=>{if(i.divider)return/* @__PURE__ */ f(`hr`,{className:`dropdown-divider`},i.key);if(i.items!=null){let e=i.searchPlaceholder||`Search`;return/* @__PURE__ */ p(`div`,{className:`wui-context-menu-sub`,role:`none`,"data-searchable":i.searchable?``:void 0,children:[/* @__PURE__ */ p(`button`,{type:`button`,className:_(i),role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":`false`,tabIndex:-1,"data-key":i.key,"aria-disabled":i.disabled?`true`:void 0,children:[o(i.icon,{size:16}),i.label,o(`chevron-right`,{size:14,className:`wui-context-menu-chevron`})]}),/* @__PURE__ */ p(`div`,{className:`dropdown-menu wui-context-menu-subpanel`,role:`menu`,"aria-label":i.label,tabIndex:-1,children:[i.searchable?/* @__PURE__ */ f(`input`,{type:`search`,className:`wui-context-menu-search`,autoComplete:`off`,placeholder:e,"aria-label":e}):null,v(i.items,a)]})]},i.key)}let s=!!i.to&&!i.disabled,c=/* @__PURE__ */ p(d,{children:[i.image?/* @__PURE__ */ f(`img`,{src:i.image,alt:``}):o(i.icon,{size:16}),i.label,n(i.shortcut)]}),l={className:_(i),role:`menuitem`,tabIndex:-1,"data-key":i.key,"aria-checked":i.checked||void 0,"data-hint":i.hint||void 0,"aria-keyshortcuts":t(i.shortcut),"aria-disabled":i.disabled||void 0,onClick:i.disabled?void 0:i.onClick,children:c};return s?/* @__PURE__ */ f(r,{link:e(a,{to:i.to}),...l},i.key):/* @__PURE__ */ f(`button`,{type:`button`,...l},i.key)})}export{h as default};
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import{useEffect as c,useLayoutEffect as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=()=>import(`@webority/ui-elements/elements/context-menu`);function h(e){i(`wui-context-menu`,m);let{marker:t,props:n}=a(`AppContextMenu`,e),{items:r=[],target:o,trigger:d,children:h,ariaLabel:_=`Context menu`,disabled:y=!1,open:b,onOpen:x,onBeforeOpen:S,menuClassName:C=``,linkComponent:w,...T}=n;s(`AppContextMenu`,T);let E=u(null);return c(()=>{let e=E.current;if(!e||!x)return;let t=e=>{if(!g(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:open without a CustomEvent.`);x(e.detail)};return e.addEventListener(`wui-context-menu:open`,t),()=>e.removeEventListener(`wui-context-menu:open`,t)},[x]),c(()=>{let e=E.current;if(!e||!S)return;let t=e=>{if(!g(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:beforeopen without a CustomEvent.`);S(e)};return e.addEventListener(`wui-context-menu:beforeopen`,t),()=>e.removeEventListener(`wui-context-menu:beforeopen`,t)},[S]),l(()=>{let e=E.current;if(!e)throw Error(`<AppContextMenu> has no menu element to open.`);e.toggleAttribute(`open`,!!b)},[b]),/* @__PURE__ */ p(`wui-context-menu`,{ref:E,target:o,trigger:d,disabled:y,...t,...T,children:[h,/* @__PURE__ */ f(`div`,{className:`dropdown-menu wui-context-menu-panel${C?` ${C}`:``}`,popover:`auto`,role:`menu`,"aria-label":_,tabIndex:-1,children:v(r,w)})]})}function g(e){return e instanceof CustomEvent}var _=e=>`dropdown-item${e.tone===`danger`?` danger`:``}${e.disabled?` disabled`:``}`;function v(i,a){return i.map(i=>{if(i.divider)return/* @__PURE__ */ f(`hr`,{className:`dropdown-divider`},i.key);if(i.items!=null){let e=i.searchPlaceholder||`Search`;return/* @__PURE__ */ p(`div`,{className:`wui-context-menu-sub`,role:`none`,"data-searchable":i.searchable?``:void 0,children:[/* @__PURE__ */ p(`button`,{type:`button`,className:_(i),role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":`false`,tabIndex:-1,"data-key":i.key,"aria-disabled":i.disabled?`true`:void 0,children:[o(i.icon,{size:16}),i.label,o(`chevron-right`,{size:14,className:`wui-context-menu-chevron`})]}),/* @__PURE__ */ p(`div`,{className:`dropdown-menu wui-context-menu-subpanel`,popover:`auto`,role:`menu`,"aria-label":i.label,tabIndex:-1,children:[i.searchable?/* @__PURE__ */ f(`input`,{type:`search`,className:`wui-context-menu-search`,autoComplete:`off`,placeholder:e,"aria-label":e}):null,v(i.items,a)]})]},i.key)}let s=!!i.to&&!i.disabled,c=/* @__PURE__ */ p(d,{children:[i.image?/* @__PURE__ */ f(`img`,{src:i.image,alt:``}):o(i.icon,{size:16}),i.label,n(i.shortcut)]}),l={className:_(i),role:`menuitem`,tabIndex:-1,"data-key":i.key,"aria-checked":i.checked||void 0,"data-hint":i.hint||void 0,"aria-keyshortcuts":t(i.shortcut),"aria-disabled":i.disabled||void 0,onClick:i.disabled?void 0:i.onClick,children:c};return s?/* @__PURE__ */ f(r,{link:e(a,{to:i.to}),...l},i.key):/* @__PURE__ */ f(`button`,{type:`button`,...l},i.key)})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppSkeleton.js";import a from"./AppTablePagination.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as c,COLUMN_MIN_WIDTH as ee,DATA_TABLE_TEXT as l,PIN_AT_VAR as u,PIN_SIDES as d,ROW_HEIGHTS as te,ROW_MOVE_LIMIT as ne,ROW_SAVE_ERROR_CLASS as re,attachRowDrag as ie,attachScrollEdges as ae,groupCount as oe,groupItems as se,isImeSafeEnter as ce,measureRows as le,pinAtValue as ue,pinClasses as de,planPins as fe,playRowMoves as pe,rowOrderChanged as me,saveOutcomeText as he,settledRows as ge,syncTargets as _e,virtualRange as ve}from"@webority/ui-elements/helpers";import{Children as ye,Fragment as be,isValidElement as xe,useCallback as Se,useEffect as f,useLayoutEffect as Ce,useMemo as we,useRef as p,useState as m}from"react";import{Fragment as Te,jsx as h,jsxs as g}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as Ee}from"@webority/theme/runtime";var De=()=>import(`@webority/ui-elements/elements/data-table`),Oe=[`comfortable`,`cozy`,`compact`],ke=[`auto`,`fixed`];function _(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function Ae(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||xe(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 Ae(_(e,t),t)}var v=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},y=/* @__PURE__ */ new Set;function b(t,n){!y.has(t)&&v()&&(y.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Me=100,Ne=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Pe=()=>{},Fe=()=>({total:0,keys:[]}),Ie=[],Le=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function x(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Re(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function ze(e){return e==null||e===``?`-`:Array.isArray(e)?ye.toArray(e):typeof e==`boolean`?String(e):e}function Be(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function Ve(e){t(`wui-data-table`,De);let{marker:ye,props:xe}=n(`AppDataTable`,e),{columns:v,rows:y=Ie,rowKey:Ve=Ne,sort:He,onSort:Ue,loading:S=!1,skeletonRows:We=5,empty:Ge=`No records found.`,emptyFiltered:Ke,sourceCount:qe,rowActions:C,rowActionsLabel:Je,pagination:w,ariaLabel:Ye,className:Xe=``,wrapperClassName:Ze=``,selectable:T=!1,selectedIds:E,isRowSelectable:Qe,onToggleRow:$e,onToggleAll:et,onSelectRange:tt,renderExpanded:nt,density:D=`comfortable`,tableLayout:rt=`auto`,striped:it=!1,flush:at=!1,pad:ot,headerTone:st,rowDrag:O=!1,maxHeight:ct,stickyFirstColumn:lt=!1,stickyActions:ut=!1,stackOnMobile:k=!1,hiddenColumns:dt,rowStatus:ft,rowHref:A,onRowClick:pt,activeRowKey:mt,hoverRowKey:ht,resizableColumns:j=!1,viewKey:gt,groupBy:M,groupLabel:_t,virtual:N=!1,rowSaving:P,rowSaveError:F,...vt}=xe;s(`AppDataTable`,vt);let{style:yt,...bt}=vt,I=Se((e,t)=>{let n=Ve(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[Ve]),xt=dt?.length?new Set(dt):null;v=xt?v.filter(e=>!(e.hideable&&xt.has(e.key))):v,o(`AppDataTable`,`density`,D,Oe),o(`AppDataTable`,`tableLayout`,rt,ke);for(let e of v)o(`AppDataTable`,`column.pin`,e.pin,d);let St=[`table table-ledger`,D===`cozy`||D===`compact`?`wui-table-${D}`:``,it?`wui-table-striped`:``,lt?`wui-table-sticky-first`:``,ut?`wui-table-sticky-actions`:``,k?`wui-table-stack`:``,Xe].filter(Boolean).join(` `),L=typeof nt==`function`,[Ct,wt]=m(()=>/* @__PURE__ */ new Set),Tt=e=>wt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Et=v.some(e=>typeof e.footer==`function`),R=typeof A==`function`||typeof pt==`function`,Dt=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),Ot=(e,t)=>{if(Dt(t)||(pt&&pt(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=ct!==void 0,kt=[`table-wrap`,z?`wui-table-scroll`:``,at?`wui-table-flush`:``,Ze].filter(Boolean).join(` `),At={maxHeight:z?ct:void 0,"--wui-table-pad":ot!=null&&!at?`${ot}px`:void 0,"--wui-table-header-bg":st??void 0},jt=Object.values(At).some(e=>e!==void 0)||yt!==void 0?{...At,...yt}:void 0,Mt=Math.max(1,v.length+ +!!C+ +!!T+ +!!L),Nt=v.some(e=>e.pin===`start`||e.pin===`end`),Pt=Nt||j||!!M||N,B=+!!L+ +!!T,Ft=Nt?fe([...L?[`lead`]:[],...T?[`lead`]:[],...v.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],V=(e,t=``)=>{let n=Ft[e];return n?{className:`${t.trim()} ${de(n)}`.trim(),style:{[u]:ue(n.side,n.ordinal)}}:{className:t,style:void 0}},H=(e,t)=>Ft[e]?{...t,...V(e).style}:t,It=v.length-1+ +!!C;gt&&!j&&b(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),N&&!z&&b(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),N&&(L||k)&&b(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!N&&y?.length>500&&b(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let U=N&&z&&!L&&!k&&!S&&y?.length>0,W=(e,t)=>!Qe||!!Qe(e,t),Lt=T&&y?y.reduce((e,t,n)=>e+ +!!W(t,n),0):0,G=T&&y?y.reduce((e,t,n)=>e+(W(t,n)&&E?.has(I(t,n))?1:0),0):0,Rt=Lt>0&&G===Lt,zt=G>0&&!Rt,Bt=e=>{e&&(e.indeterminate=zt)},Vt=p(null),Ht=(e,t)=>{let n=Vt.current;Vt.current=e;let r=t&&n!==null?y.findIndex((e,t)=>I(e,t)===n):-1,i=y.findIndex((t,n)=>I(t,n)===e);if(r<0||i<0||r===i){$e?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=y.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>W(e,t)).map(([e,t])=>I(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(tt)tt(s,a);else for(let e of s)$e?.(e)},Ut=e=>{Qe?(y||[]).forEach((t,n)=>{let r=I(t,n);W(t,n)&&(E?.has(r)||!1)!==e&&$e?.(r)}):et?.(e)},[Wt,Gt]=m(()=>/* @__PURE__ */ new Set),Kt=e=>Gt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),K=we(()=>{let e=(y||[]).map((e,t)=>({row:e,i:t}));return M?se(e,({row:e})=>String(_(e,M)??``)).flatMap(e=>[{group:e,open:!Wt.has(e.key)},...Wt.has(e.key)?[]:e.items]):e},[y,M,Wt]),qt=p(null),[q,Jt]=m(null),Yt=Se(e=>{qt.current=e,Jt(e)},[]),Xt=p(null);f(()=>{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;Xt.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(Xt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=ae(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[q]),f(()=>{if(!O||!q)return;let e=ie(q);return _e(document),e},[O,q]);let Zt=p(Fe);Ce(()=>{Zt.current=()=>({total:y?.length??0,keys:y?y.flatMap((e,t)=>{let n=I(e,t);return W(e,t)&&E?.has(n)?[String(n)]:[]}):[]})});let Qt=p(!1);f(()=>{if(!Qt.current&&(Qt.current=!0,G===0))return;let{total:e,keys:t}=Zt.current();qt.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:G,total:e,keys:t}}))},[G]);let[$t,en]=m({top:0,height:0}),[J,tn]=m(te[D]??te.comfortable);f(()=>{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};en(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 nn=p(null);Ce(()=>{if(!U){nn.current=null;return}let e=`${D}:${y?.length??0}`;if(nn.current===e)return;nn.current=e;let t=(qt.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&&tn(t)});let Y={start:0,end:K.length,before:0,after:0};if(U){Y=ve({scrollTop:$t.top,viewport:$t.height||Number.parseFloat(String(ct))||0,rowHeight:J,count:K.length});let e=Xt.current;e!==null&&e>=0&&e<K.length&&(e<Y.start&&Y.start-e<=Me&&(Y={...Y,start:e,before:e*J}),e>=Y.end&&e-Y.end<Me&&(Y={...Y,end:e+1,after:(K.length-e-1)*J}))}let rn=p(null),an=p(null),on=p(null),sn=!N&&!S&&y?.length>0&&y.length<=ne;Ce(()=>{let e=rn.current;if(!sn||!e){an.current=null,on.current=null;return}let t=y.map((e,t)=>I(e,t));me(on.current,t)&&pe(e.rows,an.current),an.current=le(e.rows),on.current=t});let X=typeof P==`function`||typeof F==`function`,cn=p(null),ln=p(null),un=v[0]?.key;f(()=>{if(!X){ln.current=null;return}let e=/* @__PURE__ */ new Map;(y||[]).forEach((t,n)=>{let r=un===void 0?void 0:_(t,un),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(I(t,n),{...Le(t,P,F),label:i})});let t=he(ge(ln.current,e));ln.current=e,t&&cn.current&&(cn.current.textContent=t)},[y,P,F,I,X,un]);let Z=Ke!==void 0&&(qe===void 0||qe>0)?Ke:Ge,dn=({group:e,open:t},n)=>{let i=_(e.items[0]?.row,M??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ h(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":U?n+2:void 0,children:/* @__PURE__ */ h(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:Mt,children:/* @__PURE__ */ g(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>Kt(e.key),children:[/* @__PURE__ */ h(r,{name:`chevron-down`,size:16}),/* @__PURE__ */ h(`span`,{className:`wui-group-label`,children:_t?_t(i,a):ze(Ae(i,M??``))}),/* @__PURE__ */ h(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:oe(e.items.length)}),/* @__PURE__ */ h(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${l.rows(e.items.length)}`})]})})},`group:${e.key}`)},fn=({row:e,i:t},n)=>{let i=I(e,t),a=L&&Ct.has(i),o=mt!=null&&String(mt)===String(i),s=ht!=null&&String(ht)===String(i),c=String(i).replace(/[^a-z0-9]/gi,`_`),ee=V(0,`wui-expand-cell`),l=V(+!!L,`wui-select-cell`),u=X?Le(e,P,F):null,d=W(e,t);return/* @__PURE__ */ g(be,{children:[/* @__PURE__ */ g(`tr`,{className:[T&&d&&E?.has(i)?`is-selected`:``,R?`wui-row-link`:``,o?`wui-row-active`:``,s?Ee.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":U?n+2:void 0,"aria-busy":u?.state===`saving`?`true`:void 0,"data-wui-save-state":u?.state||void 0,"data-status":ft?.(e)||void 0,"data-href":A?.(e)||void 0,"data-row-key":O?String(i):void 0,tabIndex:R?0:void 0,onClick:R?t=>Ot(e,t):void 0,onAuxClick:R&&A?t=>t.button===1&&Ot(e,t):void 0,onKeyDown:R?t=>{ce(t.nativeEvent)&&t.target===t.currentTarget&&Ot(e,t)}:void 0,children:[L&&/* @__PURE__ */ h(`td`,{className:ee.className,style:ee.style,children:/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${c}-expanded`:void 0,"aria-label":a?`Collapse row`:`Expand row`,onClick:()=>Tt(i),children:/* @__PURE__ */ h(r,{name:`chevron-down`,size:16})})}),T&&/* @__PURE__ */ h(`td`,{className:l.className,style:l.style,children:/* @__PURE__ */ h(`input`,{type:`checkbox`,className:`wui-check`,checked:d&&(E?.has(i)||!1),disabled:!d,onChange:e=>Ht(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),v.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ g(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 `:``)+x(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:H(B+n,t.cellStyle),"data-label":k&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):ze(je(e,t.key)),n===0&&u?.state===`error`&&/* @__PURE__ */ h(`span`,{className:re,children:u.message})]},t.key)}),C&&/* @__PURE__ */ h(`td`,{children:/* @__PURE__ */ h(`div`,{className:`u-row-actions`,children:C(e)})})]}),a&&/* @__PURE__ */ h(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ h(`td`,{id:`${c}-expanded`,colSpan:Mt,children:nt?.(e)})})]},i)},pn=(e,t)=>`group`in e?dn(e,t):fn(e,t),mn=(e,t)=>U?/* @__PURE__ */ h(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ h(`td`,{colSpan:Mt,style:{height:t}})},e):null,Q=V(0,`wui-expand-cell`),$=V(+!!L,`wui-select-cell`),hn=()=>Array.from({length:We},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ g(`tr`,{children:[L&&/* @__PURE__ */ h(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ h(`td`,{className:$.className,style:$.style}),v.map((e,t)=>/* @__PURE__ */ h(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:H(B+t,void 0),"data-label":k&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ h(i,{width:Re(e.align),height:12,radius:6})},e.key)),C&&/* @__PURE__ */ h(`td`,{children:/* @__PURE__ */ h(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ h(i,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ g(Te,{children:[/* @__PURE__ */ g(Pt?`wui-data-table`:`div`,{ref:Yt,...Pt?{class:kt,resizable:j?``:void 0,"view-key":gt||void 0,"data-wui-row-drag":O?``:void 0}:{className:kt,"data-wui-row-drag":O?``:void 0},style:jt,tabIndex:0,...ye,...bt,children:[/* @__PURE__ */ g(`table`,{className:St,"aria-label":Ye,"aria-rowcount":U?K.length+1:void 0,style:rt===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ h(`thead`,{children:/* @__PURE__ */ g(`tr`,{"aria-rowindex":U?1:void 0,children:[L&&/* @__PURE__ */ h(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ h(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&/* @__PURE__ */ h(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ h(`input`,{ref:Bt,type:`checkbox`,className:`wui-check`,checked:Rt,disabled:S,onChange:e=>Ut(e.target.checked),"aria-label":`Select all rows`})}),v.map((e,t)=>{let n=e.sortable?Ue:void 0,i=n!==void 0,a=He&&He.key===e.key,o=e.align===`num`||e.align===`end`,s=i&&/* @__PURE__ */ h(`span`,{className:`sort-icon${o?` wui-sort-lead`:``}`,children:/* @__PURE__ */ h(r,{name:`chevrons-up-down`,size:14})}),u=j&&t!==It,d=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ g(`th`,{className:V(B+t,(i?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(u?`wui-col-resizable `:``)+x(e.align)).className,style:H(B+t,d),"data-key":Pt?e.key:void 0,"aria-label":u&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:i?0:void 0,"aria-sort":a?He?.dir===`asc`?`ascending`:`descending`:i?`none`:void 0,onClick:n?()=>{S||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(ce(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),S||n(e.key))}:void 0,children:[o&&s,e.label,!o&&s,u&&/* @__PURE__ */ h(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":ee,"aria-valuemax":c,tabIndex:0,"aria-label":l.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&(Je?/* @__PURE__ */ h(`th`,{className:`wui-cell-end`,children:Je}):/* @__PURE__ */ h(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ h(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),/* @__PURE__ */ h(`tbody`,{ref:rn,children:S?hn():y?.length?/* @__PURE__ */ g(Te,{children:[mn(`before`,Y.before),K.slice(Y.start,Y.end).map((e,t)=>pn(e,Y.start+t)),mn(`after`,Y.after)]}):null}),Et&&!S&&y?.length>0&&/* @__PURE__ */ h(`tfoot`,{children:/* @__PURE__ */ g(`tr`,{children:[L&&/* @__PURE__ */ h(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ h(`td`,{className:$.className,style:$.style}),v.map((e,t)=>/* @__PURE__ */ h(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:H(B+t,void 0),children:e.footer?e.footer(y):null},e.key)),C&&/* @__PURE__ */ h(`td`,{})]})})]}),!S&&!y?.length&&/* @__PURE__ */ h(`div`,{className:`tbl-empty-block`,children:typeof Z==`string`?/* @__PURE__ */ h(`div`,{className:`tbl-empty-plain`,children:Z}):Z})]}),Be(w)&&/* @__PURE__ */ h(a,{page:w.page,totalPages:w.totalPages,total:w.total,pageSize:w.pageSize,onPageChange:S?Pe:w.setPage,onPageSizeChange:S?Pe:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode,summary:w.summary}),X&&/* @__PURE__ */ h(`div`,{ref:cn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{Ve as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppSkeleton.js";import a from"./AppTablePagination.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as c,COLUMN_MIN_WIDTH as ee,DATA_TABLE_TEXT as l,PIN_AT_VAR as u,PIN_SIDES as d,ROW_HEIGHTS as te,ROW_MOVE_LIMIT as ne,ROW_SAVE_ERROR_CLASS as re,attachRowDrag as ie,attachScrollEdges as ae,groupCount as oe,groupItems as se,isImeSafeEnter as ce,measureRows as le,pinAtValue as ue,pinClasses as de,planPins as fe,playRowMoves as pe,rowOrderChanged as me,saveOutcomeText as he,settledRows as ge,syncTargets as _e,virtualRange as ve}from"@webority/ui-elements/helpers";import{Children as ye,Fragment as be,isValidElement as xe,useCallback as Se,useEffect as f,useLayoutEffect as Ce,useMemo as we,useRef as p,useState as m}from"react";import{Fragment as Te,jsx as h,jsxs as g}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as Ee}from"@webority/theme/runtime";var De=()=>import(`@webority/ui-elements/elements/data-table`),Oe=[`comfortable`,`cozy`,`compact`],ke=[`auto`,`fixed`],Ae=[1,2,3,4];function _(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function je(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||xe(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function Me(e,t){return je(_(e,t),t)}var v=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},y=/* @__PURE__ */ new Set;function b(t,n){!y.has(t)&&v()&&(y.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Ne=100,Pe=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Fe=()=>{},Ie=()=>({total:0,keys:[]}),Le=[],Re=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function x(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function ze(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function Be(e){return e==null||e===``?`-`:Array.isArray(e)?ye.toArray(e):typeof e==`boolean`?String(e):e}function Ve(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function He(e){t(`wui-data-table`,De);let{marker:ye,props:xe}=n(`AppDataTable`,e),{columns:v,rows:y=Le,rowKey:He=Pe,sort:Ue,onSort:We,loading:S=!1,skeletonRows:Ge=5,empty:Ke=`No records found.`,emptyFiltered:qe,sourceCount:Je,rowActions:C,rowActionsLabel:Ye,pagination:w,ariaLabel:Xe,className:Ze=``,wrapperClassName:Qe=``,selectable:T=!1,selectedIds:E,isRowSelectable:$e,onToggleRow:et,onToggleAll:tt,onSelectRange:nt,renderExpanded:rt,density:D=`comfortable`,tableLayout:it=`auto`,striped:at=!1,flush:ot=!1,pad:st,nameLines:O,headerTone:ct,rowDrag:k=!1,maxHeight:lt,stickyFirstColumn:ut=!1,stickyActions:dt=!1,stackOnMobile:A=!1,hiddenColumns:ft,rowStatus:pt,rowHref:j,onRowClick:mt,activeRowKey:ht,hoverRowKey:gt,resizableColumns:M=!1,viewKey:_t,groupBy:N,groupLabel:vt,virtual:P=!1,rowSaving:F,rowSaveError:I,...yt}=xe;s(`AppDataTable`,yt);let{style:bt,...xt}=yt,L=Se((e,t)=>{let n=He(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[He]),St=ft?.length?new Set(ft):null;v=St?v.filter(e=>!(e.hideable&&St.has(e.key))):v,o(`AppDataTable`,`density`,D,Oe),o(`AppDataTable`,`tableLayout`,it,ke),o(`AppDataTable`,`nameLines`,O,Ae);for(let e of v)o(`AppDataTable`,`column.pin`,e.pin,d);let Ct=[`table table-ledger`,D===`cozy`||D===`compact`?`wui-table-${D}`:``,at?`wui-table-striped`:``,ut?`wui-table-sticky-first`:``,dt?`wui-table-sticky-actions`:``,A?`wui-table-stack`:``,Ze].filter(Boolean).join(` `),R=typeof rt==`function`,[wt,Tt]=m(()=>/* @__PURE__ */ new Set),Et=e=>Tt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Dt=v.some(e=>typeof e.footer==`function`),z=typeof j==`function`||typeof mt==`function`,Ot=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),kt=(e,t)=>{if(Ot(t)||(mt&&mt(e),!j))return;let n=j(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},B=lt!==void 0,At=[`table-wrap`,B?`wui-table-scroll`:``,ot?`wui-table-flush`:``,Qe].filter(Boolean).join(` `),jt={maxHeight:B?lt:void 0,"--wui-table-pad":st!=null&&!ot?`${st}px`:void 0,"--wui-name-lines":P?`1`:O?.toString(),"--wui-table-header-bg":ct??void 0},Mt=Object.values(jt).some(e=>e!==void 0)||bt!==void 0?{...jt,...bt}:void 0,Nt=Math.max(1,v.length+ +!!C+ +!!T+ +!!R),Pt=v.some(e=>e.pin===`start`||e.pin===`end`),Ft=Pt||M||!!N||P,V=+!!R+ +!!T,It=Pt?fe([...R?[`lead`]:[],...T?[`lead`]:[],...v.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],H=(e,t=``)=>{let n=It[e];return n?{className:`${t.trim()} ${de(n)}`.trim(),style:{[u]:ue(n.side,n.ordinal)}}:{className:t,style:void 0}},U=(e,t)=>It[e]?{...t,...H(e).style}:t,Lt=v.length-1+ +!!C;_t&&!M&&b(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),P&&!B&&b(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),P&&(R||A)&&b(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),P&&O!==void 0&&O!==1&&b(`virtual-name-lines`,"`nameLines` is ignored with `virtual`: a virtual table shows one line per name."),!P&&y?.length>500&&b(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let W=P&&B&&!R&&!A&&!S&&y?.length>0,G=(e,t)=>!$e||!!$e(e,t),Rt=T&&y?y.reduce((e,t,n)=>e+ +!!G(t,n),0):0,K=T&&y?y.reduce((e,t,n)=>e+(G(t,n)&&E?.has(L(t,n))?1:0),0):0,zt=Rt>0&&K===Rt,Bt=K>0&&!zt,Vt=e=>{e&&(e.indeterminate=Bt)},Ht=p(null),Ut=(e,t)=>{let n=Ht.current;Ht.current=e;let r=t&&n!==null?y.findIndex((e,t)=>L(e,t)===n):-1,i=y.findIndex((t,n)=>L(t,n)===e);if(r<0||i<0||r===i){et?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=y.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>G(e,t)).map(([e,t])=>L(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(nt)nt(s,a);else for(let e of s)et?.(e)},Wt=e=>{$e?(y||[]).forEach((t,n)=>{let r=L(t,n);G(t,n)&&(E?.has(r)||!1)!==e&&et?.(r)}):tt?.(e)},[Gt,Kt]=m(()=>/* @__PURE__ */ new Set),qt=e=>Kt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),q=we(()=>{let e=(y||[]).map((e,t)=>({row:e,i:t}));return N?se(e,({row:e})=>String(_(e,N)??``)).flatMap(e=>[{group:e,open:!Gt.has(e.key)},...Gt.has(e.key)?[]:e.items]):e},[y,N,Gt]),Jt=p(null),[J,Yt]=m(null),Xt=Se(e=>{Jt.current=e,Yt(e)},[]),Zt=p(null);f(()=>{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;Zt.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(Zt.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=ae(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[J]),f(()=>{if(!k||!J)return;let e=ie(J);return _e(document),e},[k,J]);let Qt=p(Ie);Ce(()=>{Qt.current=()=>({total:y?.length??0,keys:y?y.flatMap((e,t)=>{let n=L(e,t);return G(e,t)&&E?.has(n)?[String(n)]:[]}):[]})});let $t=p(!1);f(()=>{if(!$t.current&&($t.current=!0,K===0))return;let{total:e,keys:t}=Qt.current();Jt.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:K,total:e,keys:t}}))},[K]);let[en,tn]=m({top:0,height:0}),[Y,nn]=m(te[D]??te.comfortable);f(()=>{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};tn(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 rn=p(null);Ce(()=>{if(!W){rn.current=null;return}let e=`${D}:${y?.length??0}`;if(rn.current===e)return;rn.current=e;let t=(Jt.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;t!==void 0&&t>0&&Math.abs(t-Y)>.5&&nn(t)});let X={start:0,end:q.length,before:0,after:0};if(W){X=ve({scrollTop:en.top,viewport:en.height||Number.parseFloat(String(lt))||0,rowHeight:Y,count:q.length});let e=Zt.current;e!==null&&e>=0&&e<q.length&&(e<X.start&&X.start-e<=Ne&&(X={...X,start:e,before:e*Y}),e>=X.end&&e-X.end<Ne&&(X={...X,end:e+1,after:(q.length-e-1)*Y}))}let an=p(null),on=p(null),sn=p(null),cn=!P&&!S&&y?.length>0&&y.length<=ne;Ce(()=>{let e=an.current;if(!cn||!e){on.current=null,sn.current=null;return}let t=y.map((e,t)=>L(e,t));me(sn.current,t)&&pe(e.rows,on.current),on.current=le(e.rows),sn.current=t});let Z=typeof F==`function`||typeof I==`function`,ln=p(null),un=p(null),dn=v[0]?.key;f(()=>{if(!Z){un.current=null;return}let e=/* @__PURE__ */ new Map;(y||[]).forEach((t,n)=>{let r=dn===void 0?void 0:_(t,dn),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(L(t,n),{...Re(t,F,I),label:i})});let t=he(ge(un.current,e));un.current=e,t&&ln.current&&(ln.current.textContent=t)},[y,F,I,L,Z,dn]);let fn=qe!==void 0&&(Je===void 0||Je>0)?qe:Ke,pn=({group:e,open:t},n)=>{let i=_(e.items[0]?.row,N??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ h(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":W?n+2:void 0,children:/* @__PURE__ */ h(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:Nt,children:/* @__PURE__ */ g(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>qt(e.key),children:[/* @__PURE__ */ h(r,{name:`chevron-down`,size:16}),/* @__PURE__ */ h(`span`,{className:`wui-group-label`,children:vt?vt(i,a):Be(je(i,N??``))}),/* @__PURE__ */ h(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:oe(e.items.length)}),/* @__PURE__ */ h(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${l.rows(e.items.length)}`})]})})},`group:${e.key}`)},mn=({row:e,i:t},n)=>{let i=L(e,t),a=R&&wt.has(i),o=ht!=null&&String(ht)===String(i),s=gt!=null&&String(gt)===String(i),c=String(i).replace(/[^a-z0-9]/gi,`_`),ee=H(0,`wui-expand-cell`),l=H(+!!R,`wui-select-cell`),u=Z?Re(e,F,I):null,d=G(e,t);return/* @__PURE__ */ g(be,{children:[/* @__PURE__ */ g(`tr`,{className:[T&&d&&E?.has(i)?`is-selected`:``,z?`wui-row-link`:``,o?`wui-row-active`:``,s?Ee.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":W?n+2:void 0,"aria-busy":u?.state===`saving`?`true`:void 0,"data-wui-save-state":u?.state||void 0,"data-status":pt?.(e)||void 0,"data-href":j?.(e)||void 0,"data-row-key":k?String(i):void 0,tabIndex:z?0:void 0,onClick:z?t=>kt(e,t):void 0,onAuxClick:z&&j?t=>t.button===1&&kt(e,t):void 0,onKeyDown:z?t=>{ce(t.nativeEvent)&&t.target===t.currentTarget&&kt(e,t)}:void 0,children:[R&&/* @__PURE__ */ h(`td`,{className:ee.className,style:ee.style,children:/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-expand-toggle${a?` is-open`:``}`,"aria-expanded":a,"aria-controls":a?`${c}-expanded`:void 0,"aria-label":a?`Collapse row`:`Expand row`,onClick:()=>Et(i),children:/* @__PURE__ */ h(r,{name:`chevron-down`,size:16})})}),T&&/* @__PURE__ */ h(`td`,{className:l.className,style:l.style,children:/* @__PURE__ */ h(`input`,{type:`checkbox`,className:`wui-check`,checked:d&&(E?.has(i)||!1),disabled:!d,onChange:e=>Ut(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),v.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ g(r,{scope:t.rowHeader?`row`:void 0,className:H(V+n,(n===0?`wui-name-cell `:``)+(t.rowHeader?`wui-row-header `:``)+(t.nowrap?`text-nowrap `:``)+x(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:U(V+n,t.cellStyle),"data-label":A&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):Be(Me(e,t.key)),n===0&&u?.state===`error`&&/* @__PURE__ */ h(`span`,{className:re,children:u.message})]},t.key)}),C&&/* @__PURE__ */ h(`td`,{children:/* @__PURE__ */ h(`div`,{className:`u-row-actions`,children:C(e)})})]}),a&&/* @__PURE__ */ h(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ h(`td`,{id:`${c}-expanded`,colSpan:Nt,children:rt?.(e)})})]},i)},hn=(e,t)=>`group`in e?pn(e,t):mn(e,t),gn=(e,t)=>W?/* @__PURE__ */ h(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ h(`td`,{colSpan:Nt,style:{height:t}})},e):null,Q=H(0,`wui-expand-cell`),$=H(+!!R,`wui-select-cell`),_n=()=>Array.from({length:Ge},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ g(`tr`,{children:[R&&/* @__PURE__ */ h(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ h(`td`,{className:$.className,style:$.style}),v.map((e,t)=>/* @__PURE__ */ h(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:U(V+t,void 0),"data-label":A&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ h(i,{width:ze(e.align),height:12,radius:6})},e.key)),C&&/* @__PURE__ */ h(`td`,{children:/* @__PURE__ */ h(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ h(i,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ g(Te,{children:[/* @__PURE__ */ g(Ft?`wui-data-table`:`div`,{ref:Xt,...Ft?{class:At,resizable:M?``:void 0,"view-key":_t||void 0,"data-wui-row-drag":k?``:void 0}:{className:At,"data-wui-row-drag":k?``:void 0},style:Mt,tabIndex:0,...ye,...xt,children:[/* @__PURE__ */ g(`table`,{className:Ct,"aria-label":Xe,"aria-rowcount":W?q.length+1:void 0,style:it===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ h(`thead`,{children:/* @__PURE__ */ g(`tr`,{"aria-rowindex":W?1:void 0,children:[R&&/* @__PURE__ */ h(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ h(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&/* @__PURE__ */ h(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ h(`input`,{ref:Vt,type:`checkbox`,className:`wui-check`,checked:zt,disabled:S,onChange:e=>Wt(e.target.checked),"aria-label":`Select all rows`})}),v.map((e,t)=>{let n=e.sortable?We:void 0,i=n!==void 0,a=Ue&&Ue.key===e.key,o=e.align===`num`||e.align===`end`,s=i&&/* @__PURE__ */ h(`span`,{className:`sort-icon${o?` wui-sort-lead`:``}`,children:/* @__PURE__ */ h(r,{name:`chevrons-up-down`,size:14})}),u=M&&t!==Lt,d=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ g(`th`,{className:H(V+t,(i?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(u?`wui-col-resizable `:``)+x(e.align)).className,style:U(V+t,d),"data-key":Ft?e.key:void 0,"aria-label":u&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:i?0:void 0,"aria-sort":a?Ue?.dir===`asc`?`ascending`:`descending`:i?`none`:void 0,onClick:n?()=>{S||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(ce(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),S||n(e.key))}:void 0,children:[o&&s,e.label,!o&&s,u&&/* @__PURE__ */ h(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":ee,"aria-valuemax":c,tabIndex:0,"aria-label":l.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&(Ye?/* @__PURE__ */ h(`th`,{className:`wui-cell-end`,children:Ye}):/* @__PURE__ */ h(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ h(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),/* @__PURE__ */ h(`tbody`,{ref:an,children:S?_n():y?.length?/* @__PURE__ */ g(Te,{children:[gn(`before`,X.before),q.slice(X.start,X.end).map((e,t)=>hn(e,X.start+t)),gn(`after`,X.after)]}):null}),Dt&&!S&&y?.length>0&&/* @__PURE__ */ h(`tfoot`,{children:/* @__PURE__ */ g(`tr`,{children:[R&&/* @__PURE__ */ h(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ h(`td`,{className:$.className,style:$.style}),v.map((e,t)=>/* @__PURE__ */ h(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+x(e.align)).className,style:U(V+t,void 0),children:e.footer?e.footer(y):null},e.key)),C&&/* @__PURE__ */ h(`td`,{})]})})]}),!S&&!y?.length&&/* @__PURE__ */ h(`div`,{className:`tbl-empty-block`,children:typeof fn==`string`?/* @__PURE__ */ h(`div`,{className:`tbl-empty-plain`,children:fn}):fn})]}),Ve(w)&&/* @__PURE__ */ h(a,{page:w.page,totalPages:w.totalPages,total:w.total,pageSize:w.pageSize,onPageChange:S?Fe:w.setPage,onPageSizeChange:S?Fe:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode,summary:w.summary}),Z&&/* @__PURE__ */ h(`div`,{ref:ln,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{He as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/DiscardPrompt.js";import
|
|
1
|
+
import e from"../lib/DiscardPrompt.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{useEffect as o,useId as s,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`end`,`start`],p=[`sm`,`md`,`lg`,`xl`],m=[50,90],h=()=>import(`@webority/ui-elements/elements/drawer`),g=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function _(_){t(`wui-drawer`,h);let{marker:ee,props:te}=n(`AppDrawer`,_),{open:v=!1,onClose:y,title:b,titleIcon:x,header:S,subtitle:C,ariaLabel:w,side:T=`end`,size:E=`md`,width:D,maxWidth:O,snapPoints:k=m,defaultSnap:A=0,sheet:j=!0,onSnapChange:M,onOpened:N,onClosed:ne,dismissible:P=!0,closeLabel:F=`Close`,sheetHeightLabel:I=`Sheet height`,staticBackdrop:L=!0,confirmDiscard:R,dirty:z=!1,headerClassName:B=``,bodyClassName:V=``,footer:H,className:U=``,style:W,children:G,...K}=te;a(`AppDrawer`,K),i(`AppDrawer`,`side`,T,f),i(`AppDrawer`,`size`,E,p),i(`AppDrawer`,`snapPoints`,g(k)?void 0:JSON.stringify(k),[`an array of numbers from 10 to 100`]);let q=s(),J=b!=null&&b!==!1&&b!==``,Y=c(null),X=c({dirty:!1}),Z=c(null),[Q,$]=l(!1);X.current={onClose:y,onSnapChange:M,onOpened:N,onClosed:ne,confirmDiscard:R,dirty:z},o(()=>{v||$(!1)},[v]),o(()=>{Q&&Z.current?.focus()},[Q]),o(()=>{let e=Y.current;if(!e)return;let t=t=>{t.target===e&&(t.preventDefault(),X.current.confirmDiscard&&X.current.dirty?$(!0):X.current.onClose?.())},n=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-drawer> snap arrived without its index and percent.`);X.current.onSnapChange?.(t.detail.index,t.detail.percent)}},r=t=>{t.target===e&&X.current.onOpened?.()},i=t=>{t.target===e&&X.current.onClosed?.()};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i)}},[]);let re=()=>{$(!1),Y.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),X.current.onClose?.()},ie=g(k)?k:m,ae={...D&&{"--wui-drawer-width":D},...O&&{"--wui-drawer-max-width":O},...W};return/* @__PURE__ */ u(`wui-drawer`,{ref:Y,...ee,...K,class:[`wui-drawer`,U].filter(Boolean).join(` `),side:T,size:E,"snap-points":ie.join(`,`),"default-snap":String(A),static:L?``:void 0,"no-sheet":j?void 0:``,"no-dismiss":P?void 0:``,"confirm-discard":R||void 0,open:v?``:void 0,style:ae,children:/* @__PURE__ */ d(`dialog`,{className:`wui-drawer-panel`,"aria-label":w||void 0,"aria-labelledby":!w&&J&&S===void 0?q:void 0,children:[j&&/* @__PURE__ */ u(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:/* @__PURE__ */ u(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":I})}),S===void 0?/* @__PURE__ */ d(`div`,{className:[`wui-drawer-header`,B].filter(Boolean).join(` `),"data-wui-drawer-grip":j?``:void 0,children:[/* @__PURE__ */ d(`div`,{className:`wui-drawer-headtext`,children:[J&&/* @__PURE__ */ d(`div`,{className:`wui-drawer-title`,id:q,children:[x&&/* @__PURE__ */ u(`span`,{className:`wui-drawer-title-ic`,children:/* @__PURE__ */ u(r,{name:x,size:18})}),b]}),C&&/* @__PURE__ */ u(`div`,{className:`wui-drawer-subtitle`,children:C})]}),P&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-dismiss":``,"aria-label":F,children:/* @__PURE__ */ u(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ u(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):S,/* @__PURE__ */ u(`div`,{className:[`wui-drawer-body`,V].filter(Boolean).join(` `),children:G}),(H||Q)&&/* @__PURE__ */ d(`div`,{className:Q?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[Q&&/* @__PURE__ */ u(e,{text:R,confirmRef:Z,onDiscard:re,onKeep:()=>$(!1)}),H]})]})})}export{_ as default};
|