@webority/ui-react 0.163.0 → 0.165.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.
Files changed (153) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/dist/canvas-kit/kit.js +212 -212
  4. package/dist/canvas-kit/manifest.json +1127 -389
  5. package/dist/canvas-kit/release.json +6 -6
  6. package/dist/components/AppAccountSwitcher.js +1 -1
  7. package/dist/components/AppAlert.js +1 -1
  8. package/dist/components/AppAsyncBlock.js +1 -1
  9. package/dist/components/AppBreadcrumbs.js +1 -1
  10. package/dist/components/AppButton.js +1 -1
  11. package/dist/components/AppCard.js +1 -1
  12. package/dist/components/AppChartCard.js +1 -1
  13. package/dist/components/AppChoiceChip.js +1 -1
  14. package/dist/components/AppCodeBlock.js +1 -1
  15. package/dist/components/AppColorField.js +1 -1
  16. package/dist/components/AppCommentThread.js +1 -1
  17. package/dist/components/AppContextMenu.js +1 -1
  18. package/dist/components/AppDataTable.js +1 -1
  19. package/dist/components/AppDatePicker.js +1 -1
  20. package/dist/components/AppDateRangePicker.js +1 -1
  21. package/dist/components/AppDescriptions.js +1 -1
  22. package/dist/components/AppDrawer.js +1 -1
  23. package/dist/components/AppDropZone.js +1 -1
  24. package/dist/components/AppDropdown.js +1 -1
  25. package/dist/components/AppDueDate.js +1 -1
  26. package/dist/components/AppEntryGrid.js +1 -0
  27. package/dist/components/AppFileAttachment.js +1 -1
  28. package/dist/components/AppFilePicker.js +1 -1
  29. package/dist/components/AppFileViewer.js +1 -1
  30. package/dist/components/AppFilterBar.js +1 -1
  31. package/dist/components/AppFloatingButton.js +1 -1
  32. package/dist/components/AppForm.js +1 -1
  33. package/dist/components/AppFormulaSteps.js +1 -0
  34. package/dist/components/AppHoverCard.js +1 -1
  35. package/dist/components/AppImagePicker.js +1 -1
  36. package/dist/components/AppInlineEdit.js +1 -1
  37. package/dist/components/AppInput.js +1 -1
  38. package/dist/components/AppMarkdown.js +1 -1
  39. package/dist/components/AppMentionInput.js +1 -1
  40. package/dist/components/AppMetricStrip.js +1 -1
  41. package/dist/components/AppModal.js +1 -1
  42. package/dist/components/AppNotificationCenter.js +1 -1
  43. package/dist/components/AppNumberInput.js +1 -1
  44. package/dist/components/AppOtpInput.js +1 -1
  45. package/dist/components/AppPageHeader.js +1 -1
  46. package/dist/components/AppPhoneNumberInput.js +1 -1
  47. package/dist/components/AppPopover.js +1 -1
  48. package/dist/components/AppRadioGroup.js +1 -1
  49. package/dist/components/AppRating.js +1 -1
  50. package/dist/components/AppRichText.js +1 -1
  51. package/dist/components/AppRowActions.js +1 -0
  52. package/dist/components/AppScoreScale.js +1 -1
  53. package/dist/components/AppSearch.js +1 -1
  54. package/dist/components/AppSectionFeatures.js +1 -1
  55. package/dist/components/AppSectionLogos.js +1 -1
  56. package/dist/components/AppSelect.js +1 -1
  57. package/dist/components/AppShell.js +1 -1
  58. package/dist/components/AppSlider.js +1 -1
  59. package/dist/components/AppSparkline.js +1 -1
  60. package/dist/components/AppTextarea.js +1 -1
  61. package/dist/components/AppThemeToggle.js +1 -1
  62. package/dist/components/AppTimePicker.js +1 -1
  63. package/dist/components/AppToast.js +1 -1
  64. package/dist/components/AppTooltip.js +1 -1
  65. package/dist/components/AppWhatsNew.js +1 -1
  66. package/dist/components/AppWorkspaceSwitcher.js +1 -1
  67. package/dist/components/warnUnknownProps.js +1 -1
  68. package/dist/guidance.json +216 -141
  69. package/dist/hookForm/index.js +1 -0
  70. package/dist/lib/CheckField.js +1 -1
  71. package/dist/lib/formFields.js +1 -0
  72. package/dist/lib/indianGrouping.js +1 -0
  73. package/dist/lib/unsavedText.js +1 -0
  74. package/dist/lib/useOverlayRoot.js +1 -0
  75. package/dist/types/components/AppAccordion.d.ts +1 -1
  76. package/dist/types/components/AppAlert.d.ts +1 -1
  77. package/dist/types/components/AppAsyncBlock.d.ts +3 -3
  78. package/dist/types/components/AppBreadcrumbs.d.ts +6 -0
  79. package/dist/types/components/AppCard.d.ts +1 -1
  80. package/dist/types/components/AppChart.d.ts +12 -4
  81. package/dist/types/components/AppChip.d.ts +2 -2
  82. package/dist/types/components/AppCodeBlock.d.ts +1 -1
  83. package/dist/types/components/AppCommandPalette.d.ts +2 -2
  84. package/dist/types/components/AppDataTable.d.ts +32 -3
  85. package/dist/types/components/AppDateRangePicker.d.ts +4 -0
  86. package/dist/types/components/AppDescriptions.d.ts +7 -1
  87. package/dist/types/components/AppDrawer.d.ts +1 -1
  88. package/dist/types/components/AppDropdown.d.ts +7 -7
  89. package/dist/types/components/AppEntryGrid.d.ts +122 -0
  90. package/dist/types/components/AppFilePicker.d.ts +1 -1
  91. package/dist/types/components/AppFilterBar.d.ts +12 -1
  92. package/dist/types/components/AppFloatingDock.d.ts +2 -2
  93. package/dist/types/components/AppForm.d.ts +18 -0
  94. package/dist/types/components/AppFormActions.d.ts +1 -1
  95. package/dist/types/components/AppFormSection.d.ts +1 -1
  96. package/dist/types/components/AppFormulaSteps.d.ts +64 -0
  97. package/dist/types/components/AppIcon.d.ts +2 -2
  98. package/dist/types/components/AppInfoTip.d.ts +1 -1
  99. package/dist/types/components/AppInlineEdit.d.ts +5 -0
  100. package/dist/types/components/AppKpiTile.d.ts +1 -1
  101. package/dist/types/components/AppMeter.d.ts +1 -1
  102. package/dist/types/components/AppMetricStrip.d.ts +5 -0
  103. package/dist/types/components/AppModal.d.ts +9 -4
  104. package/dist/types/components/AppNumberInput.d.ts +7 -0
  105. package/dist/types/components/AppPageHeader.d.ts +5 -0
  106. package/dist/types/components/AppPopover.d.ts +3 -3
  107. package/dist/types/components/AppRequiredMark.d.ts +1 -1
  108. package/dist/types/components/AppResourceCard.d.ts +1 -1
  109. package/dist/types/components/AppResult.d.ts +2 -2
  110. package/dist/types/components/AppRowActions.d.ts +40 -0
  111. package/dist/types/components/AppScrollbar.d.ts +1 -1
  112. package/dist/types/components/AppSectionFeatures.d.ts +5 -1
  113. package/dist/types/components/AppSectionLogos.d.ts +1 -0
  114. package/dist/types/components/AppShell.d.ts +8 -6
  115. package/dist/types/components/AppSlider.d.ts +5 -0
  116. package/dist/types/components/AppSparkline.d.ts +3 -0
  117. package/dist/types/components/AppSpinner.d.ts +2 -2
  118. package/dist/types/components/AppSplash.d.ts +2 -2
  119. package/dist/types/components/AppTabs.d.ts +3 -3
  120. package/dist/types/components/AppToast.d.ts +6 -1
  121. package/dist/types/components/AppToolbar.d.ts +5 -5
  122. package/dist/types/components/AppTooltip.d.ts +5 -5
  123. package/dist/types/components/AppWorkspaceSwitcher.d.ts +3 -3
  124. package/dist/types/components/toastStore.d.ts +2 -2
  125. package/dist/types/components/warnUnknownProps.d.ts +3 -3
  126. package/dist/types/hookForm/index.d.ts +14 -0
  127. package/dist/types/index.d.ts +8 -6
  128. package/dist/types/lib/CheckField.d.ts +1 -1
  129. package/dist/types/lib/FieldMessage.d.ts +1 -1
  130. package/dist/types/lib/FileItemRow.d.ts +1 -1
  131. package/dist/types/lib/fileItem.d.ts +3 -3
  132. package/dist/types/lib/formFields.d.ts +12 -0
  133. package/dist/types/lib/indianGrouping.d.ts +2 -0
  134. package/dist/types/lib/unsavedText.d.ts +5 -0
  135. package/dist/types/lib/useOverlayRoot.d.ts +2 -0
  136. package/dist/ui-react.js +1 -1
  137. package/dist/web-core/dist/errors/extractApiError.js +2 -0
  138. package/dist/web-core/dist/errors/requestPlatform.js +1 -0
  139. package/package.json +21 -10
  140. package/dist/components/AppResizable.js +0 -1
  141. package/dist/components/AppResizableHandle.js +0 -1
  142. package/dist/components/AppResizablePanel.js +0 -1
  143. package/dist/components/AppRollingNumber.js +0 -1
  144. package/dist/components/AppRowSwitch.js +0 -1
  145. package/dist/lib/FocusPanel.js +0 -1
  146. package/dist/lib/pageScrollLock.js +0 -1
  147. package/dist/types/components/AppResizable.d.ts +0 -37
  148. package/dist/types/components/AppResizableHandle.d.ts +0 -14
  149. package/dist/types/components/AppResizablePanel.d.ts +0 -14
  150. package/dist/types/components/AppRollingNumber.d.ts +0 -30
  151. package/dist/types/components/AppRowSwitch.d.ts +0 -18
  152. package/dist/types/lib/FocusPanel.d.ts +0 -11
  153. package/dist/types/lib/pageScrollLock.d.ts +0 -1
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.163.0",
3
+ "version": "0.165.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.163.0"
9
+ "version": "0.165.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "81766bf1c45733bb35f4a420eff42bc5d5f27fe4380c848b0747e1e09c60e0ce",
14
- "bytes": 1015716
13
+ "sha256": "2f537f16e2cbb1d06d5ec51f85e70b1d1eba5029563865e82d7f3b106eb669d3",
14
+ "bytes": 1042782
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "f4992b08b83732f02ce17a4a5bb582af351578cd43fe627b77d77fe88011029d",
18
- "bytes": 9848128
17
+ "sha256": "bf46fab10ca47396c9d1c2af0ca9593e40f26863377ef94623cc81e384b842ff",
18
+ "bytes": 9843469
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{Dropdown as i}from"react-bootstrap";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s(t){let{marker:n,props:i}=e(`AppAccountSwitcher`,t),{accounts:s=[],currentId:l,onSelect:u,label:d=`Switch account`,linkComponent:f,...p}=i;if(r(`AppAccountSwitcher`,p),s.length===0)return null;let m=s.find(e=>e.id===l)??s[0];if(!m)throw Error(`AppAccountSwitcher: no account to mark as current`);return/* @__PURE__ */ o(`div`,{className:`wui-account-switcher`,role:`group`,"aria-label":d,...n,children:[/* @__PURE__ */ a(`div`,{className:`wui-account-switcher-label`,children:d}),/* @__PURE__ */ a(`div`,{className:`wui-account-switcher-list`,children:s.map(e=>/* @__PURE__ */ a(c,{account:e,current:e.id===m.id,onSelect:u,linkComponent:f},e.id))})]})}function c({account:e,current:r,onSelect:s,linkComponent:c}){let{id:l,name:u,description:d,photo:f,badge:p,href:m}=e,h=m?c??`a`:`button`,g=m?c?{to:m}:{href:m}:{type:`button`,onClick:()=>s?.(e)};return/* @__PURE__ */ o(i.Item,{as:h,className:`wui-account-switcher-option${r?` is-active`:``}`,"data-account-id":l,"aria-current":r?`true`:void 0,...g,children:[/* @__PURE__ */ a(t,{name:u,src:f,size:`md`,tone:`auto`}),/* @__PURE__ */ o(`span`,{className:`wui-account-switcher-option-text`,children:[/* @__PURE__ */ a(`span`,{className:`wui-account-switcher-option-name`,children:u}),d?/* @__PURE__ */ a(`span`,{className:`wui-account-switcher-option-note`,children:d}):null]}),p?/* @__PURE__ */ a(`span`,{className:`wui-account-switcher-badge`,children:p}):null,r?/* @__PURE__ */ a(n,{name:`check`,size:16,className:`wui-account-switcher-tick`}):null]})}export{s as default};
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{Alert as a}from"react-bootstrap";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";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,o){return i?/* @__PURE__ */ s(`span`,{className:`alert-icon alert-icon-image`,style:o!==void 0&&o>0?{width:o,height:o}:void 0,children:/* @__PURE__ */ s(`img`,{src:i,alt:a})}):e?typeof e==`string`?/* @__PURE__ */ s(`span`,{className:`alert-icon`,children:/* @__PURE__ */ s(n,{name:e,size:t,variant:r})}):/* @__PURE__ */ s(`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__ */ s(`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__ */ s(a,{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__ */ c(o,{children:[F&&m(P,z,b,S,C,w),/* @__PURE__ */ c(`div`,{className:`alert-content`,children:[L,_]}),I&&/* @__PURE__ */ s(`div`,{className:`alert-action`,children:j})]}):/* @__PURE__ */ c(o,{children:[L,_]})})}export{h as default};
1
+ import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";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{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppButton.js";import n from"./AppEmptyState.js";import r from"./AppProgress.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{jsx as o}from"react/jsx-runtime";function s(s){let{marker:c,props:l}=e(`AppAsyncBlock`,s),{state:u,children:d,empty:f,skeleton:p,className:m=``,loadingLabel:h=`Loading`,errorTitle:g=`Something went wrong`,retryLabel:_=`Retry`,emptyTitle:v=`Nothing to show yet`,...y}=l;a(`AppAsyncBlock`,y),i(`AppAsyncBlock`,`state.status`,u.status,[`idle`,`loading`,`error`,`empty`,`data`]);let b=`async-block${m?` ${m}`:``}`,x;switch(u.status){case`idle`:return null;case`loading`:x=p??/* @__PURE__ */ o(r,{value:0,indeterminate:!0,size:`sm`,label:h});break;case`error`:x=/* @__PURE__ */ o(n,{icon:`alert-circle`,title:g,description:u.error.message,action:/* @__PURE__ */ o(t,{variant:`soft`,onClick:()=>u.retry(),children:_})});break;case`empty`:x=f??/* @__PURE__ */ o(n,{icon:`inbox`,title:v});break;case`data`:x=d(u.data)}return/* @__PURE__ */ o(`div`,{className:b,"data-state":u.status,...c,...y,children:x})}export{s as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppButton.js";import n from"./AppEmptyState.js";import r from"./AppProgress.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{jsx as o}from"react/jsx-runtime";function s(s){let{marker:c,props:l}=e(`AppAsyncBlock`,s),{state:u,children:d,empty:f,skeleton:p,className:m=``,loadingLabel:h=`Loading`,errorTitle:g=`That didn't load`,retryLabel:_=`Try again`,emptyTitle:v=`Nothing here yet`,...y}=l;a(`AppAsyncBlock`,y),i(`AppAsyncBlock`,`state.status`,u.status,[`idle`,`loading`,`error`,`empty`,`data`]);let b=`async-block${m?` ${m}`:``}`,x;switch(u.status){case`idle`:return null;case`loading`:x=p??/* @__PURE__ */ o(r,{value:0,indeterminate:!0,size:`sm`,label:h});break;case`error`:x=/* @__PURE__ */ o(n,{icon:`alert-circle`,title:g,description:u.error.message,action:/* @__PURE__ */ o(t,{variant:`soft`,onClick:()=>u.retry(),children:_})});break;case`empty`:x=f??/* @__PURE__ */ o(n,{icon:`inbox`,title:v});break;case`data`:x=d(u.data)}return/* @__PURE__ */ o(`div`,{className:b,"data-state":u.status,...c,...y,children:x})}export{s 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{Breadcrumb as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";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`,...y}=p;a(`AppBreadcrumbs`,y);let b=s(d);if(_!==void 0&&(!Number.isInteger(_)||_<1))throw RangeError(`AppBreadcrumbs: maxItems must be a whole number of 1 or more.`);let x=_!==void 0&&m.length>_?m.length-_:0,S=m.slice(0,x).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}});return/* @__PURE__ */ u(c,{className:g||void 0,...x>0?{listProps:{className:`wui-breadcrumb-collapse`}}:{},...f,...y,children:[x>0?/* @__PURE__ */ l(`li`,{className:`breadcrumb-item wui-breadcrumb-more`,children:/* @__PURE__ */ l(r,{icon:`more-horizontal`,iconSize:14,label:v,align:`start`,toggleClassName:`wui-breadcrumb-more-toggle`,linkComponent:h,items:S})}):null,m.map((n,r)=>{let a=!b&&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__ */ u(c.Item,{active:a,className:r<x?`wui-breadcrumb-collapsible`:void 0,...s,children:[o,n.label]},n.key??`${n.label}-${r}`)})]})}export{d as BreadcrumbTrailContext,f as default};
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 c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{useContext as u,useRef as d,useState as te}from"react";import{Button as ne}from"react-bootstrap";import{jsx as f,jsxs as p}from"react/jsx-runtime";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)]),g={variant:null},_=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],v=e=>e===`pill`||e===`sharp`?`wui-btn-shape-${e}`:``;function y(e){return/* @__PURE__ */ p(`span`,{className:`wui-btn-roll`,children:[/* @__PURE__ */ f(`span`,{className:`wui-btn-roll__a`,children:e}),/* @__PURE__ */ f(`span`,{className:`wui-btn-roll__b`,"aria-hidden":`true`,children:e})]})}function oe(e,t,n,r){if(!e)return null;let i=n=>typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[t]??m.md,variant:r,className:n}):/* @__PURE__ */ f(`span`,{className:[`d-inline-flex`,n].filter(Boolean).join(` `),children:e});return/* @__PURE__ */ p(`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 b(e,t,n,r){if(!e)return null;let i=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[n]??m.md,variant:r,className:i}):/* @__PURE__ */ f(`span`,{className:`d-inline-flex ${i}`,children:e})}function se(e,t,n){return e?/* @__PURE__ */ f(`span`,{className:`wui-btn-pin-icon`,"aria-hidden":`true`,children:typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[t]??m.md,variant:n}):e}):null}function x(o){let{marker:x,props:ce}=ee(`AppButton`,o),{children:S,tone:C=`primary`,variant:w=`solid`,size:T=`md`,type:E=`button`,loading:D=!1,disabled:O=!1,block:k=!1,leftIcon:A=null,rightIcon:j=null,href:M,static:N=!1,tooltip:P,tooltipPlacement:F,shortcut:I,animation:L,pinRightIcon:R=!1,shape:z=`rounded`,iconVariant:B,className:V=``,onClick:H,onClickCapture:U,vibrate:W,...G}=ce,[le,K]=te(!1),q=d(!1),J=u(a),ue=J!==null&&E===`submit`&&J.submitting,Y=D||le||ue;c(`AppButton`,G),s(`AppButton`,`vibrate`,W,ae);let X=W===!0?10:typeof W==`number`&&Number.isInteger(W)&&W>=1&&W<=100?W:0;L!==void 0&&s(`AppButton`,`animation`,L,h);let Z=L===`roll`&&!N,Q=R&&j!=null&&j!==``&&!N&&!Y;if(s(`AppButton`,`tone`,C,i),s(`AppButton`,`variant`,w,r),s(`AppButton`,`size`,T,Object.keys(m)),s(`AppButton`,`shape`,z,re),s(`AppButton`,`type`,E,ie),B!==void 0&&s(`AppButton`,`iconVariant`,B,_),N){let t=[`btn`,e(C,w),T===`sm`?`btn-sm`:T===`lg`?`btn-lg`:T===`xl`?`btn-xl`:``,k?`w-100`:``,v(z),`btn-static`,V].filter(Boolean).join(` `);return l(/* @__PURE__ */ p(`span`,{className:t,...x,...G,children:[b(A,`left`,T,B),S,b(j,`right`,T,B)]}),P,F)}let de=[k?`w-100`:``,Y?`is-loading`:``,e(C,w),T===`xl`?`btn-xl`:``,L&&h.includes(L)?`btn-anim-${L}`:``,Q?`wui-btn-pin-end`:``,v(z),V].filter(Boolean).join(` `),$=(G.as===void 0||G.as===`button`)&&M===void 0&&G.to===void 0,fe=$?{}:{role:void 0,tabIndex:O||Y?-1:void 0},{as:pe,...me}=G,he={as:pe},ge=P!=null&&P!==``,_e=e=>{if(q.current)return;X&&!O&&!Y&&navigator.vibrate?.(X);let t=H?.(e);if(!(t instanceof Promise))return;q.current=!0,K(!0);let n=()=>{q.current=!1,K(!1)};t.then(n,e=>{throw n(),e})};return l(/* @__PURE__ */ p(ne,{type:$?E:void 0,href:M,...g,...T===`sm`||T===`lg`?{size:T}:null,disabled:O||Y,"aria-busy":Y||void 0,"aria-keyshortcuts":t(I),"data-wui-vibrate":X||void 0,className:de||void 0,onClick:_e,onClickCapture:O||Y?void 0:U,...fe,...x,...he,...me,children:[Y&&/* @__PURE__ */ f(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!Y&&b(A,`left`,T,B),Z?y(S):S,!Y&&(Z?oe(j,T,Q,B):Q?se(j,T,B):b(j,`right`,T,B)),!ge&&n(I)]}),P,F,I)}export{x as default};
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 i from"./warnUnknownProps.js";import{isImeSafeEnter as ee}from"@webority/ui-elements/helpers";import{useState as a}from"react";import{Card as o}from"react-bootstrap";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";var te=[`flat`,`elevated`,`outline`,`filled`,`accent`],ne={elevated:`card-elevated`,outline:`card-outlined`,filled:`card-muted`,accent:`card-accent`},re=[`primary`,`success`,`warning`,`danger`,`info`],u=[`none`,`sm`,`md`,`lg`],d=[`sans`,`serif`],ie={xs:320,sm:420,md:560,lg:720};function f(f){let{marker:p,props:m}=t(`AppCard`,f),{title:h,subtitle:g,headerIcon:_,titleClassName:v=``,titleFont:y=`sans`,header:b,headerExtra:x,headerActions:S,footer:C,media:w,children:T,variant:E=`flat`,tone:D=`primary`,padding:O=`md`,maxWidth:k,className:ae=``,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}=m,[U,W]=a(!1);i(`AppCard`,H),r(`AppCard`,`variant`,E,te),r(`AppCard`,`tone`,D,re),r(`AppCard`,`padding`,O,u),r(`AppCard`,`titleFont`,y,d);let{style:G,as:K,...q}=H,oe=I!=null||L!=null,se=[ne[E]??``,E===`accent`&&D&&D!==`primary`?`tone-${D}`:``,O&&O!==`md`?`card-pad-${O}`:``,P?`card-flush`:``,F?`card-divided`:``,N?`card-lifted`:``,k==null?``:`card-constrained`,oe?`card-clickable`:``,ae].filter(Boolean).join(` `)||void 0,J=k==null?void 0:ie[String(k)],Y=k==null?void 0:J==null?typeof k==`number`?`${k}px`:k:`${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=>{(ee(e.nativeEvent)||e.key===` `)&&(e.preventDefault(),L(e))}});let Z=B??typeof z==`function`,le=Z?/* @__PURE__ */ c(`button`,{type:`button`,className:`card-close`,"aria-label":V,onClick:e=>{e.preventDefault(),e.stopPropagation(),W(!0),z?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ c(n,{name:`x`,size:16})}):null,Q=h!=null||g!=null||_!=null,ue=b!=null||Q||x!=null||S!=null||Z,$=_==null?null:typeof _==`string`?/* @__PURE__ */ c(n,{name:_,size:18}):_;return U?null:/* @__PURE__ */ l(o,{className:se,style:ce,...p,...q,...K===void 0?null:{as:K},...X,children:[w!=null&&/* @__PURE__ */ c(`div`,{className:`card-media`,children:w}),ue&&/* @__PURE__ */ l(o.Header,{className:j||void 0,children:[b??/* @__PURE__ */ l(s,{children:[Q&&/* @__PURE__ */ l(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ c(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ l(`div`,{className:`card-header-titles`,children:[h!=null&&/* @__PURE__ */ c(`div`,{className:[`card-title`,v].filter(Boolean).join(` `),style:y===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:h}),g!=null&&/* @__PURE__ */ c(`div`,{className:`card-subtitle`,children:g})]})]}),x,S!=null&&/* @__PURE__ */ c(`div`,{className:`card-header-actions`,children:S})]}),le]}),M?/* @__PURE__ */ c(o.Body,{className:A||void 0,children:T}):T,C!=null&&/* @__PURE__ */ c(`div`,{className:`card-footer`,children:C})]})}export{f as default};
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{Dropdown as m}from"react-bootstrap";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";var v=e=>e instanceof HTMLElement,y=e=>{let t=e.querySelector(`wui-chart`);return t&&v(t)?t:null},b=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},x=!1;function S(){!x&&b()&&(x=!0,e("[@webority/ui-react] <AppChartCard> has no `title`, which is the card's heading and names its menu button."))}var C=e=>e.getAttribute(`view`)===`table`?`table`:`chart`,w=e=>e===`chart`||e===`table`;function T(e){let{marker:v,props:b}=n(`AppChartCard`,e),{title:x,subtitle:T,toolbar:E=!0,onRetry:D,footer:O,children:k,className:A=``,legendLabel:j=`Show legend`,legendTitle:M=`Show or hide the legend`,viewLabel:N=`View`,chartViewLabel:P=`Chart`,tableViewLabel:F=`Table`,moreActionsLabel:I=`More actions`,moreActionsForLabel:L=`More actions for {title}`,downloadPngLabel:R=`Download PNG`,downloadCsvLabel:z=`Download CSV`,retryLabel:B=`Try again`,...V}=b;l(`AppChartCard`,V),x||S();let H=f(null),U=f(null),[W,G]=p(`chart`),K=f(W);K.current=W;let[q,J]=p(!0),Y=()=>H.current?y(H.current):null;u(()=>{let e=H.current;if(!e)throw Error(`AppChartCard: the chart body is not mounted`);let t=()=>{let t=y(e);t&&(t===U.current?G(C(t)):(U.current=t,t.hasAttribute(`view`)?G(C(t)):K.current!==`chart`&&t.setAttribute(`view`,K.current)))};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`view`]}),()=>n.disconnect()},[]);let X=e=>{if(c(`AppChartCard`,`view`,e,[`chart`,`table`]),!w(e))throw TypeError(`[@webority/ui-react] <AppChartCard> received no view`);G(e),Y()?.setAttribute(`view`,e)},Z=d(()=>[{value:`chart`,label:P,icon:`chart`},{value:`table`,label:F,icon:`grid`}],[P,F]),Q=/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ g(`button`,{type:`button`,className:`topbar-icon-btn wui-chart-card-tool wui-chart-card-legend-tool`,"aria-pressed":q,"aria-label":j,title:M,onClick:()=>J(!q),children:/* @__PURE__ */ g(o,{name:`list`,size:16})}),/* @__PURE__ */ g(s,{size:`sm`,label:N,options:Z,value:W,onChange:X}),/* @__PURE__ */ _(a,{icon:`more-horizontal`,label:x?t(L,{title:x}):I,children:[/* @__PURE__ */ _(m.Item,{as:`button`,type:`button`,onClick:()=>Y()?.exportPng?.(),children:[/* @__PURE__ */ g(o,{name:`image`,size:16}),R]}),/* @__PURE__ */ _(m.Item,{as:`button`,type:`button`,onClick:()=>Y()?.exportCsv?.(),children:[/* @__PURE__ */ g(o,{name:`download`,size:16}),z]})]})]}),$=[`wui-chart-card`,q?``:`wui-chart-card-legend-off`,A].filter(Boolean).join(` `);return/* @__PURE__ */ _(i,{title:x,subtitle:T,headerActions:E?Q:void 0,footer:O,className:$,...v,...V,children:[/* @__PURE__ */ g(`div`,{ref:H,children:k}),D&&/* @__PURE__ */ g(`div`,{className:`wui-chart-card-retry`,children:/* @__PURE__ */ g(r,{variant:`outline`,size:`sm`,onClick:D,children:B})})]})}export{T as default};
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${v?` checked`:``}${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
+ 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/FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"../lib/fieldState.js";import n from"../lib/fillLabel.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{useId as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`sm`,`md`,`lg`];function p(p){let{marker:m,props:h}=r(`AppColorField`,p),{value:g,defaultValue:_,onChange:v,label:y,required:b=!1,optional:x=!1,error:S,helperText:C,help:w,helpLabel:T=`More information`,colourLabel:E=`Colour`,colourPickerLabel:D=`{label}, colour picker`,optionalLabel:O=`(optional)`,name:k,id:A,disabled:j=!1,readOnly:M=!1,loading:N=!1,size:P=`md`,className:F=``,fieldClassName:I=``,...L}=h;s(`AppColorField`,L),o(`AppColorField`,`size`,P,f);let[R,z]=l(_??`#000000`),B=g===void 0?R:g,V=e=>{z(e),v?.(e)},H=c(),U=A||H,W=S?`${U}-error`:C?`${U}-hint`:void 0,G=e=>/^#[0-9a-f]{6}$/i.test(e),K=P===`sm`?` color-field-sm`:P===`lg`?` color-field-lg`:``,q=P===`sm`?` input-sm`:P===`lg`?` input-lg`:``;return/* @__PURE__ */ d(`div`,{...m,className:`field${I?` ${I}`:``}`,children:[y&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:U,children:[y,x&&!b&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${O}`}),b&&/* @__PURE__ */ u(a,{}),w&&/* @__PURE__ */ u(i,{label:T,children:w})]}),/* @__PURE__ */ d(`div`,{className:`color-field${K}`,children:[/* @__PURE__ */ u(`input`,{type:`color`,className:`color-field-swatch`,value:G(B)?B:`#000000`,onChange:e=>V(e.target.value),disabled:j||M||N,"aria-label":n(D,{label:y||E}),tabIndex:-1}),/* @__PURE__ */ u(`input`,{type:`text`,className:`input color-field-hex${q}${S?` error`:``}${N?` ${t}`:``}${F?` ${F}`:``}`,id:U,name:k,value:B,onChange:e=>V(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:b,disabled:j,readOnly:M||N,"aria-busy":N||void 0,"aria-invalid":S?`true`:`false`,"aria-describedby":W,...L})]}),/* @__PURE__ */ u(e,{error:S,hint:C,errorId:`${U}-error`,hintId:`${U}-hint`})]})}export{p as default};
1
+ import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"../lib/fieldState.js";import n from"../lib/fillLabel.js";import{useFieldError as r}from"../lib/formFields.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{useId as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`sm`,`md`,`lg`];function m(m){let{marker:h,props:g}=i(`AppColorField`,m),{value:_,defaultValue:v,onChange:y,label:b,required:x=!1,optional:S=!1,error:C,helperText:w,help:T,helpLabel:E=`More information`,colourLabel:D=`Colour`,colourPickerLabel:O=`{label}, colour picker`,optionalLabel:k=`(optional)`,name:A,id:j,disabled:M=!1,readOnly:N=!1,loading:P=!1,size:F=`md`,className:I=``,fieldClassName:L=``,...R}=g,z=r(A),B=C??z;c(`AppColorField`,R),s(`AppColorField`,`size`,F,p);let[V,H]=u(v??`#000000`),U=_===void 0?V:_,W=e=>{H(e),y?.(e)},G=l(),K=j||G,q=B?`${K}-error`:w?`${K}-hint`:void 0,J=e=>/^#[0-9a-f]{6}$/i.test(e),Y=F===`sm`?` color-field-sm`:F===`lg`?` color-field-lg`:``,X=F===`sm`?` input-sm`:F===`lg`?` input-lg`:``;return/* @__PURE__ */ f(`div`,{...h,className:`field${L?` ${L}`:``}`,children:[b&&/* @__PURE__ */ f(`label`,{className:`label`,htmlFor:K,children:[b,S&&!x&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${k}`}),x&&/* @__PURE__ */ d(o,{}),T&&/* @__PURE__ */ d(a,{label:E,children:T})]}),/* @__PURE__ */ f(`div`,{className:`color-field${Y}`,children:[/* @__PURE__ */ d(`input`,{type:`color`,className:`color-field-swatch`,value:J(U)?U:`#000000`,onChange:e=>W(e.target.value),disabled:M||N||P,"aria-label":n(O,{label:b||D}),tabIndex:-1}),/* @__PURE__ */ d(`input`,{type:`text`,className:`input color-field-hex${X}${B?` error`:``}${P?` ${t}`:``}${I?` ${I}`:``}`,id:K,name:A,value:U,onChange:e=>W(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:x,disabled:M,readOnly:N||P,"aria-busy":P||void 0,"aria-invalid":B?`true`:`false`,"aria-describedby":q,...R})]}),/* @__PURE__ */ d(e,{error:B,hint:w,errorId:`${K}-error`,hintId:`${K}-hint`})]})}export{m 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"./AppInfoTip.js";import a from"./AppRowActions.js";import o from"./AppSkeleton.js";import s from"./AppTablePagination.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{COLUMN_MAX_WIDTH as ee,COLUMN_MIN_WIDTH as te,DATA_TABLE_TEXT as u,PIN_AT_VAR as d,PIN_SIDES as ne,ROW_HEIGHTS as f,ROW_MOVE_LIMIT as re,ROW_SAVE_ERROR_CLASS as ie,attachRowDrag as ae,attachScrollEdges as oe,groupCount as se,groupItems as ce,isImeSafeEnter as le,measureRows as ue,pinAtValue as de,pinClasses as fe,planPins as pe,playRowMoves as me,rowOrderChanged as he,saveOutcomeText as ge,settledRows as _e,syncTargets as ve,virtualRange as ye}from"@webority/ui-elements/helpers";import{Children as be,Fragment as xe,isValidElement as Se,useCallback as Ce,useEffect as p,useLayoutEffect as we,useMemo as Te,useRef as m,useState as h}from"react";import{Fragment as Ee,jsx as g,jsxs as _}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as De}from"@webority/theme/runtime";var Oe=()=>import(`@webority/ui-elements/elements/data-table`),ke=[`comfortable`,`cozy`,`compact`],Ae=[`auto`,`fixed`],je=[1,2,3,4];function v(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function Me(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`||Se(e)||Array.isArray(e))return e;throw Error(`AppDataTable: the value under "${t}" is not renderable; give that column a render function.`)}function Ne(e,t){return Me(v(e,t),t)}var y=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},b=/* @__PURE__ */ new Set;function x(t,n){!b.has(t)&&y()&&(b.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var Pe=100,Fe=e=>{let t=typeof e==`object`&&e&&`id`in e?e.id:void 0;return typeof t==`string`||typeof t==`number`?t:void 0},Ie=()=>{},Le=()=>({total:0,keys:[]}),Re=[],ze=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function Be(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function Ve(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function He(e){return e==null||e===``?`-`:Array.isArray(e)?be.toArray(e):typeof e==`boolean`?String(e):e}function Ue(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function We(e){t(`wui-data-table`,Oe);let{marker:be,props:Se}=n(`AppDataTable`,e),{columns:y,rows:b=Re,rowKey:We=Fe,sort:Ge,onSort:Ke,loading:S=!1,refreshing:qe=!1,skeletonRows:Je=5,empty:Ye=`No records found.`,emptyFiltered:Xe,sourceCount:Ze,rowActions:C,linkComponent:Qe,rowActionsLabel:$e,pagination:w,ariaLabel:et,className:tt=``,wrapperClassName:nt=``,selectable:T=!1,selectedIds:E,isRowSelectable:rt,onToggleRow:it,onToggleAll:at,onSelectRange:ot,renderExpanded:st,singleExpand:ct=!1,density:D=`comfortable`,tableLayout:lt=`auto`,striped:ut=!1,flush:dt=!1,pad:ft,nameLines:O,headerTone:pt,rowDrag:k=!1,maxHeight:mt,stickyFirstColumn:ht=!1,stickyActions:gt=!1,equalActions:_t=!1,linkFirstColumn:vt=!1,stackOnMobile:A=!1,hiddenColumns:yt,rowStatus:bt,rowHref:j,onRowClick:xt,activeRowKey:St,hoverRowKey:Ct,resizableColumns:M=!1,viewKey:wt,groupBy:N,groupLabel:Tt,virtual:P=!1,rowSaving:F,rowSaveError:I,...Et}=Se;l(`AppDataTable`,Et);let{style:Dt,...Ot}=Et,L=Ce((e,t)=>{let n=We(e,t);if(n==null)throw Error(`AppDataTable: a row has no key. Pass rowKey, or give every row an id.`);return n},[We]),kt=yt?.length?new Set(yt):null;y=kt?y.filter(e=>!(e.hideable&&kt.has(e.key))):y,c(`AppDataTable`,`density`,D,ke),c(`AppDataTable`,`tableLayout`,lt,Ae),c(`AppDataTable`,`nameLines`,O,je);for(let e of y)c(`AppDataTable`,`column.pin`,e.pin,ne);let R=typeof j==`function`||typeof xt==`function`,At=[`table table-ledger`,D===`cozy`||D===`compact`?`wui-table-${D}`:``,ut?`wui-table-striped`:``,ht?`wui-table-sticky-first`:``,gt?`wui-table-sticky-actions`:``,_t?`wui-table-equal-actions`:``,A?`wui-table-stack`:``,vt&&R?`wui-table-link-first`:``,tt].filter(Boolean).join(` `),z=typeof st==`function`,[jt,Mt]=h(()=>/* @__PURE__ */ new Set),Nt=e=>Mt(t=>{if(t.has(e)){let n=new Set(t);return n.delete(e),n}return ct?/* @__PURE__ */ new Set([e]):new Set(t).add(e)}),Pt=y.some(e=>typeof e.footer==`function`),Ft=e=>!!(e.target instanceof Element&&e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`)),It=(e,t)=>{if(Ft(t)||(xt&&xt(e),!j))return;let n=j(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},Lt=mt!==void 0,Rt=qe&&!S&&b.length>0,zt=[`table-wrap`,Lt?`wui-table-scroll`:``,dt?`wui-table-flush`:``,Rt?`wui-table-refreshing`:``,nt].filter(Boolean).join(` `),Bt={maxHeight:Lt?mt:void 0,"--wui-table-pad":ft!=null&&!dt?`${ft}px`:void 0,"--wui-name-lines":P?`1`:O?.toString(),"--wui-table-header-bg":pt??void 0},Vt=Object.values(Bt).some(e=>e!==void 0)||Dt!==void 0?{...Bt,...Dt}:void 0,Ht=Math.max(1,y.length+ +!!C+ +!!T+ +!!z),Ut=y.some(e=>e.pin===`start`||e.pin===`end`),Wt=Ut||M||!!N||P,B=+!!z+ +!!T,Gt=Ut?pe([...z?[`lead`]:[],...T?[`lead`]:[],...y.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...C?[null]:[]]):[],V=(e,t=``)=>{let n=Gt[e];return n?{className:`${t.trim()} ${fe(n)}`.trim(),style:{[d]:de(n.side,n.ordinal)}}:{className:t,style:void 0}},H=(e,t)=>Gt[e]?{...t,...V(e).style}:t,Kt=y.length-1+ +!!C;wt&&!M&&x(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),P&&!Lt&&x(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),P&&(z||A)&&x(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),P&&O!==void 0&&O!==1&&x(`virtual-name-lines`,"`nameLines` is ignored with `virtual`: a virtual table shows one line per name."),vt&&!R&&x(`link-first-column`,"`linkFirstColumn` needs rowHref or onRowClick: the row is what opens."),ct&&typeof st!=`function`&&x(`single-expand`,"`singleExpand` needs renderExpanded: there are no rows to expand."),!P&&b?.length>500&&x(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let U=P&&Lt&&!z&&!A&&!S&&b?.length>0,W=(e,t)=>!rt||!!rt(e,t),qt=T&&b?b.reduce((e,t,n)=>e+ +!!W(t,n),0):0,G=T&&b?b.reduce((e,t,n)=>e+(W(t,n)&&E?.has(L(t,n))?1:0),0):0,Jt=qt>0&&G===qt,Yt=G>0&&!Jt,Xt=e=>{e&&(e.indeterminate=Yt)},Zt=m(null),Qt=(e,t)=>{let n=Zt.current;Zt.current=e;let r=t&&n!==null?b.findIndex((e,t)=>L(e,t)===n):-1,i=b.findIndex((t,n)=>L(t,n)===e);if(r<0||i<0||r===i){it?.(e);return}let a=!E?.has(e),o=Math.min(r,i),s=b.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>W(e,t)).map(([e,t])=>L(e,t)).filter(e=>(E?.has(e)||!1)!==a);if(ot)ot(s,a);else for(let e of s)it?.(e)},$t=e=>{rt?(b||[]).forEach((t,n)=>{let r=L(t,n);W(t,n)&&(E?.has(r)||!1)!==e&&it?.(r)}):at?.(e)},[en,tn]=h(()=>/* @__PURE__ */ new Set),nn=e=>tn(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),K=Te(()=>{let e=(b||[]).map((e,t)=>({row:e,i:t}));return N?ce(e,({row:e})=>String(v(e,N)??``)).flatMap(e=>[{group:e,open:!en.has(e.key)},...en.has(e.key)?[]:e.items]):e},[b,N,en]),rn=m(null),[q,an]=h(null),on=Ce(e=>{rn.current=e,an(e)},[]),sn=m(null);p(()=>{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;sn.current=t?Number(t)-2:null},r=t=>{t.relatedTarget instanceof Node&&e.contains(t.relatedTarget)||(sn.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=oe(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[q]),p(()=>{if(!k||!q)return;let e=ae(q);return ve(document),e},[k,q]);let cn=m(Le);we(()=>{cn.current=()=>({total:b?.length??0,keys:b?b.flatMap((e,t)=>{let n=L(e,t);return W(e,t)&&E?.has(n)?[String(n)]:[]}):[]})});let ln=m(!1);p(()=>{if(!ln.current&&(ln.current=!0,G===0))return;let{total:e,keys:t}=cn.current();rn.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:G,total:e,keys:t}}))},[G]);let[un,dn]=h({top:0,height:0}),[J,fn]=h(f[D]??f.comfortable);p(()=>{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};dn(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 pn=m(null);we(()=>{if(!U){pn.current=null;return}let e=`${D}:${b?.length??0}`;if(pn.current===e)return;pn.current=e;let t=(rn.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&&fn(t)});let Y={start:0,end:K.length,before:0,after:0};if(U){Y=ye({scrollTop:un.top,viewport:un.height||Number.parseFloat(String(mt))||0,rowHeight:J,count:K.length});let e=sn.current;e!==null&&e>=0&&e<K.length&&(e<Y.start&&Y.start-e<=Pe&&(Y={...Y,start:e,before:e*J}),e>=Y.end&&e-Y.end<Pe&&(Y={...Y,end:e+1,after:(K.length-e-1)*J}))}let mn=m(null),hn=m(null),gn=m(null),_n=!P&&!S&&b?.length>0&&b.length<=re;we(()=>{let e=mn.current;if(!_n||!e){hn.current=null,gn.current=null;return}let t=b.map((e,t)=>L(e,t));he(gn.current,t)&&me(e.rows,hn.current),hn.current=ue(e.rows),gn.current=t});let X=typeof F==`function`||typeof I==`function`,vn=m(null),yn=m(null),Z=y[0]?.key;p(()=>{if(!X){yn.current=null;return}let e=/* @__PURE__ */ new Map;(b||[]).forEach((t,n)=>{let r=Z===void 0?void 0:v(t,Z),i=typeof r==`string`||typeof r==`number`?String(r):``;e.set(L(t,n),{...ze(t,F,I),label:i})});let t=ge(_e(yn.current,e));yn.current=e,t&&vn.current&&(vn.current.textContent=t)},[b,F,I,L,X,Z]);let bn=Xe!==void 0&&(Ze===void 0||Ze>0)?Xe:Ye,xn=({group:e,open:t},n)=>{let i=v(e.items[0]?.row,N??``),a=e.items.map(e=>e.row);return/* @__PURE__ */ g(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":U?n+2:void 0,children:/* @__PURE__ */ g(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:Ht,children:/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>nn(e.key),children:[/* @__PURE__ */ g(r,{name:`chevron-down`,size:16}),/* @__PURE__ */ g(`span`,{className:`wui-group-label`,children:Tt?Tt(i,a):He(Me(i,N??``))}),/* @__PURE__ */ g(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:se(e.items.length)}),/* @__PURE__ */ g(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${u.rows(e.items.length)}`})]})})},`group:${e.key}`)},Sn=({row:e,i:t},n)=>{let i=L(e,t),o=z&&jt.has(i),s=St!=null&&String(St)===String(i),c=Ct!=null&&String(Ct)===String(i),l=String(i).replace(/[^a-z0-9]/gi,`_`),ee=V(0,`wui-expand-cell`),te=V(+!!z,`wui-select-cell`),u=X?ze(e,F,I):null,d=W(e,t),ne=C?.(e);if(C&&!Array.isArray(ne))throw TypeError(`AppDataTable: rowActions returns a list of actions ({ key, label, icon, onClick or href }). It returned something else: restate the buttons as a list, see node scripts/codemods/row-actions.mjs --check.`);let f=Z===void 0?void 0:v(e,Z),re=typeof f==`string`||typeof f==`number`?`More actions for ${f}`:`More actions`;return/* @__PURE__ */ _(xe,{children:[/* @__PURE__ */ _(`tr`,{className:[T&&d&&E?.has(i)?`is-selected`:``,R?`wui-row-link`:``,s?`wui-row-active`:``,c?De.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":s?`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":bt?.(e)||void 0,"data-href":j?.(e)||void 0,"data-row-key":k?String(i):void 0,tabIndex:R?0:void 0,onClick:R?t=>It(e,t):void 0,onAuxClick:R&&j?t=>t.button===1&&It(e,t):void 0,onKeyDown:R?t=>{le(t.nativeEvent)&&t.target===t.currentTarget&&It(e,t)}:void 0,children:[z&&/* @__PURE__ */ g(`td`,{className:ee.className,style:ee.style,children:/* @__PURE__ */ g(`button`,{type:`button`,className:`wui-expand-toggle${o?` is-open`:``}`,"aria-expanded":o,"aria-controls":o?`${l}-expanded`:void 0,"aria-label":o?`Collapse row`:`Expand row`,onClick:()=>Nt(i),children:/* @__PURE__ */ g(r,{name:`chevron-down`,size:16})})}),T&&/* @__PURE__ */ g(`td`,{className:te.className,style:te.style,children:/* @__PURE__ */ g(`input`,{type:`checkbox`,className:`wui-check`,checked:d&&(E?.has(i)||!1),disabled:!d,onChange:e=>Qt(i,e.nativeEvent instanceof MouseEvent&&e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),y.map((t,n)=>{let r=t.rowHeader?`th`:`td`;return/* @__PURE__ */ _(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 `:``)+Be(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:H(B+n,t.cellStyle),"data-label":A&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):He(Ne(e,t.key)),n===0&&u?.state===`error`&&/* @__PURE__ */ g(`span`,{className:ie,children:u.message})]},t.key)}),C&&/* @__PURE__ */ g(`td`,{children:/* @__PURE__ */ g(a,{items:ne??[],menuLabel:re,linkComponent:Qe})})]}),o&&/* @__PURE__ */ g(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ g(`td`,{id:`${l}-expanded`,colSpan:Ht,children:st?.(e)})})]},i)},Cn=(e,t)=>`group`in e?xn(e,t):Sn(e,t),wn=(e,t)=>U?/* @__PURE__ */ g(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ g(`td`,{colSpan:Ht,style:{height:t}})},e):null,Q=V(0,`wui-expand-cell`),$=V(+!!z,`wui-select-cell`),Tn=()=>Array.from({length:Je},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ _(`tr`,{children:[z&&/* @__PURE__ */ g(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ g(`td`,{className:$.className,style:$.style}),y.map((e,t)=>/* @__PURE__ */ g(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+Be(e.align)).className,style:H(B+t,void 0),"data-label":A&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ g(o,{width:Ve(e.align),height:12,radius:6})},e.key)),C&&/* @__PURE__ */ g(`td`,{children:/* @__PURE__ */ g(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ g(o,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ _(Ee,{children:[/* @__PURE__ */ _(Wt?`wui-data-table`:`div`,{ref:on,...Wt?{class:zt,resizable:M?``:void 0,"view-key":wt||void 0,"data-wui-row-drag":k?``:void 0,"aria-busy":Rt||void 0}:{className:zt,"data-wui-row-drag":k?``:void 0,"aria-busy":Rt||void 0},style:Vt,tabIndex:0,...be,...Ot,children:[/* @__PURE__ */ _(`table`,{className:At,"aria-label":et,"aria-rowcount":U?K.length+1:void 0,style:lt===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ g(`thead`,{children:/* @__PURE__ */ _(`tr`,{"aria-rowindex":U?1:void 0,children:[z&&/* @__PURE__ */ g(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:`Expand`})}),T&&/* @__PURE__ */ g(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ g(`input`,{ref:Xt,type:`checkbox`,className:`wui-check`,checked:Jt,disabled:S,onChange:e=>$t(e.target.checked),"aria-label":`Select all rows`})}),y.map((e,t)=>{let n=e.sortable?Ke:void 0,a=n!==void 0,o=Ge&&Ge.key===e.key,s=e.align===`num`||e.align===`end`,c=a&&/* @__PURE__ */ g(`span`,{className:`sort-icon${s?` wui-sort-lead`:``}`,children:/* @__PURE__ */ g(r,{name:`chevrons-up-down`,size:14})}),l=M&&t!==Kt,d=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ _(`th`,{className:V(B+t,(a?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(l?`wui-col-resizable `:``)+Be(e.align)).className,style:H(B+t,d),"data-key":Wt?e.key:void 0,"aria-label":l&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:a?0:void 0,"aria-sort":o?Ge?.dir===`asc`?`ascending`:`descending`:a?`none`:void 0,onClick:n?t=>{t.target instanceof Element&&t.target.closest(`.infotip`)||S||n(e.key)}:void 0,onKeyDown:n?t=>{t.target===t.currentTarget&&(le(t.nativeEvent)||t.key===` `)&&(t.preventDefault(),S||n(e.key))}:void 0,children:[s&&c,e.label,!s&&c,e.help?/* @__PURE__ */ g(i,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null,l&&/* @__PURE__ */ g(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":te,"aria-valuemax":ee,tabIndex:0,"aria-label":u.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),C&&($e?/* @__PURE__ */ g(`th`,{className:`wui-cell-end`,children:$e}):/* @__PURE__ */ g(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ g(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),/* @__PURE__ */ g(`tbody`,{ref:mn,children:S?Tn():b?.length?/* @__PURE__ */ _(Ee,{children:[wn(`before`,Y.before),K.slice(Y.start,Y.end).map((e,t)=>Cn(e,Y.start+t)),wn(`after`,Y.after)]}):null}),Pt&&!S&&b?.length>0&&/* @__PURE__ */ g(`tfoot`,{children:/* @__PURE__ */ _(`tr`,{children:[z&&/* @__PURE__ */ g(`td`,{className:Q.className,style:Q.style}),T&&/* @__PURE__ */ g(`td`,{className:$.className,style:$.style}),y.map((e,t)=>/* @__PURE__ */ g(`td`,{className:V(B+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+Be(e.align)).className,style:H(B+t,void 0),children:e.footer?e.footer(b):null},e.key)),C&&/* @__PURE__ */ g(`td`,{})]})})]}),!S&&!b?.length&&/* @__PURE__ */ g(`div`,{className:`tbl-empty-block`,children:typeof bn==`string`?/* @__PURE__ */ g(`div`,{className:`tbl-empty-plain`,children:bn}):bn})]}),Ue(w)&&/* @__PURE__ */ g(s,{page:w.page,totalPages:w.totalPages,total:w.total,pageSize:w.pageSize,onPageChange:S?Ie:w.setPage,onPageSizeChange:S?Ie:w.setPageSize,pageSizes:w.pageSizes,mode:w.mode,summary:w.summary}),X&&/* @__PURE__ */ g(`div`,{ref:vn,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{We as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./assertValidValue.js";import s from"./textOf.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{cloneElement as u,forwardRef as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=[`sm`,`md`,`lg`],g=()=>import(`@webority/ui-elements/elements/datepicker`),_=d(function(d,_){let v=n(`wui-datepicker`,g),{marker:y,props:b}=r(`AppDatePicker`,d),{value:x,onChange:S,label:C,required:w=!1,optional:T=!1,optionalLabel:E=`(optional)`,helperText:D,error:O,name:k,min:A,max:j,placeholder:M=`Choose a date`,disabled:N,readOnly:P=!1,loading:F=!1,defaultValue:I,help:L,helpLabel:ee=`More information`,size:R,firstDay:z,displayFormat:B,id:V,ariaLabel:H,className:U=``,fieldClassName:W=``,...G}=b;l(`AppDatePicker`,G),o(`AppDatePicker`,`size`,R,h),typeof B==`string`&&B!==``&&/DD|YYYY|YY/.test(B)&&e(`[@webority/ui-react] <AppDatePicker> displayFormat "${B}" uses uppercase day or year tokens, which print as written; the tokens are yyyy, MMMM, MMM, MM, dd and d.`);let K=f(),q=V||K,{setRef:J}=c({ready:v,ref:_,value:x??(I===void 0?``:void 0),defaultValue:I,onChange:S}),Y=!C&&!O&&!D,X=O?`${q}-error`:void 0,Z=D?`${q}-hint`:void 0,Q=X||Z,$=/* @__PURE__ */ p(`wui-datepicker`,{ref:J,id:q,name:k,value:(x??I)||void 0,min:A,max:j,placeholder:M,size:R||void 0,"first-day":z==null?void 0:String(z),"display-format":B||void 0,"aria-label":H||s(C)||void 0,"aria-describedby":Q,"aria-invalid":O?`true`:void 0,disabled:N?``:void 0,readonly:P?``:void 0,loading:F?``:void 0,required:w?``:void 0,className:U||void 0,...G});return Y?u($,y):/* @__PURE__ */ m(`div`,{...y,className:`field${W?` ${W}`:``}`,children:[C&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:q,children:[C,T&&!w&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${E}`}),w&&/* @__PURE__ */ p(a,{}),L&&/* @__PURE__ */ p(i,{label:ee,children:L})]}),$,/* @__PURE__ */ p(t,{error:O,hint:D,errorId:X,hintId:Z})]})});export{_ as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import ee from"./textOf.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{cloneElement as u,forwardRef as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=[`sm`,`md`,`lg`],g=()=>import(`@webority/ui-elements/elements/datepicker`),_=d(function(d,_){let v=r(`wui-datepicker`,g),{marker:y,props:b}=i(`AppDatePicker`,d),{value:x,onChange:te,label:S,required:C=!1,optional:w=!1,optionalLabel:T=`(optional)`,helperText:E,error:D,name:O,min:k,max:A,placeholder:j=`Choose a date`,disabled:M,readOnly:N=!1,loading:P=!1,defaultValue:F,help:I,helpLabel:ne=`More information`,size:L,firstDay:R,displayFormat:z,id:B,ariaLabel:V,className:H=``,fieldClassName:U=``,...W}=b,G=n(O),K=D??G;l(`AppDatePicker`,W),s(`AppDatePicker`,`size`,L,h),typeof z==`string`&&z!==``&&/DD|YYYY|YY/.test(z)&&e(`[@webority/ui-react] <AppDatePicker> displayFormat "${z}" uses uppercase day or year tokens, which print as written; the tokens are yyyy, MMMM, MMM, MM, dd and d.`);let q=f(),J=B||q,{setRef:Y}=c({ready:v,ref:_,value:x??(F===void 0?``:void 0),defaultValue:F,onChange:te}),X=!S&&!K&&!E,Z=K?`${J}-error`:void 0,Q=E?`${J}-hint`:void 0,re=Z||Q,$=/* @__PURE__ */ p(`wui-datepicker`,{ref:Y,id:J,name:O,value:(x??F)||void 0,min:k,max:A,placeholder:j,size:L||void 0,"first-day":R==null?void 0:String(R),"display-format":z||void 0,"aria-label":V||ee(S)||void 0,"aria-describedby":re,"aria-invalid":K?`true`:void 0,disabled:M?``:void 0,readonly:N?``:void 0,loading:P?``:void 0,required:C?``:void 0,className:H||void 0,...W});return X?u($,y):/* @__PURE__ */ m(`div`,{...y,className:`field${U?` ${U}`:``}`,children:[S&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:J,children:[S,w&&!C&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${T}`}),C&&/* @__PURE__ */ p(o,{}),I&&/* @__PURE__ */ p(a,{label:ne,children:I})]}),$,/* @__PURE__ */ p(t,{error:K,hint:E,errorId:Z,hintId:Q})]})});export{_ as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import ee from"./AppInfoTip.js";import te from"./AppRequiredMark.js";import r from"./assertValidValue.js";import i from"./textOf.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{cloneElement as s,forwardRef as c,useEffect as ne,useId as re,useRef as ie}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`sm`,`md`,`lg`],f=()=>import(`@webority/ui-elements/elements/date-range`),p=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},m=c(function(c,m){let h=t(`wui-date-range`,f),{marker:g,props:_}=n(`AppDateRangePicker`,c),{start:v,end:y,defaultStart:b,defaultEnd:x,onChange:ae,label:S,help:C,helpLabel:w=`More information`,required:T=!1,optional:E=!1,optionalLabel:D=`(optional)`,helperText:O,error:k,startName:A,endName:j,min:M,max:N,placeholder:P=`Start to End`,disabled:F,readOnly:I=!1,loading:L=!1,size:R,firstDay:z,timeZone:oe,financialYearStart:B,presets:V,id:H,ariaLabel:U,className:W=``,fieldClassName:G=``,...K}=_;o(`AppDateRangePicker`,K),r(`AppDateRangePicker`,`size`,R,d);let q=re(),J=H||q,{setRef:se,innerRef:Y}=a({ready:h,ref:e=>{typeof m==`function`?m(e):m&&(m.current=e)},onChange:ae}),X=ie(!1);ne(()=>{if(!h)return;let e=Y.current;if(!e)return;let t=v===void 0?!X.current&&b!==void 0?b:e.value.start:v,n=y===void 0?!X.current&&x!==void 0?x:e.value.end:y;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n}),X.current=!0},[h,v,y,b,x,Y]);let ce=!S&&!k&&!O,Z=k?`${J}-error`:void 0,Q=O?`${J}-hint`:void 0,le=Z||Q,$=/* @__PURE__ */ l(`wui-date-range`,{ref:se,id:J,"start-name":A,"end-name":j,min:M,max:N,placeholder:P,size:R||void 0,"first-day":z==null?void 0:String(z),"time-zone":oe||void 0,"financial-year-start":B==null?void 0:String(B),presets:p(V),"aria-label":U||i(S)||void 0,"aria-describedby":le,"aria-invalid":k?`true`:void 0,disabled:F?``:void 0,readonly:I?``:void 0,loading:L?``:void 0,required:T?``:void 0,className:W||void 0,...K});return ce?s($,g):/* @__PURE__ */ u(`div`,{...g,className:`field${G?` ${G}`:``}`,children:[S&&/* @__PURE__ */ u(`label`,{className:`label`,htmlFor:J,children:[S,E&&!T&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${D}`}),T&&/* @__PURE__ */ l(te,{}),C&&/* @__PURE__ */ l(ee,{label:w,children:C})]}),$,/* @__PURE__ */ l(e,{error:k,hint:O,errorId:Z,hintId:Q})]})});export{m as default};
1
+ import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import r from"./assertValidValue.js";import i from"./textOf.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{cloneElement as s,forwardRef as c,useEffect as l,useId as re,useRef as ie}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var ae=[`sm`,`md`,`lg`],oe=()=>import(`@webority/ui-elements/elements/date-range`),se=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},f=c(function(c,f){let p=n(`wui-date-range`,oe),{marker:m,props:h}=ee(`AppDateRangePicker`,c),{start:g,end:_,defaultStart:v,defaultEnd:y,onChange:b,open:x,onOpenChange:S,label:C,help:w,helpLabel:ce=`More information`,required:T=!1,optional:E=!1,optionalLabel:D=`(optional)`,helperText:O,error:k,startName:A,endName:j,min:M,max:N,placeholder:P=`Start to End`,disabled:F,readOnly:I=!1,loading:L=!1,size:R,firstDay:z,timeZone:B,financialYearStart:V,presets:le,id:H,ariaLabel:U,className:W=``,fieldClassName:G=``,...K}=h,ue=t(A),de=t(j),q=k??ue??de;o(`AppDateRangePicker`,K),r(`AppDateRangePicker`,`size`,R,ae);let fe=re(),J=H||fe,{setRef:pe,innerRef:Y}=a({ready:p,ref:e=>{typeof f==`function`?f(e):f&&(f.current=e)},onChange:b}),X=ie(!1);l(()=>{if(!p)return;let e=Y.current;if(!e)return;let t=g===void 0?!X.current&&v!==void 0?v:e.value.start:g,n=_===void 0?!X.current&&y!==void 0?y:e.value.end:_;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n}),X.current=!0},[p,g,_,v,y,Y]),l(()=>{if(!p||x===void 0)return;let e=Y.current;e&&e.open!==x&&(e.open=x)},[p,x,Y]),l(()=>{let e=Y.current;if(!p||!e||!S)return;let t=t=>{t instanceof CustomEvent&&t.target===e&&S(!!t.detail?.open)};return e.addEventListener(`wui-date-range:openchange`,t),()=>e.removeEventListener(`wui-date-range:openchange`,t)},[p,S,Y]);let me=!C&&!q&&!O,Z=q?`${J}-error`:void 0,Q=O?`${J}-hint`:void 0,he=Z||Q,$=/* @__PURE__ */ u(`wui-date-range`,{ref:pe,id:J,"start-name":A,"end-name":j,min:M,max:N,placeholder:P,size:R||void 0,"first-day":z==null?void 0:String(z),"time-zone":B||void 0,"financial-year-start":V==null?void 0:String(V),presets:se(le),"aria-label":U||i(C)||void 0,"aria-describedby":he,"aria-invalid":q?`true`:void 0,disabled:F?``:void 0,readonly:I?``:void 0,loading:L?``:void 0,required:T?``:void 0,className:W||void 0,...K});return me?s($,m):/* @__PURE__ */ d(`div`,{...m,className:`field${G?` ${G}`:``}`,children:[C&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:J,children:[C,E&&!T&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${D}`}),T&&/* @__PURE__ */ u(ne,{}),w&&/* @__PURE__ */ u(te,{label:ce,children:w})]}),$,/* @__PURE__ */ u(e,{error:q,hint:O,errorId:Z,hintId:Q})]})});export{f as default};
@@ -1 +1 @@
1
- import{isEmpty as e}from"../lib/emptyValue.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./assertValidValue.js";import a from"./renderIconProp.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`sm`,`md`],u=[`grid`,`summary`,`list`],d=[1,2,3,4];function f(e,t){if(typeof e==`string`)return`${e}-${t}`;throw Error("<AppDescriptions> an item whose label is not text needs a `key`.")}function p(p){let{marker:m,props:h}=r(`AppDescriptions`,p),{items:g=[],columns:_=2,size:v=`md`,bordered:y=!1,layout:b=`grid`,title:x,linkComponent:S,className:C=``,...w}=h;o(`AppDescriptions`,w),i(`AppDescriptions`,`columns`,_,d),i(`AppDescriptions`,`size`,v,l),i(`AppDescriptions`,`layout`,b,u);let T=[`descs`,`descs-col-${_}`,v&&v!==`md`?`descs-${v}`:``,y?`descs-bordered`:``,b===`summary`?`wui-descs-summary`:``,b===`list`?`wui-descs-list`:``,_===4?`wui-descs-col-4`:``,C].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ c(`div`,{className:T,...m,...w,children:[x&&/* @__PURE__ */ s(`div`,{className:`descs-title`,children:x}),/* @__PURE__ */ s(`dl`,{className:`descs-list`,children:g.map((r,i)=>{let o=e(r.value),l=Math.min(12,Math.max(1,r.span??1)),u=r.key??f(r.label,i),d=o?`-`:r.value,p=t(S,{href:r.href});return/* @__PURE__ */ c(`div`,{className:`descs-item${r.emphasis?` wui-descs-emphasis`:``} wui-descs-span-${l}`,children:[r.icon&&/* @__PURE__ */ s(`span`,{className:`wui-descs-icon`,children:a(r.icon,{size:16})}),/* @__PURE__ */ s(`dt`,{className:`descs-label`,children:r.label}),/* @__PURE__ */ s(`dd`,{className:`descs-value${o?` is-empty`:``}${r.multiline&&!o?` wui-pre-line`:``}`,children:r.href?/* @__PURE__ */ s(n,{link:p,className:`wui-descs-link`,children:d}):d})]},u)})})]})}export{p as default};
1
+ import{isEmpty as e}from"../lib/emptyValue.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./assertValidValue.js";import a from"./renderIconProp.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`sm`,`md`],u=[`grid`,`summary`,`list`],d=[1,2,3,4];function f(e,t){if(typeof e==`string`)return`${e}-${t}`;throw Error("<AppDescriptions> an item whose label is not text needs a `key`.")}function p(p){let{marker:m,props:h}=r(`AppDescriptions`,p),{items:g=[],columns:_=2,size:v=`md`,bordered:y=!1,layout:b=`grid`,title:x,linkComponent:S,className:C=``,...w}=h;o(`AppDescriptions`,w),i(`AppDescriptions`,`columns`,_,d),i(`AppDescriptions`,`size`,v,l),i(`AppDescriptions`,`layout`,b,u);let T=[`descs`,`descs-col-${_}`,v&&v!==`md`?`descs-${v}`:``,y?`descs-bordered`:``,b===`summary`?`wui-descs-summary`:``,b===`list`?`wui-descs-list`:``,_===4?`wui-descs-col-4`:``,C].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ c(`div`,{className:T,...m,...w,children:[x&&/* @__PURE__ */ s(`div`,{className:`descs-title`,children:x}),/* @__PURE__ */ s(`dl`,{className:`descs-list`,children:g.map((r,i)=>{let o=e(r.value),l=Math.min(12,Math.max(1,r.span??1)),u=r.key??f(r.label,i),d=o?`-`:r.value,p=t(S,{href:r.href}),m=Object.fromEntries(Object.entries(r).filter(([e])=>e.startsWith(`data-`)));return/* @__PURE__ */ c(`div`,{className:`descs-item${r.emphasis?` wui-descs-emphasis`:``} wui-descs-span-${l}`,id:r.id,tabIndex:r.tabIndex,...m,children:[r.icon&&/* @__PURE__ */ s(`span`,{className:`wui-descs-icon`,children:a(r.icon,{size:16})}),/* @__PURE__ */ s(`dt`,{className:`descs-label`,children:r.label}),/* @__PURE__ */ s(`dd`,{className:`descs-value${o?` is-empty`:``}${r.multiline&&!o?` wui-pre-line`:``}`,children:r.href?/* @__PURE__ */ s(n,{link:p,className:`wui-descs-link`,children:d}):d})]},u)})})]})}export{p as default};
@@ -1 +1 @@
1
- import e from"../lib/DiscardPrompt.js";import{lockPageScroll as t}from"../lib/pageScrollLock.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useEffect as s,useId as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`end`,`start`],m=[`sm`,`md`,`lg`,`xl`],h=[50,90],g=()=>import(`@webority/ui-elements/elements/drawer`),_=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function v(v){n(`wui-drawer`,g);let{marker:ee,props:te}=r(`AppDrawer`,v),{open:y=!1,onClose:b,title:x,titleIcon:S,header:C,subtitle:w,ariaLabel:T,side:E=`end`,size:D=`md`,width:O,maxWidth:k,snapPoints:A=h,defaultSnap:j=0,sheet:M=!0,onSnapChange:N,onOpened:ne,onClosed:re,dismissible:P=!0,closeLabel:F=`Close`,sheetHeightLabel:I=`Sheet height`,staticBackdrop:L=!0,confirmDiscard:R,dirty:z=!1,headerClassName:B=``,bodyClassName:V=``,footer:H,className:U=``,style:W,children:G,...K}=te;o(`AppDrawer`,K),a(`AppDrawer`,`side`,E,p),a(`AppDrawer`,`size`,D,m),a(`AppDrawer`,`snapPoints`,_(A)?void 0:JSON.stringify(A),[`an array of numbers from 10 to 100`]);let q=c(),J=x!=null&&x!==!1&&x!==``,Y=l(null),X=l({dirty:!1}),Z=l(null),[Q,$]=u(!1);X.current={onClose:b,onSnapChange:N,onOpened:ne,onClosed:re,confirmDiscard:R,dirty:z},s(()=>{y||$(!1)},[y]),s(()=>{Q&&Z.current?.focus()},[Q]),s(()=>{if(y)return t()},[y]),s(()=>{let e=Y.current;if(!e)return;let t=t=>{t.target===e&&(t.preventDefault(),X.current.confirmDiscard&&X.current.dirty?$(!0):X.current.onClose?.())},n=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-drawer> snap arrived without its index and percent.`);X.current.onSnapChange?.(t.detail.index,t.detail.percent)}},r=t=>{t.target===e&&X.current.onOpened?.()},i=t=>{t.target===e&&X.current.onClosed?.()},a=n=>{n.target instanceof Element&&n.target.closest(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),e.addEventListener(`click`,a),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i),e.removeEventListener(`click`,a)}},[]);let ie=()=>{$(!1),Y.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),X.current.onClose?.()},ae=_(A)?A:h,oe={...O&&{"--wui-drawer-width":O},...k&&{"--wui-drawer-max-width":k},...W};return/* @__PURE__ */ f(`wui-drawer`,{ref:Y,...ee,...K,class:[`wui-drawer`,U].filter(Boolean).join(` `),side:E,size:D,"snap-points":ae.join(`,`),"default-snap":String(j),static:L?``:void 0,"no-sheet":M?void 0:``,"no-dismiss":P?void 0:``,"confirm-discard":R||void 0,open:y?``:void 0,style:oe,children:[/* @__PURE__ */ d(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),/* @__PURE__ */ f(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":T||void 0,"aria-labelledby":!T&&J&&C===void 0?q:void 0,tabIndex:-1,children:[M&&/* @__PURE__ */ d(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:/* @__PURE__ */ d(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":I})}),C===void 0?/* @__PURE__ */ f(`div`,{className:[`wui-drawer-header`,B].filter(Boolean).join(` `),"data-wui-drawer-grip":M?``:void 0,children:[/* @__PURE__ */ f(`div`,{className:`wui-drawer-headtext`,children:[J&&/* @__PURE__ */ f(`div`,{className:`wui-drawer-title`,id:q,children:[S&&/* @__PURE__ */ d(`span`,{className:`wui-drawer-title-ic`,children:/* @__PURE__ */ d(i,{name:S,size:18})}),x]}),w&&/* @__PURE__ */ d(`div`,{className:`wui-drawer-subtitle`,children:w})]}),P&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":F,children:/* @__PURE__ */ d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):C,/* @__PURE__ */ d(`div`,{className:[`wui-drawer-body`,V].filter(Boolean).join(` `),children:G}),(H||Q)&&/* @__PURE__ */ f(`div`,{className:Q?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[Q&&/* @__PURE__ */ d(e,{text:R,confirmRef:Z,onDiscard:ie,onKeep:()=>$(!1)}),H]})]})]})}export{v as default};
1
+ 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};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import t from"../lib/fillLabel.js";import n from"../lib/useFileDrop.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./warnUnknownProps.js";import{DEFAULT_MAX_SIZE_MB as o,acceptDroppedFiles as s,acceptLabel as c}from"@webority/ui-elements/helpers";import{useId as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";function p(p){let{marker:m,props:h}=r(`AppDropZone`,p),{label:g,id:_,onChange:v,multiple:y=!1,accept:b=``,maxSizeMb:x=o,error:S,helperText:C,disabled:w=!1,className:T=``,fieldClassName:E=``,style:D,browseLabel:O=`Click to upload`,dropLabel:k=`or drag & drop`,anyTypeText:A=`Any file type`,maxSizeText:j=`up to {size} MB`,...M}=h;a(`AppDropZone`,M);let[N,P]=u(``),F=l(),I=_||F,L=S||N,R=L?`${I}-error`:void 0,z=C&&!L?`${I}-hint`:void 0,B=R||z,V=b?c(b):A,H={accept:b,maxSizeMb:x,multiple:y},U=e=>{P(``);let[t]=e;p.multiple?p.onChange(e):t&&p.onChange(t)},W=e=>P(e.message),{dragOver:G,dropProps:K}=n({...H,disabled:w,onFiles:U,onReject:W}),q=e=>{let{files:t,rejections:n}=s(e,H);if(!t.length&&!n.length)return;t.length&&U(t);let[r]=n;r&&W(r)};return/* @__PURE__ */ f(`div`,{...m,className:`field${E?` ${E}`:``}`,children:[g?/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:I,children:g}):null,/* @__PURE__ */ f(`div`,{className:`file-input file-input-tall${G?` dragging`:``}${L?` error`:``}${T?` ${T}`:``}`,style:D,"aria-disabled":w||void 0,...K,children:[/* @__PURE__ */ f(`label`,{htmlFor:I,className:`file-input-zone-label`,children:[/* @__PURE__ */ d(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ d(i,{name:`upload`,size:24})}),/* @__PURE__ */ f(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ d(`span`,{className:`browse`,children:O}),` ${k}`]}),/* @__PURE__ */ d(`span`,{className:`file-input-text`,children:x>0?`${V}, ${t(j,{size:x})}`:V})]}),/* @__PURE__ */ d(`input`,{id:I,type:`file`,"aria-describedby":B,accept:b,multiple:y||void 0,disabled:w||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:e=>q(e.target.files),...M})]}),/* @__PURE__ */ d(e,{error:L,hint:C,errorId:R,hintId:z})]})}export{p as default};
1
+ import e from"../lib/FieldMessage.js";import t from"../lib/fillLabel.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useFileDrop.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./warnUnknownProps.js";import{DEFAULT_MAX_SIZE_MB as s,acceptDroppedFiles as c,acceptLabel as l}from"@webority/ui-elements/helpers";import{useId as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";function m(m){let{marker:h,props:g}=i(`AppDropZone`,m),{label:_,name:v,id:y,onChange:b,multiple:x=!1,accept:S=``,maxSizeMb:C=s,error:w,helperText:T,disabled:E=!1,className:D=``,fieldClassName:O=``,style:k,browseLabel:A=`Click to upload`,dropLabel:j=`or drag & drop`,anyTypeText:M=`Any file type`,maxSizeText:N=`up to {size} MB`,...P}=g;o(`AppDropZone`,P);let F=n(v),I=w??F,[L,R]=d(``),z=u(),B=y||z,V=I||L,H=V?`${B}-error`:void 0,U=T&&!V?`${B}-hint`:void 0,W=H||U,G=S?l(S):M,K={accept:S,maxSizeMb:C,multiple:x},q=e=>{R(``);let[t]=e;m.multiple?m.onChange(e):t&&m.onChange(t)},J=e=>R(e.message),{dragOver:Y,dropProps:X}=r({...K,disabled:E,onFiles:q,onReject:J}),Z=e=>{let{files:t,rejections:n}=c(e,K);if(!t.length&&!n.length)return;t.length&&q(t);let[r]=n;r&&J(r)};return/* @__PURE__ */ p(`div`,{...h,className:`field${O?` ${O}`:``}`,children:[_?/* @__PURE__ */ f(`label`,{className:`label`,htmlFor:B,children:_}):null,/* @__PURE__ */ p(`div`,{className:`file-input file-input-tall${Y?` dragging`:``}${V?` error`:``}${D?` ${D}`:``}`,style:k,"aria-disabled":E||void 0,...X,children:[/* @__PURE__ */ p(`label`,{htmlFor:B,className:`file-input-zone-label`,children:[/* @__PURE__ */ f(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ f(a,{name:`upload`,size:24})}),/* @__PURE__ */ p(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ f(`span`,{className:`browse`,children:A}),` ${j}`]}),/* @__PURE__ */ f(`span`,{className:`file-input-text`,children:C>0?`${G}, ${t(N,{size:C})}`:G})]}),/* @__PURE__ */ f(`input`,{id:B,type:`file`,"aria-describedby":W,name:v,accept:S,multiple:x||void 0,disabled:E||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:e=>Z(e.target.files),...P})]}),/* @__PURE__ */ f(e,{error:V,hint:T,errorId:H,hintId:U})]})}export{m as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import{TargetLink as i}from"../lib/TargetLink.js";import{TONES as a}from"../lib/vocabulary.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import ee from"./warnUnknownProps.js";import te from"./withTooltip.js";import{Fragment as ne,forwardRef as u,useEffect as d,useRef as f,useState as p}from"react";import{Dropdown as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`,`fit`],re=e=>{e.preventDefault(),e.stopPropagation()},ie=u(function(e,t){return/* @__PURE__ */ h(`button`,{...e,ref:t,"aria-disabled":`true`})}),b=e=>e.description?/* @__PURE__ */ g(`span`,{className:`wui-dropdown-item-body`,children:[/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-label`,children:e.label}),/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-desc`,children:e.description})]}):e.label,x=!1;function S(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!x&&(x=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function C(u){let{marker:x,props:C}=o(`AppDropdown`,u),{icon:ae,iconSize:oe,toggleClassName:T,toggleVariant:E,menuWidth:D,label:O,ariaLabel:k,align:A=`end`,items:j=[],menuClassName:M=``,linkComponent:N,children:P,trigger:F,open:I,onOpenChange:L,searchable:R,searchPlaceholder:z,noMatchText:B,...V}=C;if(ee(`AppDropdown`,V),R&&P!=null)throw Error(`<AppDropdown> searchable filters items, so it takes items and no children.`);if(!R&&(z!==void 0||B!==void 0))throw Error(`<AppDropdown> searchPlaceholder and noMatchText need searchable.`);for(let e of j)if(c(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_),c(`AppDropdown`,`items[].tone`,e.tone,a),R&&e.label!=null&&typeof e.label!=`string`)throw RangeError(`<AppDropdown> searchable filters rows by their text, so every item label must be a string.`);F||k||O||S(),c(`AppDropdown`,`toggleVariant`,E,v),c(`AppDropdown`,`menuWidth`,D,y),E&&!F&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let H=(T??(F?`wui-dropdown-trigger`:`topbar-icon-btn`))+(F&&E===`neutral`?` wui-dropdown-trigger-neutral`:``),U=[D&&y.includes(D)?`wui-dropdown-menu-${D}`:``,R?`wui-dropdown-menu-searchable`:``,M].filter(Boolean).join(` `),[W,G]=p(``),K=f(null),q=z??`Search`,se=B??`No matches.`,J=W.trim().toLowerCase(),Y=J?j.filter(e=>!e.divider&&e.header==null&&(typeof e.label==`string`?e.label:``).toLowerCase().includes(J)):j,ce=ae??(F?void 0:`more-horizontal`),X=I!==void 0,[le,ue]=p(!1),Z=X?!!I:le,Q=f(null);Q.current=(e,t)=>{X||ue(e),L?.(e,t)};let $=f(null);return d(()=>{if(!Z)return;let e=$.current?.getBoundingClientRect(),t=()=>{let t=$.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&Q.current?.(!1,{source:`scroll`})},n=()=>Q.current?.(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[Z]),d(()=>{R&&Z&&K.current?.focus(),Z||G(``)},[Z,R]),d(()=>{let e=K.current;if(!R||!e)return;let t=t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault(),t.stopPropagation();let n=Array.from(e.closest(`.dropdown-menu`)?.querySelectorAll(`.dropdown-item`)??[]);(t.key===`ArrowDown`?n[0]:n[n.length-1])?.focus()}else t.key===`Escape`?(t.preventDefault(),t.stopPropagation(),Q.current?.(!1,{source:`keydown`,originalEvent:t}),$.current?.querySelector(`:scope > button`)?.focus()):t.key!==`Tab`&&t.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[R]),/* @__PURE__ */ g(m,{ref:$,align:A,show:Z,onToggle:(e,t)=>Q.current?.(e,t),...x,...V,children:[/* @__PURE__ */ h(m.Toggle,{as:w,icon:ce,iconSize:oe,btnClassName:H,trigger:F,title:O,"aria-label":k??(F?void 0:O)}),/* @__PURE__ */ g(m.Menu,{className:U,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:[R?/* @__PURE__ */ g(`div`,{className:`wui-dropdown-search`,children:[/* @__PURE__ */ h(s,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:K,type:`search`,className:`wui-dropdown-search-input`,autoComplete:`off`,placeholder:q,"aria-label":q,value:W,onChange:e=>G(e.target.value)})]}):null,P??Y.map(e=>{if(e.to&&e.href)throw RangeError(`AppDropdown: an item takes to or href, not both.`);if(e.header!=null)return/* @__PURE__ */ h(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ h(m.Divider,{},e.key);if(e.disabled)return/* @__PURE__ */ h(ne,{children:te(/* @__PURE__ */ g(m.Item,{as:ie,type:`button`,className:[e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:re,children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),e.disabledReason&&/* @__PURE__ */ g(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let a=e.to?{as:i,link:t(N,{to:e.to})}:e.href?{as:i,link:t(N,{href:e.href,external:!0})}:{as:`button`,type:`button`},o=[e.tone===`danger`&&`danger`,e.hiddenFrom&&_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ g(m.Item,{...a,onClick:e.onClick,className:o,"aria-keyshortcuts":n(e.shortcut),children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),r(e.shortcut)]},e.key)}),R&&J&&Y.length===0?/* @__PURE__ */ h(`div`,{className:`wui-dropdown-empty`,role:`status`,children:se}):null]})]})}var w=u(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:a,...o},c){return/* @__PURE__ */ h(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...o,children:r??(e===void 0?null:/* @__PURE__ */ h(s,{name:e,size:t}))})});export{C as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as ee}from"../lib/shortcutChip.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import{TONES as a}from"../lib/vocabulary.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import te from"./warnUnknownProps.js";import ne from"./withTooltip.js";import{Fragment as re,useEffect as u,useId 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 _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`,`fit`],ie=()=>import(`@webority/ui-elements/elements/dropdown`),b=e=>e.description?/* @__PURE__ */ g(`span`,{className:`wui-dropdown-item-body`,children:[/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-label`,children:e.label}),/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-desc`,children:e.description})]}):e.label,x=!1;function S(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!x&&(x=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function C(x){i(`wui-dropdown`,ie);let{marker:C,props:ae}=o(`AppDropdown`,x),{icon:oe,iconSize:se,toggleClassName:ce,toggleVariant:w,menuWidth:T,label:E,ariaLabel:D,align:O=`end`,items:k=[],menuClassName:A=``,linkComponent:j,children:M,trigger:N,open:P,onOpenChange:le,searchable:F,searchPlaceholder:I,noMatchText:L,...R}=ae;if(te(`AppDropdown`,R),F&&M!=null)throw Error(`<AppDropdown> searchable filters items, so it takes items and no children.`);if(!F&&(I!==void 0||L!==void 0))throw Error(`<AppDropdown> searchPlaceholder and noMatchText need searchable.`);for(let e of k)if(c(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_),c(`AppDropdown`,`items[].tone`,e.tone,a),F&&e.label!=null&&typeof e.label!=`string`)throw RangeError(`<AppDropdown> searchable filters rows by their text, so every item label must be a string.`);N||D||E||S(),c(`AppDropdown`,`toggleVariant`,w,v),c(`AppDropdown`,`menuWidth`,T,y),w&&!N&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let z=(ce??(N?`wui-dropdown-trigger`:`topbar-icon-btn`))+(N&&w===`neutral`?` wui-dropdown-trigger-neutral`:``),B=[`dropdown-menu`,O===`end`?`dropdown-menu-end`:``,T&&y.includes(T)?`wui-dropdown-menu-${T}`:``,F?`wui-dropdown-menu-searchable`:``,A].filter(Boolean).join(` `),[V,H]=p(``),U=f(null),W=I??`Search`,G=L??`No matches.`,K=V.trim().toLowerCase(),q=K?k.filter(e=>!e.divider&&e.header==null&&(typeof e.label==`string`?e.label:``).toLowerCase().includes(K)):k,J=oe??(N?void 0:`more-horizontal`),Y=d(),X=P!==void 0,[ue,de]=p(!1),Z=X?!!P:ue,Q=f(null);Q.current=(e,t)=>{X||de(e),le?.(e,t)};let $=f(null);return u(()=>{let e=$.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);t.preventDefault(),Q.current?.(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[]),u(()=>{F&&Z&&U.current?.focus(),Z||H(``)},[Z,F]),u(()=>{let e=U.current;if(!F||!e)return;let t=t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault(),t.stopPropagation();let n=Array.from(e.closest(`.dropdown-menu`)?.querySelectorAll(`.dropdown-item`)??[]);(t.key===`ArrowDown`?n[0]:n[n.length-1])?.focus()}else t.key!==`Tab`&&t.key!==`Escape`&&t.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[F]),/* @__PURE__ */ g(`wui-dropdown`,{...C,...R,ref:$,class:[`dropdown`,R.className].filter(Boolean).join(` `),align:O,open:Z?``:void 0,children:[/* @__PURE__ */ h(`button`,{type:`button`,id:Y,"data-wui-dropdown-trigger":!0,"aria-expanded":Z?`true`:`false`,className:z,title:E,"aria-label":D??(N?void 0:E),children:N??(J===void 0?null:/* @__PURE__ */ h(s,{name:J,size:se??20}))}),/* @__PURE__ */ g(`div`,{className:B,"aria-labelledby":Y,"data-wui-dropdown-menu":!0,popover:`auto`,children:[F?/* @__PURE__ */ g(`div`,{className:`wui-dropdown-search`,children:[/* @__PURE__ */ h(s,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:U,type:`search`,className:`wui-dropdown-search-input`,autoComplete:`off`,placeholder:W,"aria-label":W,value:V,onChange:e=>H(e.target.value)})]}):null,M??q.map(e=>{if(e.to&&e.href)throw RangeError(`AppDropdown: an item takes to or href, not both.`);if(e.header!=null)return/* @__PURE__ */ h(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ h(`hr`,{className:`dropdown-divider`},e.key);if(e.disabled)return/* @__PURE__ */ h(re,{children:ne(/* @__PURE__ */ g(`button`,{type:`button`,className:[`dropdown-item`,e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`,e.hiddenFrom&&_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `),"aria-disabled":`true`,children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),e.disabledReason&&/* @__PURE__ */ g(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let i=[`dropdown-item`,e.tone===`danger`&&`danger`,e.hiddenFrom&&_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0,a=/* @__PURE__ */ g(m,{children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),ee(e.shortcut)]}),o={className:i,onClick:e.onClick,"aria-keyshortcuts":n(e.shortcut)};return e.to?/* @__PURE__ */ h(r,{link:t(j,{to:e.to}),...o,children:a},e.key):e.href?/* @__PURE__ */ h(r,{link:t(j,{href:e.href,external:!0}),...o,children:a},e.key):/* @__PURE__ */ h(`button`,{type:`button`,...o,children:a},e.key)}),F&&K&&q.length===0?/* @__PURE__ */ h(`div`,{className:`wui-dropdown-empty`,role:`status`,children:G}):null]})]})}export{C as default};
@@ -1 +1 @@
1
- import e from"../lib/fillLabel.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{formatDate as a,toInstant as o}from"@webority/ui-elements/helpers";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=864e5,u=198e5,d=14,f=[`days`,`due`],p=e=>Math.floor((e+u)/l),m=(...e)=>e.filter(Boolean).join(` `),h=(t,n,r)=>t===`due`?n===0?r.dueTodayLabel:n===1?r.dueTomorrowLabel:e(r.dueInLabel,{days:n}):n===1?r.oneDayLeftLabel:e(r.daysLeftLabel,{days:n});function g(u){let{marker:g,props:_}=t(`AppDueDate`,u),{date:v,soonDays:y,soonWording:b=`days`,icon:x=!1,overdue:S=!1,overdueLabel:C,notSetLabel:w=`Not set`,dueTodayLabel:T=`Due today`,dueTomorrowLabel:E=`Due tomorrow`,dueInLabel:D=`Due in {days} days`,daysLeftLabel:O=`{days} days left`,oneDayLeftLabel:k=`1 day left`,overdueSinceLabel:A=`Overdue since {date}`,className:j=``,...M}=_;i(`AppDueDate`,M),r(`AppDueDate`,`soonWording`,b,f);let N=o(v);if(!Number.isFinite(N))return/* @__PURE__ */ s(`wui-due-date`,{class:m(`wui-due-date`,`wui-due-date-empty`,j),...g,...M,children:/* @__PURE__ */ s(`time`,{children:w})});let P=p(N),F=(/* @__PURE__ */ new Date(P*l)).toISOString().slice(0,10),I=P-p(Date.now()),L=x?/* @__PURE__ */ s(n,{name:`calendar`,size:d}):null;if(S){let t=a(N);return/* @__PURE__ */ c(`wui-due-date`,{class:m(`wui-due-date`,`wui-due-date-danger`,j),title:e(A,{date:t}),...g,...M,children:[/* @__PURE__ */ s(n,{name:`danger`,size:d}),L,/* @__PURE__ */ s(`time`,{dateTime:F,children:C||t})]})}return y!==void 0&&Number.isFinite(y)&&I>=0&&I<=y?/* @__PURE__ */ c(`wui-due-date`,{class:m(`wui-due-date`,`wui-due-date-warning`,j),...g,...M,children:[L,/* @__PURE__ */ s(`time`,{dateTime:F,children:h(b,I,{dueTodayLabel:T,dueTomorrowLabel:E,dueInLabel:D,daysLeftLabel:O,oneDayLeftLabel:k})})]}):/* @__PURE__ */ c(`wui-due-date`,{class:m(`wui-due-date`,j),...g,...M,children:[L,/* @__PURE__ */ s(`time`,{dateTime:F,children:a(N)})]})}export{g as default};
1
+ import e from"../lib/fillLabel.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{formatDate as a,toInstant as o}from"@webority/ui-elements/helpers";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=864e5,u=198e5,d=14,f=[`days`,`due`],p=e=>Math.floor((e+u)/l),m=(...e)=>e.filter(Boolean).join(` `),h=(t,n,r)=>n===0?r.dueTodayLabel:t===`due`?n===1?r.dueTomorrowLabel:e(r.dueInLabel,{days:n}):n===1?r.oneDayLeftLabel:e(r.daysLeftLabel,{days:n});function g(u){let{marker:g,props:_}=t(`AppDueDate`,u),{date:v,soonDays:y,soonWording:b=`days`,icon:x=!1,overdue:S=!1,overdueLabel:C,notSetLabel:w=`Not set`,dueTodayLabel:T=`Due today`,dueTomorrowLabel:E=`Due tomorrow`,dueInLabel:D=`Due in {days} days`,daysLeftLabel:O=`{days} days left`,oneDayLeftLabel:k=`1 day left`,overdueSinceLabel:A=`Overdue since {date}`,className:j=``,...M}=_;i(`AppDueDate`,M),r(`AppDueDate`,`soonWording`,b,f);let N=o(v);if(!Number.isFinite(N))return/* @__PURE__ */ s(`wui-due-date`,{class:m(`wui-due-date`,`wui-due-date-empty`,j),...g,...M,children:/* @__PURE__ */ s(`time`,{children:w})});let P=p(N),F=(/* @__PURE__ */ new Date(P*l)).toISOString().slice(0,10),I=P-p(Date.now()),L=x?/* @__PURE__ */ s(n,{name:`calendar`,size:d}):null;if(S){let t=a(N);return/* @__PURE__ */ c(`wui-due-date`,{class:m(`wui-due-date`,`wui-due-date-danger`,j),title:e(A,{date:t}),...g,...M,children:[/* @__PURE__ */ s(n,{name:`danger`,size:d}),L,/* @__PURE__ */ s(`time`,{dateTime:F,children:C||t})]})}return y!==void 0&&Number.isFinite(y)&&I>=0&&I<=y?/* @__PURE__ */ c(`wui-due-date`,{class:m(`wui-due-date`,`wui-due-date-warning`,j),...g,...M,children:[L,/* @__PURE__ */ s(`time`,{dateTime:F,children:h(b,I,{dueTodayLabel:T,dueTomorrowLabel:E,dueInLabel:D,daysLeftLabel:O,oneDayLeftLabel:k})})]}):/* @__PURE__ */ c(`wui-due-date`,{class:m(`wui-due-date`,j),...g,...M,children:[L,/* @__PURE__ */ s(`time`,{dateTime:F,children:a(N)})]})}export{g as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./AppInfoTip.js";import i from"./AppKbd.js";import a from"./AppSpinner.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{Fragment as c,useEffect as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`text`,`number`],h=[`clean`,`dirty`,`saving`,`saved`,`failed`],g=()=>import(`@webority/ui-elements/elements/entry-grid`);function _(_){e(`wui-entry-grid`,g);let{marker:v,props:y}=t(`AppEntryGrid`,_),{columns:b,rows:x,rowKey:S,activeRowKey:C,onActiveRowChange:w,renderCell:T,rowState:E,rowError:D,onCommitRow:O,onDiscardRow:k,onAddRow:A,renderRowDetail:j,hint:M=!0,label:N=`Entry lines`,addLabel:P=`Add line`,emptyLabel:F=`No lines yet`,statusLabel:I=`Status`,dirtyLabel:L=`Changed`,savingLabel:R=`Saving`,savedLabel:z=`Saved`,failedLabel:B=`Not saved`,commitNextLabel:V=`Save and go to the next line`,commitStayLabel:H=`Save`,discardLabel:U=`Discard changes`,moveLabel:W=`Move between lines`,className:G=``,...K}=y;s(`AppEntryGrid`,K);for(let e of b)o(`AppEntryGrid`,`columns[].kind`,e.kind,m);let q=x.map(e=>{let t=E?E(e):`clean`;return o(`AppEntryGrid`,`rowState()`,t,h),t}),J=u(null),Y=u({rows:x,rowKey:S,onCommitRow:O,onDiscardRow:k,onActiveRowChange:w,onAddRow:A});Y.current={rows:x,rowKey:S,onCommitRow:O,onDiscardRow:k,onActiveRowChange:w,onAddRow:A},l(()=>{let e=J.current;if(!e)return;let t=e=>{let t=e instanceof CustomEvent?e.detail?.rowKey:void 0,{rows:n,rowKey:r}=Y.current;return typeof t==`string`?n.find(e=>r(e)===t):void 0},n=e=>{let n=t(e),r=e instanceof CustomEvent?e.detail?.move:void 0;n!==void 0&&(r===`next`||r===`stay`)&&Y.current.onCommitRow?.(n,r)},r=e=>{let n=t(e);n!==void 0&&Y.current.onDiscardRow?.(n)},i=e=>{let n=t(e);n!==void 0&&Y.current.onActiveRowChange?.(Y.current.rowKey(n))},a=()=>Y.current.onAddRow?.();return e.addEventListener(`wui-entry-grid:commit`,n),e.addEventListener(`wui-entry-grid:discard`,r),e.addEventListener(`wui-entry-grid:active`,i),e.addEventListener(`wui-entry-grid:add`,a),()=>{e.removeEventListener(`wui-entry-grid:commit`,n),e.removeEventListener(`wui-entry-grid:discard`,r),e.removeEventListener(`wui-entry-grid:active`,i),e.removeEventListener(`wui-entry-grid:add`,a)}},[]);let X=e=>e===`dirty`?/* @__PURE__ */ f(`span`,{className:`wui-entry-grid-dot`,role:`img`,"aria-label":L}):e===`saving`?/* @__PURE__ */ f(a,{size:`sm`,label:R}):e===`saved`?/* @__PURE__ */ p(d,{children:[/* @__PURE__ */ f(n,{name:`tick-circle`,size:16}),/* @__PURE__ */ f(`span`,{className:`visually-hidden`,children:z})]}):e===`failed`?/* @__PURE__ */ p(d,{children:[/* @__PURE__ */ f(n,{name:`danger`,size:16}),/* @__PURE__ */ f(`span`,{className:`visually-hidden`,children:B})]}):null,Z=b.some(e=>e.footer),Q=b.length+1,$=e=>e.kind===`number`?`text-end`:void 0;return/* @__PURE__ */ p(`wui-entry-grid`,{ref:J,class:[`wui-entry-grid`,G].filter(Boolean).join(` `),"active-row":C??``,...v,...K,children:[/* @__PURE__ */ f(`div`,{className:`table-responsive wui-entry-grid-scroll`,children:/* @__PURE__ */ p(`table`,{className:`table wui-entry-grid-table`,"aria-label":N,children:[/* @__PURE__ */ f(`thead`,{children:/* @__PURE__ */ p(`tr`,{children:[/* @__PURE__ */ f(`th`,{scope:`col`,className:`wui-entry-grid-status`,children:/* @__PURE__ */ f(`span`,{className:`visually-hidden`,children:I})}),b.map(e=>/* @__PURE__ */ p(`th`,{scope:`col`,className:$(e),style:e.width===void 0?void 0:{width:e.width},children:[e.label,e.help?/* @__PURE__ */ f(r,{label:typeof e.label==`string`?e.label:void 0,children:e.help}):null]},e.key))]})}),/* @__PURE__ */ p(`tbody`,{children:[x.map((e,t)=>{let n=S(e),r=q[t]??`clean`,i=n===C,a=r===`failed`&&D!==void 0,o=i&&j!==void 0,s=[`wui-entry-grid-row`,i&&`is-active`,r!==`clean`&&`wui-entry-grid-row-${r}`].filter(Boolean).join(` `);return/* @__PURE__ */ p(c,{children:[/* @__PURE__ */ p(`tr`,{className:s,"data-row-key":n,"aria-current":i?`true`:void 0,children:[/* @__PURE__ */ f(`td`,{className:`wui-entry-grid-status`,children:X(r)}),b.map(t=>/* @__PURE__ */ f(`td`,{className:$(t),"data-kind":t.kind??`text`,children:T(e,t,i)},t.key))]}),a||o?/* @__PURE__ */ f(`tr`,{className:`wui-entry-grid-detail`,children:/* @__PURE__ */ p(`td`,{colSpan:Q,children:[a?/* @__PURE__ */ f(`div`,{className:`wui-entry-grid-error`,role:`alert`,children:D(e)}):null,o?j(e):null]})}):null]},n)}),x.length===0?/* @__PURE__ */ f(`tr`,{className:`wui-entry-grid-empty`,children:/* @__PURE__ */ f(`td`,{colSpan:Q,children:F})}):null]}),Z?/* @__PURE__ */ f(`tfoot`,{className:`wui-entry-grid-footer`,children:/* @__PURE__ */ p(`tr`,{children:[/* @__PURE__ */ f(`td`,{}),b.map(e=>/* @__PURE__ */ f(`td`,{className:$(e),children:e.footer?.(x)},e.key))]})}):null]})}),/* @__PURE__ */ p(`div`,{className:`wui-entry-grid-bar`,children:[A?/* @__PURE__ */ f(`button`,{type:`button`,className:`btn btn-sm btn-outline-primary wui-entry-grid-add`,children:P}):null,M?/* @__PURE__ */ p(`ul`,{className:`wui-entry-grid-hint`,children:[/* @__PURE__ */ p(`li`,{children:[/* @__PURE__ */ f(i,{children:`Enter`}),` ${V}`]}),/* @__PURE__ */ p(`li`,{children:[/* @__PURE__ */ f(i,{children:`Ctrl`}),`+`,/* @__PURE__ */ f(i,{children:`S`}),` ${H}`]}),/* @__PURE__ */ p(`li`,{children:[/* @__PURE__ */ f(i,{children:`Esc`}),` ${U}`]}),/* @__PURE__ */ p(`li`,{children:[/* @__PURE__ */ f(i,{children:`Ctrl`}),`+`,/* @__PURE__ */ f(i,{children:`↑`}),`/`,/* @__PURE__ */ f(i,{children:`↓`}),` ${W}`]})]}):null]})]})}export{_ as default};