@webority/ui-react 0.128.0 → 0.129.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 (184) hide show
  1. package/dist/canvas-kit/kit.js +28676 -24381
  2. package/dist/canvas-kit/manifest.json +3182 -163
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/dist/components/AppAccountSwitcher.js +1 -0
  5. package/dist/components/AppAsyncBlock.js +1 -1
  6. package/dist/components/AppAuthLayout.js +1 -0
  7. package/dist/components/AppAutocomplete.js +1 -1
  8. package/dist/components/AppAvatar.js +1 -1
  9. package/dist/components/AppAvatarGroup.js +1 -1
  10. package/dist/components/AppBanner.js +1 -1
  11. package/dist/components/AppButton.js +1 -1
  12. package/dist/components/AppCalendar.js +1 -1
  13. package/dist/components/AppCard.js +1 -1
  14. package/dist/components/AppCell.js +1 -0
  15. package/dist/components/AppChart.js +1 -1
  16. package/dist/components/AppChartCard.js +1 -1
  17. package/dist/components/AppCheckbox.js +1 -1
  18. package/dist/components/AppChoiceCard.js +1 -1
  19. package/dist/components/AppChoiceChip.js +1 -1
  20. package/dist/components/AppColorField.js +1 -1
  21. package/dist/components/AppCommandPalette.js +1 -1
  22. package/dist/components/AppCommentThread.js +1 -1
  23. package/dist/components/AppCompareTable.js +1 -1
  24. package/dist/components/AppConfirmDialog.js +1 -1
  25. package/dist/components/AppCopyButton.js +1 -1
  26. package/dist/components/AppCountrySelect.js +1 -1
  27. package/dist/components/AppDataTable.js +1 -1
  28. package/dist/components/AppDatePicker.js +1 -1
  29. package/dist/components/AppDateRangePicker.js +1 -1
  30. package/dist/components/AppDescriptions.js +1 -1
  31. package/dist/components/AppDrawer.js +1 -1
  32. package/dist/components/AppDropZone.js +1 -1
  33. package/dist/components/AppDueDate.js +1 -1
  34. package/dist/components/AppErrorBoundary.js +1 -0
  35. package/dist/components/AppFileAttachment.js +1 -1
  36. package/dist/components/AppFilePicker.js +1 -1
  37. package/dist/components/AppFileTiles.js +1 -1
  38. package/dist/components/AppFilterBar.js +1 -1
  39. package/dist/components/AppFloatingButton.js +1 -0
  40. package/dist/components/AppImagePicker.js +1 -1
  41. package/dist/components/AppInlineEdit.js +1 -1
  42. package/dist/components/AppInput.js +1 -1
  43. package/dist/components/AppKanban.js +1 -1
  44. package/dist/components/AppLeadPopup.js +1 -0
  45. package/dist/components/AppLink.js +1 -1
  46. package/dist/components/AppMarkdown.js +1 -1
  47. package/dist/components/AppMentionInput.js +1 -1
  48. package/dist/components/AppMetricStrip.js +1 -1
  49. package/dist/components/AppModal.js +1 -1
  50. package/dist/components/AppMultiSelect.js +1 -1
  51. package/dist/components/AppNotificationCenter.js +1 -1
  52. package/dist/components/AppNumberInput.js +1 -1
  53. package/dist/components/AppOtpInput.js +1 -1
  54. package/dist/components/AppPhoneNumberInput.js +1 -1
  55. package/dist/components/AppPopover.js +1 -1
  56. package/dist/components/AppRadio.js +1 -1
  57. package/dist/components/AppRadioGroup.js +1 -1
  58. package/dist/components/AppRating.js +1 -1
  59. package/dist/components/AppRichText.js +1 -1
  60. package/dist/components/AppRouteError.js +1 -1
  61. package/dist/components/AppScoreScale.js +1 -1
  62. package/dist/components/AppSearch.js +1 -1
  63. package/dist/components/AppSectionLeadCapture.js +1 -1
  64. package/dist/components/AppSectionLogos.js +1 -1
  65. package/dist/components/AppSegmented.js +1 -1
  66. package/dist/components/AppSelect.js +1 -1
  67. package/dist/components/AppShell.js +1 -1
  68. package/dist/components/AppSlider.js +1 -1
  69. package/dist/components/AppSortableList.js +1 -1
  70. package/dist/components/AppSparkline.js +1 -1
  71. package/dist/components/AppSplitButton.js +1 -1
  72. package/dist/components/AppSplitView.js +1 -1
  73. package/dist/components/AppStepper.js +1 -1
  74. package/dist/components/AppSwitch.js +1 -1
  75. package/dist/components/AppTablePagination.js +1 -1
  76. package/dist/components/AppTableToolbar.js +1 -1
  77. package/dist/components/AppTagInput.js +1 -1
  78. package/dist/components/AppTextarea.js +1 -1
  79. package/dist/components/AppTimePicker.js +1 -1
  80. package/dist/components/AppTimeline.js +1 -1
  81. package/dist/components/AppToast.js +1 -1
  82. package/dist/components/AppUpdateBar.js +1 -1
  83. package/dist/components/AppWhatsNew.js +1 -1
  84. package/dist/components/AppWorkspaceSwitcher.js +1 -1
  85. package/dist/components/iconCatalogNames.g.js +1 -1
  86. package/dist/components/iconGlyphs.g.js +1 -1
  87. package/dist/components/iconVariants.g.js +1 -1
  88. package/dist/components/useWuiControl.js +1 -1
  89. package/dist/guidance.json +235 -2
  90. package/dist/lib/CheckField.js +1 -1
  91. package/dist/lib/FileItemRow.js +1 -1
  92. package/dist/lib/fieldState.js +1 -0
  93. package/dist/lib/fillLabel.js +1 -0
  94. package/dist/lib/labelWithHelp.js +1 -0
  95. package/dist/lib/linkTarget.js +1 -0
  96. package/dist/markdown-core/dist/links.js +1 -1
  97. package/dist/types/components/AppAccountSwitcher.d.ts +41 -0
  98. package/dist/types/components/AppAsyncBlock.d.ts +24 -0
  99. package/dist/types/components/AppAuthLayout.d.ts +45 -0
  100. package/dist/types/components/AppAutocomplete.d.ts +22 -2
  101. package/dist/types/components/AppAvatar.d.ts +6 -0
  102. package/dist/types/components/AppAvatarGroup.d.ts +6 -0
  103. package/dist/types/components/AppBanner.d.ts +6 -0
  104. package/dist/types/components/AppButton.d.ts +1 -0
  105. package/dist/types/components/AppCalendar.d.ts +3 -1
  106. package/dist/types/components/AppCard.d.ts +13 -1
  107. package/dist/types/components/AppCell.d.ts +36 -0
  108. package/dist/types/components/AppChart.d.ts +7 -0
  109. package/dist/types/components/AppChartCard.d.ts +60 -0
  110. package/dist/types/components/AppCheckbox.d.ts +22 -0
  111. package/dist/types/components/AppChoiceCard.d.ts +21 -0
  112. package/dist/types/components/AppChoiceChip.d.ts +21 -0
  113. package/dist/types/components/AppColorField.d.ts +43 -4
  114. package/dist/types/components/AppCommandPalette.d.ts +6 -0
  115. package/dist/types/components/AppCommentThread.d.ts +102 -3
  116. package/dist/types/components/AppCompareTable.d.ts +24 -0
  117. package/dist/types/components/AppConfirmDialog.d.ts +6 -0
  118. package/dist/types/components/AppCountrySelect.d.ts +5 -0
  119. package/dist/types/components/AppDataTable.d.ts +1 -1
  120. package/dist/types/components/AppDatePicker.d.ts +24 -0
  121. package/dist/types/components/AppDateRangePicker.d.ts +31 -1
  122. package/dist/types/components/AppDescriptions.d.ts +4 -1
  123. package/dist/types/components/AppDrawer.d.ts +6 -0
  124. package/dist/types/components/AppDropZone.d.ts +24 -0
  125. package/dist/types/components/AppDueDate.d.ts +42 -0
  126. package/dist/types/components/AppErrorBoundary.d.ts +39 -0
  127. package/dist/types/components/AppFileAttachment.d.ts +54 -1
  128. package/dist/types/components/AppFilePicker.d.ts +75 -0
  129. package/dist/types/components/AppFileTiles.d.ts +6 -3
  130. package/dist/types/components/AppFilterBar.d.ts +73 -0
  131. package/dist/types/components/AppFloatingButton.d.ts +64 -0
  132. package/dist/types/components/AppImagePicker.d.ts +60 -0
  133. package/dist/types/components/AppInlineEdit.d.ts +6 -0
  134. package/dist/types/components/AppInput.d.ts +37 -2
  135. package/dist/types/components/AppKanban.d.ts +32 -0
  136. package/dist/types/components/AppLeadPopup.d.ts +122 -0
  137. package/dist/types/components/AppLink.d.ts +3 -0
  138. package/dist/types/components/AppMentionInput.d.ts +17 -0
  139. package/dist/types/components/AppMetricStrip.d.ts +2 -0
  140. package/dist/types/components/AppModal.d.ts +6 -0
  141. package/dist/types/components/AppMultiSelect.d.ts +18 -1
  142. package/dist/types/components/AppNotificationCenter.d.ts +2 -0
  143. package/dist/types/components/AppNumberInput.d.ts +24 -2
  144. package/dist/types/components/AppOtpInput.d.ts +29 -0
  145. package/dist/types/components/AppPhoneNumberInput.d.ts +24 -0
  146. package/dist/types/components/AppRadio.d.ts +22 -0
  147. package/dist/types/components/AppRadioGroup.d.ts +24 -0
  148. package/dist/types/components/AppRating.d.ts +39 -0
  149. package/dist/types/components/AppRichText.d.ts +7 -0
  150. package/dist/types/components/AppRouteError.d.ts +54 -0
  151. package/dist/types/components/AppScoreScale.d.ts +6 -0
  152. package/dist/types/components/AppSearch.d.ts +17 -2
  153. package/dist/types/components/AppSectionLeadCapture.d.ts +48 -0
  154. package/dist/types/components/AppSectionLogos.d.ts +2 -0
  155. package/dist/types/components/AppSegmented.d.ts +27 -3
  156. package/dist/types/components/AppSelect.d.ts +22 -2
  157. package/dist/types/components/AppShell.d.ts +147 -0
  158. package/dist/types/components/AppSlider.d.ts +28 -0
  159. package/dist/types/components/AppSortableList.d.ts +5 -0
  160. package/dist/types/components/AppSparkline.d.ts +24 -0
  161. package/dist/types/components/AppSplitView.d.ts +68 -0
  162. package/dist/types/components/AppStepper.d.ts +6 -0
  163. package/dist/types/components/AppSwitch.d.ts +22 -0
  164. package/dist/types/components/AppTablePagination.d.ts +44 -2
  165. package/dist/types/components/AppTableToolbar.d.ts +30 -0
  166. package/dist/types/components/AppTagInput.d.ts +18 -1
  167. package/dist/types/components/AppTextarea.d.ts +20 -0
  168. package/dist/types/components/AppTimePicker.d.ts +17 -0
  169. package/dist/types/components/AppTimeline.d.ts +8 -0
  170. package/dist/types/components/AppToast.d.ts +6 -0
  171. package/dist/types/components/AppUpdateBar.d.ts +18 -0
  172. package/dist/types/components/AppWhatsNew.d.ts +2 -0
  173. package/dist/types/components/AppWorkspaceSwitcher.d.ts +18 -0
  174. package/dist/types/components/iconGlyphs.g.d.ts +1 -0
  175. package/dist/types/components/iconVariants.g.d.ts +5 -0
  176. package/dist/types/components/useWuiControl.d.ts +3 -1
  177. package/dist/types/index.d.ts +6 -0
  178. package/dist/types/lib/FileItemRow.d.ts +9 -2
  179. package/dist/types/lib/fieldState.d.ts +3 -0
  180. package/dist/types/lib/fillLabel.d.ts +1 -0
  181. package/dist/types/lib/labelWithHelp.d.ts +10 -0
  182. package/dist/types/lib/linkTarget.d.ts +30 -0
  183. package/dist/ui-react.js +1 -1
  184. package/package.json +7 -7
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.128.0",
3
+ "version": "0.129.0",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 13,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.128.0"
9
+ "version": "0.129.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "23166d1a187dabddb0d719f05977e577152fff7da7b8046272a69d6679e85ca6",
14
- "bytes": 868170
13
+ "sha256": "17d3dbd2808e2a61dd0bebd86a17a72109ac9601be1708f9fb95753cc8e87267",
14
+ "bytes": 970294
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "0f22750cc3d1137b8adeb8070ce62140ca6eb5ed723151d55df078f0383a1af9",
18
- "bytes": 10998717
17
+ "sha256": "800fdaf4b5f6d8af24abc65207b371945dec23911750bb256b670003bc454b94",
18
+ "bytes": 11132389
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
@@ -0,0 +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];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 +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"./warnUnknownProps.js";import{jsx as a}from"react/jsx-runtime";function o(o){let{marker:s,props:c}=e(`AppAsyncBlock`,o),{loading:l=!1,error:u=null,empty:d=!1,children:f,onRetry:p,skeleton:m,className:h=``,...g}=c;i(`AppAsyncBlock`,g);let _=`async-block${h?` ${h}`:``}`;return l?/* @__PURE__ */ a(`div`,{className:_,"data-state":`loading`,...s,...g,children:m??/* @__PURE__ */ a(r,{value:0,indeterminate:!0,size:`sm`,label:`Loading`})}):u?/* @__PURE__ */ a(`div`,{className:_,"data-state":`error`,...s,...g,children:/* @__PURE__ */ a(n,{icon:`alert-circle`,title:`Something went wrong`,text:u,action:p?/* @__PURE__ */ a(t,{variant:`secondary`,onClick:p,children:`Retry`}):null})}):d?/* @__PURE__ */ a(`div`,{className:_,"data-state":`empty`,...s,...g,children:/* @__PURE__ */ a(n,{icon:`inbox`,title:`Nothing to show yet`})}):/* @__PURE__ */ a(`div`,{className:_,"data-state":`content`,...s,...g,children:f})}export{o 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"./warnUnknownProps.js";import{jsx as a}from"react/jsx-runtime";function o(o){let{marker:s,props:c}=e(`AppAsyncBlock`,o),{loading:l=!1,error:u=null,empty:d=!1,children:f,onRetry:p,skeleton:m,className:h=``,loadingLabel:g=`Loading`,errorTitle:_=`Something went wrong`,retryLabel:v=`Retry`,emptyTitle:y=`Nothing to show yet`,...b}=c;i(`AppAsyncBlock`,b);let x=`async-block${h?` ${h}`:``}`;return l?/* @__PURE__ */ a(`div`,{className:x,"data-state":`loading`,...s,...b,children:m??/* @__PURE__ */ a(r,{value:0,indeterminate:!0,size:`sm`,label:g})}):u?/* @__PURE__ */ a(`div`,{className:x,"data-state":`error`,...s,...b,children:/* @__PURE__ */ a(n,{icon:`alert-circle`,title:_,text:u,action:p?/* @__PURE__ */ a(t,{variant:`secondary`,onClick:p,children:v}):null})}):d?/* @__PURE__ */ a(`div`,{className:x,"data-state":`empty`,...s,...b,children:/* @__PURE__ */ a(n,{icon:`inbox`,title:y})}):/* @__PURE__ */ a(`div`,{className:x,"data-state":`content`,...s,...b,children:f})}export{o as default};
@@ -0,0 +1 @@
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`centred`,`split`],o={sm:360,md:420,lg:520},s=e=>e!=null&&e!==!1;function c(c){let{marker:l,props:u}=e(`AppAuthLayout`,c),{logo:d,variant:f=`centred`,maxWidth:p=`md`,aside:m,footer:h,children:g,className:_=``,...v}=u;n(`AppAuthLayout`,v),t(`AppAuthLayout`,`variant`,f,a),t(`AppAuthLayout`,`maxWidth`,typeof p==`string`?p:null,Object.keys(o));let{style:y,...b}=v,x=typeof p==`number`&&p>0?p:o[p]??o.md,S=f===`split`&&s(m);return/* @__PURE__ */ i(`div`,{className:`wui-auth ${S?`wui-auth-split`:`wui-auth-centred`}${_?` ${_}`:``}`,style:{"--wui-auth-width":`${x}px`,...y},...l,...b,children:[/* @__PURE__ */ r(`div`,{className:`wui-auth-main`,children:/* @__PURE__ */ i(`div`,{className:`wui-auth-panel`,children:[s(d)&&/* @__PURE__ */ r(`div`,{className:`wui-auth-logo`,children:d}),/* @__PURE__ */ r(`div`,{className:`wui-auth-body`,children:g}),s(h)&&/* @__PURE__ */ r(`div`,{className:`wui-auth-footer`,children:h})]})}),S&&/* @__PURE__ */ r(`aside`,{className:`wui-auth-aside`,children:m})]})}export{c as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import i from"./useNodeLabels.js";import a,{optionsEqual as o}from"./useWuiControl.js";import s from"./warnInvalidValue.js";import c from"./warnUnknownProps.js";import{forwardRef as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var ee=[`sm`,`lg`],te=[],g=(e,t)=>({...e,label:t}),_=(e,t,n)=>{if(n==null||t==null||t===``)return e;let r=String(t);return e.some(e=>String(e.value)===r)?e:[...e,{value:r,label:n}]},v=l(function(l,v){let{marker:y,props:b}=t(`AppAutocomplete`,l),{value:x,onChange:S,options:C,valueLabel:w,valueAvatar:T,valueInitials:E,loadOptions:D,placeholder:O=`Search…`,minChars:k,debounce:A,disabled:ne=!1,open:j,size:M,allowCustom:N=!1,name:P,id:F,label:I,error:L,hint:R,required:z=!1,optional:B=!1,help:V,helpLabel:H=`More information`,fieldClassName:U=``,...W}=b;c(`AppAutocomplete`,W),s(`AppAutocomplete`,`size`,M,ee);let G=typeof D==`function`,K=d(),q=F||K,{setRef:J,innerRef:Y}=a({ref:v,value:x??``,on:{change:e=>S?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),X=C||te,{portal:re,toElementOptions:Z}=i(X),Q=p(!1),$=p(D);return f(()=>{$.current=D}),u(()=>{let e=Y.current;if(!e||G&&Q.current)return;let t=Z(_(X,x,w),g);o(t,e.options)||(e.options=t)},[X,G,Y,Z,x,w]),u(()=>{let e=Y.current;if(!e||!G||!Q.current)return;let t=e.options,n=_(t,x,w);n!==t&&(e.options=n)},[x,w,G,Y]),u(()=>{let e=Y.current;if(!e||!G)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await $.current(r.detail.query,{signal:n?.signal});i===t&&(Q.current=!0,e.options=a||[])}catch{i===t&&(Q.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[G,Y]),/* @__PURE__ */ h(`div`,{...y,className:`field${U?` ${U}`:``}`,children:[I&&/* @__PURE__ */ h(`label`,{className:`label`,htmlFor:q,children:[I,B&&!z&&/* @__PURE__ */ m(`span`,{className:`label-optional`,children:` (optional)`}),z&&/* @__PURE__ */ m(r,{}),V&&/* @__PURE__ */ m(n,{label:H,children:V})]}),/* @__PURE__ */ m(`wui-autocomplete`,{"aria-label":typeof I==`string`?I:void 0,"aria-describedby":L?`${q}-error`:R?`${q}-hint`:void 0,"aria-invalid":L?`true`:void 0,id:q,ref:J,name:P,placeholder:O,remote:G?``:void 0,"min-chars":k==null?void 0:String(k),debounce:A==null?void 0:String(A),size:M||void 0,"allow-custom":N?``:void 0,disabled:ne?``:void 0,open:j?``:void 0,required:z?``:void 0,"value-avatar":T||void 0,"value-initials":E||void 0,...W}),re,/* @__PURE__ */ m(e,{error:L,hint:R,errorId:`${q}-error`,hintId:`${q}-hint`})]})});export{v as default};
1
+ import e from"../lib/FieldMessage.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import i from"./useNodeLabels.js";import a,{optionsEqual as o}from"./useWuiControl.js";import s from"./warnInvalidValue.js";import ee from"./warnUnknownProps.js";import{forwardRef as c,useEffect as l,useId as u,useLayoutEffect as d,useRef as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var h=[`sm`,`md`,`lg`],te=[],ne=(e,t)=>({...e,label:t}),g=(e,t,n)=>{if(n==null||t==null||t===``)return e;let r=String(t);return e.some(e=>String(e.value)===r)?e:[...e,{value:r,label:n}]},_=c(function(c,_){let{marker:v,props:y}=t(`AppAutocomplete`,c),{value:b,defaultValue:x,onChange:S,options:C,valueLabel:w,valueAvatar:T,valueInitials:E,loadOptions:D,placeholder:re=`Search…`,minChars:O,debounce:k,disabled:ie=!1,readOnly:ae=!1,loading:A=!1,open:j,size:M,allowCustom:N=!1,name:P,id:F,label:I,error:L,hint:R,required:z=!1,optional:B=!1,optionalLabel:V=`(optional)`,help:H,helpLabel:U=`More information`,fieldClassName:W=``,...G}=y;ee(`AppAutocomplete`,G),s(`AppAutocomplete`,`size`,M,h);let K=typeof D==`function`,q=u(),J=F||q,{setRef:oe,innerRef:Y}=a({ref:_,value:b??(x===void 0?``:void 0),defaultValue:x,on:{change:e=>S?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),X=C||te,{portal:se,toElementOptions:Z}=i(X),Q=f(!1),$=f(D);return d(()=>{$.current=D}),l(()=>{let e=Y.current;if(!e||K&&Q.current)return;let t=Z(g(X,b,w),ne);o(t,e.options)||(e.options=t)},[X,K,Y,Z,b,w]),l(()=>{let e=Y.current;if(!e||!K||!Q.current)return;let t=e.options,n=g(t,b,w);n!==t&&(e.options=n)},[b,w,K,Y]),l(()=>{let e=Y.current;if(!e||!K)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await $.current(r.detail.query,{signal:n?.signal});i===t&&(Q.current=!0,e.options=a||[])}catch{i===t&&(Q.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[K,Y]),d(()=>{Y.current?.toggleAttribute(`loading`,!!A)}),/* @__PURE__ */ m(`div`,{...v,className:`field${W?` ${W}`:``}`,children:[I&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:J,children:[I,B&&!z&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${V}`}),z&&/* @__PURE__ */ p(r,{}),H&&/* @__PURE__ */ p(n,{label:U,children:H})]}),/* @__PURE__ */ p(`wui-autocomplete`,{"aria-label":typeof I==`string`?I:void 0,"aria-describedby":L?`${J}-error`:R?`${J}-hint`:void 0,"aria-invalid":L?`true`:void 0,id:J,ref:oe,name:P,placeholder:re,remote:K?``:void 0,"min-chars":O==null?void 0:String(O),debounce:k==null?void 0:String(k),size:M===`md`?void 0:M||void 0,"allow-custom":N?``:void 0,disabled:ie?``:void 0,readonly:ae?``:void 0,open:j?``:void 0,required:z?``:void 0,"value-avatar":T||void 0,"value-initials":E||void 0,...G}),se,/* @__PURE__ */ p(e,{error:L,hint:R,errorId:`${J}-error`,hintId:`${J}-hint`})]})});export{_ as default};
@@ -1 +1 @@
1
- import{initialsOf as e}from"../lib/initials.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./renderIconProp.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import a from"./withTooltip.js";import{useEffect as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`circle`,`rounded`,`square`],f=[`primary`,`neutral`,`success`,`warning`,`danger`,`info`,`auto`],p=[`none`,`online`,`offline`,`away`,`busy`],m=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],h=/* @__PURE__ */ new Set([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),g={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function _(t){return e(t)||`?`}function v(e){let t=e||``,n=0;for(let e=0;e<t.length;e+=1)n=Math.imul(n,31)+t.charCodeAt(e)>>>0;return n%360}function y(e){if(typeof e==`number`)return e;if(g[e]!=null)return g[e];let t=Number.parseInt(e,10);return Number.isNaN(t)?32:t}function b(e){let{marker:g,props:b}=t(`AppAvatar`,e),{name:x,src:S,size:C=`md`,shape:w=`circle`,tone:T=`primary`,status:E=`none`,ring:D=!1,label:O,icon:k,iconVariant:A,badge:j,href:M,onClick:N,linkComponent:P,tooltip:F,tooltipPlacement:I,className:L=``,...R}=b;i(`AppAvatar`,R),r(`AppAvatar`,`shape`,w,d),r(`AppAvatar`,`tone`,T,f),r(`AppAvatar`,`status`,E,p),r(`AppAvatar`,`iconVariant`,A,m);let{style:z,...B}=R,[V,H]=s(!1);o(()=>{H(!1)},[S]);let U=typeof C==`string`&&h.has(C),W=U?null:typeof C==`number`||/^\d+$/.test(C)?`${C}px`:C,G=M!=null||N!=null,K=S!=null&&S!==``&&!V,q=[`avatar`,U&&C!==`md`?`avatar-${C}`:``,w===`circle`?``:`avatar-${w}`,T===`primary`?``:`avatar-${T}`,D?`avatar-ring`:``,G?`avatar-clickable`:``,L].filter(Boolean).join(` `),J={};W&&(J[`--avatar-size`]=W),T===`auto`&&(J[`--avatar-hue`]=v(x));let Y=Object.keys(J).length||z?{...J,...z}:void 0,X=/* @__PURE__ */ l(`span`,{className:`avatar-face`,"aria-hidden":`true`,children:k!=null&&k!==!1&&k!==``?n(k,{size:Math.round(y(C)*.55),variant:A}):_(x)}),Z=/* @__PURE__ */ u(c,{children:[E!==`none`&&/* @__PURE__ */ l(`span`,{className:`avatar-status avatar-status-${E}`,"aria-hidden":`true`}),j!=null&&/* @__PURE__ */ l(`span`,{className:`avatar-badge`,children:j}),O!=null&&/* @__PURE__ */ l(`span`,{className:`avatar-label`,"aria-hidden":`true`,children:O})]}),Q=/* @__PURE__ */ u(c,{children:[X,K&&/* @__PURE__ */ l(`img`,{className:`avatar-img`,src:S,alt:G?``:x||`Profile photo`,onError:()=>H(!0)}),Z]});if(M!=null){let e=P||`a`,t=P?{to:M}:{href:M};return a(/* @__PURE__ */ l(e,{className:q,style:Y,...g,...B,"aria-label":O||x,...t,onClick:N,children:Q}),F,I)}if(N!=null)return a(/* @__PURE__ */ l(`button`,{type:`button`,className:q,style:Y,...g,...B,"aria-label":O||x,onClick:N,children:Q}),F,I);if(K)return a(/* @__PURE__ */ l(`span`,{className:q,style:Y,...g,...B,children:Q}),F,I);let $=O?.trim()||x?.trim();return a($?/* @__PURE__ */ l(`span`,{className:q,style:Y,...g,...B,role:`img`,"aria-label":$,children:Q}):/* @__PURE__ */ l(`span`,{className:q,style:Y,...g,...B,"aria-hidden":`true`,children:Q}),F,I)}export{b as default};
1
+ import{initialsOf as e}from"../lib/initials.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./renderIconProp.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import a from"./withTooltip.js";import{useEffect as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";var d=[`circle`,`rounded`,`square`],f=[`primary`,`neutral`,`success`,`warning`,`danger`,`info`,`auto`],p=[`none`,`online`,`offline`,`away`,`busy`],m=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],h=/* @__PURE__ */ new Set([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),g={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function _(t){return e(t)||`?`}function v(e){let t=e||``,n=0;for(let e=0;e<t.length;e+=1)n=Math.imul(n,31)+t.charCodeAt(e)>>>0;return n%360}function y(e){if(typeof e==`number`)return e;if(g[e]!=null)return g[e];let t=Number.parseInt(e,10);return Number.isNaN(t)?32:t}function b(e){let{marker:g,props:b}=t(`AppAvatar`,e),{name:x,src:S,size:C=`md`,shape:w=`circle`,tone:T=`primary`,status:E=`none`,ring:D=!1,label:O,icon:k,iconVariant:A,badge:j,href:M,onClick:N,linkComponent:P,tooltip:F,tooltipPlacement:I,className:L=``,photoLabel:R=`Profile photo`,...z}=b;i(`AppAvatar`,z),r(`AppAvatar`,`shape`,w,d),r(`AppAvatar`,`tone`,T,f),r(`AppAvatar`,`status`,E,p),r(`AppAvatar`,`iconVariant`,A,m);let{style:B,...V}=z,[H,U]=s(!1);o(()=>{U(!1)},[S]);let W=typeof C==`string`&&h.has(C),G=W?null:typeof C==`number`||/^\d+$/.test(C)?`${C}px`:C,K=M!=null||N!=null,q=S!=null&&S!==``&&!H,J=[`avatar`,W&&C!==`md`?`avatar-${C}`:``,w===`circle`?``:`avatar-${w}`,T===`primary`?``:`avatar-${T}`,D?`avatar-ring`:``,K?`avatar-clickable`:``,L].filter(Boolean).join(` `),Y={};G&&(Y[`--avatar-size`]=G),T===`auto`&&(Y[`--avatar-hue`]=v(x));let X=Object.keys(Y).length||B?{...Y,...B}:void 0,Z=/* @__PURE__ */ l(`span`,{className:`avatar-face`,"aria-hidden":`true`,children:k!=null&&k!==!1&&k!==``?n(k,{size:Math.round(y(C)*.55),variant:A}):_(x)}),ee=/* @__PURE__ */ u(c,{children:[E!==`none`&&/* @__PURE__ */ l(`span`,{className:`avatar-status avatar-status-${E}`,"aria-hidden":`true`}),j!=null&&/* @__PURE__ */ l(`span`,{className:`avatar-badge`,children:j}),O!=null&&/* @__PURE__ */ l(`span`,{className:`avatar-label`,"aria-hidden":`true`,children:O})]}),Q=/* @__PURE__ */ u(c,{children:[Z,q&&/* @__PURE__ */ l(`img`,{className:`avatar-img`,src:S,alt:K?``:x||R,onError:()=>U(!0)}),ee]});if(M!=null){let e=P||`a`,t=P?{to:M}:{href:M};return a(/* @__PURE__ */ l(e,{className:J,style:X,...g,...V,"aria-label":O||x,...t,onClick:N,children:Q}),F,I)}if(N!=null)return a(/* @__PURE__ */ l(`button`,{type:`button`,className:J,style:X,...g,...V,"aria-label":O||x,onClick:N,children:Q}),F,I);if(q)return a(/* @__PURE__ */ l(`span`,{className:J,style:X,...g,...V,children:Q}),F,I);let $=O?.trim()||x?.trim();return a($?/* @__PURE__ */ l(`span`,{className:J,style:X,...g,...V,role:`img`,"aria-label":$,children:Q}):/* @__PURE__ */ l(`span`,{className:J,style:X,...g,...V,"aria-hidden":`true`,children:Q}),F,I)}export{b as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`tight`,`normal`,`loose`],o={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function s(e){return e==null?null:typeof e==`number`?`${e}px`:o[e]==null?/^\d+$/.test(e)?`${e}px`:e:`${o[e]}px`}function c(o){let{marker:c,props:l}=e(`AppAvatarGroup`,o),{children:u,size:d,spacing:f=`normal`,overflow:p,className:m=``,...h}=l;n(`AppAvatarGroup`,h),t(`AppAvatarGroup`,`spacing`,f,a);let{style:g,..._}=h,v=[`avatar-group`,f===`normal`?``:`avatar-group-${f}`,m].filter(Boolean).join(` `),y=s(d),b=y?{"--avatar-size":y,...g}:g,x=typeof p==`string`?Number.parseInt(p,10):p,S=typeof p==`string`&&!/^\d+$/.test(p)?p:`+${x}`;return/* @__PURE__ */ i(`div`,{className:v,style:b,...c,..._,children:[u,x>0&&/* @__PURE__ */ r(`span`,{className:`avatar avatar-more`,role:`img`,"aria-label":`${x} more`,children:S})]})}export{c as default};
1
+ import e from"../lib/fillLabel.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";var o=[`tight`,`normal`,`loose`],s={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function c(e){return e==null?null:typeof e==`number`?`${e}px`:s[e]==null?/^\d+$/.test(e)?`${e}px`:e:`${s[e]}px`}function l(s){let{marker:l,props:u}=t(`AppAvatarGroup`,s),{children:d,size:f,spacing:p=`normal`,overflow:m,moreLabel:h=`{count} more`,className:g=``,..._}=u;r(`AppAvatarGroup`,_),n(`AppAvatarGroup`,`spacing`,p,o);let{style:v,...y}=_,b=[`avatar-group`,p===`normal`?``:`avatar-group-${p}`,g].filter(Boolean).join(` `),x=c(f),S=x?{"--avatar-size":x,...v}:v,C=typeof m==`string`?Number.parseInt(m,10):m,w=typeof m==`string`&&!/^\d+$/.test(m)?m:`+${C}`;return/* @__PURE__ */ a(`div`,{className:b,style:S,...l,...y,children:[d,C>0&&/* @__PURE__ */ i(`span`,{className:`avatar avatar-more`,role:`img`,"aria-label":e(h,{count:C}),children:w})]})}export{l as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./renderIconProp.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import{useState as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`info`,`success`,`warning`,`danger`,`neutral`];function l(l){let{marker:u,props:d}=e(`AppBanner`,l),{tone:f=`info`,icon:p,children:m,dismissible:h=!1,onDismiss:g,action:_,className:v=``,...y}=d;i(`AppBanner`,y),r(`AppBanner`,`tone`,f,c);let[b,x]=a(!0);if(!b)return null;let S=c.includes(f)?f:`info`,C=_!=null&&_!==!1,w=()=>{x(!1),g?.()};return/* @__PURE__ */ s(`div`,{className:`wui-banner wui-banner-${S}${C?` wui-banner-has-action`:``}${v?` ${v}`:``}`,role:`status`,...u,...y,children:[p&&/* @__PURE__ */ o(`span`,{className:`wui-banner-icon`,children:n(p,{size:18})}),/* @__PURE__ */ o(`div`,{className:`wui-banner-body`,children:m}),C&&/* @__PURE__ */ o(`div`,{className:`wui-banner-action`,children:_}),h&&/* @__PURE__ */ o(`button`,{type:`button`,className:`wui-banner-dismiss`,"aria-label":`Dismiss`,onClick:w,children:/* @__PURE__ */ o(t,{name:`x`,size:18})})]})}export{l as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./renderIconProp.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import{useState as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`info`,`success`,`warning`,`danger`,`neutral`];function l(l){let{marker:u,props:d}=e(`AppBanner`,l),{tone:f=`info`,icon:p,children:m,dismissible:h=!1,onDismiss:g,action:_,className:v=``,dismissLabel:y=`Dismiss`,...b}=d;i(`AppBanner`,b),r(`AppBanner`,`tone`,f,c);let[x,S]=a(!0);if(!x)return null;let C=c.includes(f)?f:`info`,w=_!=null&&_!==!1,T=()=>{S(!1),g?.()};return/* @__PURE__ */ s(`div`,{className:`wui-banner wui-banner-${C}${w?` wui-banner-has-action`:``}${v?` ${v}`:``}`,role:`status`,...u,...b,children:[p&&/* @__PURE__ */ o(`span`,{className:`wui-banner-icon`,children:n(p,{size:18})}),/* @__PURE__ */ o(`div`,{className:`wui-banner-body`,children:m}),w&&/* @__PURE__ */ o(`div`,{className:`wui-banner-action`,children:_}),h&&/* @__PURE__ */ o(`button`,{type:`button`,className:`wui-banner-dismiss`,"aria-label":y,onClick:T,children:/* @__PURE__ */ o(t,{name:`x`,size:18})})]})}export{l as default};
@@ -1 +1 @@
1
- import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./warnInvalidValue.js";import a from"./warnUnknownProps.js";import o from"./withTooltip.js";import{Button as s}from"react-bootstrap";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u={primary:`primary`,secondary:`secondary`,outline:`outline-primary`,ghost:`ghost`,text:`text`,danger:`danger`,success:`success`,"secondary-danger":`secondary-danger`,"outline-danger":`outline-danger`,light:`light`,warning:`warning`,neutral:`neutral`,"outline-light":`outline-light`,"outline-secondary":`outline-secondary`};function d(e){return`btn-${u[e]??`primary`}`}var f={sm:14,md:16,lg:20},p=[`sheen`,`fill`,`expand`,`glow`,`roll`,`none`],m=[`rounded`,`pill`,`sharp`],h=[`button`,`submit`,`reset`],g=/* @__PURE__ */ new Set([!0,!1,...Array.from({length:100},(e,t)=>t+1)]),_=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],v=e=>e===`pill`||e===`sharp`?`wui-btn-shape-${e}`:``;function y(e){return/* @__PURE__ */ l(`span`,{className:`wui-btn-roll`,children:[/* @__PURE__ */ c(`span`,{className:`wui-btn-roll__a`,children:e}),/* @__PURE__ */ c(`span`,{className:`wui-btn-roll__b`,"aria-hidden":`true`,children:e})]})}function b(e,t,n,i){if(!e)return null;let a=n=>typeof e==`string`?/* @__PURE__ */ c(r,{name:e,size:f[t]??f.md,variant:i,className:n}):/* @__PURE__ */ c(`span`,{className:[`d-inline-flex`,n].filter(Boolean).join(` `),children:e});return/* @__PURE__ */ l(`span`,{className:n?`wui-btn-roll-ico wui-btn-pin-icon`:`wui-btn-roll-ico ms-2`,"aria-hidden":`true`,children:[a(),a(`wui-btn-roll-ico__next`)]})}function x(e,t,n,i){if(!e)return null;let a=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?/* @__PURE__ */ c(r,{name:e,size:f[n]??f.md,variant:i,className:a}):/* @__PURE__ */ c(`span`,{className:`d-inline-flex ${a}`,children:e})}function S(e,t,n){return e?/* @__PURE__ */ c(`span`,{className:`wui-btn-pin-icon`,"aria-hidden":`true`,children:typeof e==`string`?/* @__PURE__ */ c(r,{name:e,size:f[t]??f.md,variant:n}):e}):null}function C(r){let{marker:d,props:C}=n(`AppButton`,r),{children:w,variant:T=`primary`,size:E=`md`,type:D=`button`,loading:O=!1,disabled:k=!1,block:A=!1,leftIcon:j=null,rightIcon:M=null,href:N,static:P=!1,tooltip:F,tooltipPlacement:I,shortcut:L,animation:R,pinRightIcon:z=!1,shape:B=`rounded`,iconVariant:V,className:H=``,onClick:U,vibrate:W,...G}=C;a(`AppButton`,G),i(`AppButton`,`vibrate`,W,g);let K=W===!0?10:Number.isInteger(W)&&W>=1&&W<=100?W:0;R!==void 0&&i(`AppButton`,`animation`,R,p);let q=R===`roll`&&!P,J=z&&M!=null&&M!==``&&!P&&!O;if(i(`AppButton`,`variant`,T,Object.keys(u)),i(`AppButton`,`size`,E,Object.keys(f)),i(`AppButton`,`shape`,B,m),i(`AppButton`,`type`,D,h),V!==void 0&&i(`AppButton`,`iconVariant`,V,_),P){let e=[`btn`,`btn-${u[T]??`primary`}`,E===`sm`?`btn-sm`:E===`lg`?`btn-lg`:``,A?`w-100`:``,v(B),`btn-static`,H].filter(Boolean).join(` `);return o(/* @__PURE__ */ l(`span`,{className:e,...d,...G,children:[x(j,`left`,E,V),w,x(M,`right`,E,V)]}),F,I)}let Y=[A?`w-100`:``,O?`is-loading`:``,R&&p.includes(R)?`btn-anim-${R}`:``,J?`wui-btn-pin-end`:``,v(B),H].filter(Boolean).join(` `),X=(G.as===void 0||G.as===`button`)&&N===void 0&&G.to===void 0,Z=X?{}:{role:void 0,tabIndex:k||O?-1:void 0},Q=F!=null&&F!==``,$=K?e=>{!k&&!O&&navigator.vibrate?.(K),U?.(e)}:U;return o(/* @__PURE__ */ l(s,{type:X?D:void 0,href:N,variant:u[T]??`primary`,size:E===`md`?void 0:E,disabled:k||O,"aria-busy":O||void 0,"aria-keyshortcuts":e(L),"data-wui-vibrate":K||void 0,className:Y||void 0,onClick:$,...Z,...d,...G,children:[O&&/* @__PURE__ */ c(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!O&&x(j,`left`,E,V),q?y(w):w,!O&&(q?b(M,E,J,V):J?S(M,E,V):x(M,`right`,E,V)),!Q&&t(L)]}),F,I,L)}export{d as buttonVariantClass,C as default};
1
+ import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./warnInvalidValue.js";import a from"./warnUnknownProps.js";import o from"./withTooltip.js";import{Button as s}from"react-bootstrap";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u={primary:`primary`,secondary:`secondary`,outline:`outline-primary`,ghost:`ghost`,text:`text`,danger:`danger`,success:`success`,"secondary-danger":`secondary-danger`,"outline-danger":`outline-danger`,light:`light`,warning:`warning`,neutral:`neutral`,"outline-light":`outline-light`,"outline-secondary":`outline-secondary`},d=Object.keys(u);function f(e){return`btn-${u[e]??`primary`}`}var p={sm:14,md:16,lg:20},m=[`sheen`,`fill`,`expand`,`glow`,`roll`,`none`],h=[`rounded`,`pill`,`sharp`],g=[`button`,`submit`,`reset`],_=/* @__PURE__ */ new Set([!0,!1,...Array.from({length:100},(e,t)=>t+1)]),v=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],y=e=>e===`pill`||e===`sharp`?`wui-btn-shape-${e}`:``;function b(e){return/* @__PURE__ */ l(`span`,{className:`wui-btn-roll`,children:[/* @__PURE__ */ c(`span`,{className:`wui-btn-roll__a`,children:e}),/* @__PURE__ */ c(`span`,{className:`wui-btn-roll__b`,"aria-hidden":`true`,children:e})]})}function x(e,t,n,i){if(!e)return null;let a=n=>typeof e==`string`?/* @__PURE__ */ c(r,{name:e,size:p[t]??p.md,variant:i,className:n}):/* @__PURE__ */ c(`span`,{className:[`d-inline-flex`,n].filter(Boolean).join(` `),children:e});return/* @__PURE__ */ l(`span`,{className:n?`wui-btn-roll-ico wui-btn-pin-icon`:`wui-btn-roll-ico ms-2`,"aria-hidden":`true`,children:[a(),a(`wui-btn-roll-ico__next`)]})}function S(e,t,n,i){if(!e)return null;let a=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?/* @__PURE__ */ c(r,{name:e,size:p[n]??p.md,variant:i,className:a}):/* @__PURE__ */ c(`span`,{className:`d-inline-flex ${a}`,children:e})}function C(e,t,n){return e?/* @__PURE__ */ c(`span`,{className:`wui-btn-pin-icon`,"aria-hidden":`true`,children:typeof e==`string`?/* @__PURE__ */ c(r,{name:e,size:p[t]??p.md,variant:n}):e}):null}function w(r){let{marker:d,props:f}=n(`AppButton`,r),{children:w,variant:T=`primary`,size:E=`md`,type:D=`button`,loading:O=!1,disabled:k=!1,block:A=!1,leftIcon:j=null,rightIcon:M=null,href:N,static:P=!1,tooltip:F,tooltipPlacement:I,shortcut:L,animation:R,pinRightIcon:z=!1,shape:B=`rounded`,iconVariant:V,className:H=``,onClick:U,vibrate:W,...G}=f;a(`AppButton`,G),i(`AppButton`,`vibrate`,W,_);let K=W===!0?10:Number.isInteger(W)&&W>=1&&W<=100?W:0;R!==void 0&&i(`AppButton`,`animation`,R,m);let q=R===`roll`&&!P,J=z&&M!=null&&M!==``&&!P&&!O;if(i(`AppButton`,`variant`,T,Object.keys(u)),i(`AppButton`,`size`,E,Object.keys(p)),i(`AppButton`,`shape`,B,h),i(`AppButton`,`type`,D,g),V!==void 0&&i(`AppButton`,`iconVariant`,V,v),P){let e=[`btn`,`btn-${u[T]??`primary`}`,E===`sm`?`btn-sm`:E===`lg`?`btn-lg`:``,A?`w-100`:``,y(B),`btn-static`,H].filter(Boolean).join(` `);return o(/* @__PURE__ */ l(`span`,{className:e,...d,...G,children:[S(j,`left`,E,V),w,S(M,`right`,E,V)]}),F,I)}let Y=[A?`w-100`:``,O?`is-loading`:``,R&&m.includes(R)?`btn-anim-${R}`:``,J?`wui-btn-pin-end`:``,y(B),H].filter(Boolean).join(` `),X=(G.as===void 0||G.as===`button`)&&N===void 0&&G.to===void 0,Z=X?{}:{role:void 0,tabIndex:k||O?-1:void 0},Q=F!=null&&F!==``,$=K?e=>{!k&&!O&&navigator.vibrate?.(K),U?.(e)}:U;return o(/* @__PURE__ */ l(s,{type:X?D:void 0,href:N,variant:u[T]??`primary`,size:E===`md`?void 0:E,disabled:k||O,"aria-busy":O||void 0,"aria-keyshortcuts":e(L),"data-wui-vibrate":K||void 0,className:Y||void 0,onClick:$,...Z,...d,...G,children:[O&&/* @__PURE__ */ c(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!O&&S(j,`left`,E,V),q?b(w):w,!O&&(q?x(M,E,J,V):J?C(M,E,V):S(M,`right`,E,V)),!Q&&t(L)]}),F,I,L)}export{d as BUTTON_VARIANTS,f as buttonVariantClass,w as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as l}from"react";import{jsx as u}from"react/jsx-runtime";var d=`wui-calendar:event-click`,f=`wui-calendar:date-click`,p=`wui-calendar:range-change`,m=[`month`,`week`,`day`,`list`],h=`This calendar couldn't load. Try again in a moment.`,g=i(function(i,g){let{marker:_,props:v}=t(`AppCalendar`,i),{label:y,events:b,eventsUrl:x,view:S,date:C,emptyText:w,errorText:T,firstDay:E,onEventClick:D,onDateClick:O,onRangeChange:k,className:A=``,style:j,...M}=v;r(`AppCalendar`,M),n(`AppCalendar`,`view`,S,m);let N=c(null),P=c(``),F=c({onEventClick:D,onDateClick:O,onRangeChange:k}),[I,L]=l(!1),R=a(e=>{N.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]);return o(()=>{F.current={onEventClick:D,onDateClick:O,onRangeChange:k}}),s(()=>{let e=N.current;if(!e)return;let t=b==null?``:JSON.stringify(b);t!==P.current&&(P.current=t,e.events=b??null)}),o(()=>{let e=N.current,t=[[d,e=>{F.current.onEventClick?.(e.detail)===!1&&e.preventDefault()}],[f,e=>F.current.onDateClick?.(e.detail)],[p,e=>F.current.onRangeChange?.(e.detail)]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),o(()=>{let t=!0;return import(`@webority/ui-elements/calendar`).catch(n=>{e(`[AppCalendar] the calendar failed to load:`,n?.message),t&&L(!0)}),()=>{t=!1}},[]),I?/* @__PURE__ */ u(`div`,{..._,className:A||void 0,style:j,role:`status`,children:/* @__PURE__ */ u(`p`,{className:`wui-calendar-status-text`,children:T||h})}):/* @__PURE__ */ u(`wui-calendar`,{ref:R,label:y||void 0,"events-url":x||void 0,view:S||void 0,date:C||void 0,"empty-text":w||void 0,"error-text":T||void 0,"first-day":E==null?void 0:String(E),className:A||void 0,style:j,..._,...M})});export{g as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as l}from"react";import{jsx as u}from"react/jsx-runtime";var d=`wui-calendar:event-click`,f=`wui-calendar:date-click`,p=`wui-calendar:range-change`,m=[`month`,`week`,`day`,`list`],h=`This calendar couldn't load. Try again in a moment.`,g=i(function(i,g){let{marker:_,props:v}=t(`AppCalendar`,i),{label:y,events:b,eventsUrl:x,view:S,date:C,emptyText:w,errorText:T,firstDay:E,timeZone:D,onEventClick:O,onDateClick:k,onRangeChange:A,className:j=``,style:M,...N}=v;r(`AppCalendar`,N),n(`AppCalendar`,`view`,S,m);let P=c(null),F=c(``),I=c({onEventClick:O,onDateClick:k,onRangeChange:A}),[L,R]=l(!1),z=a(e=>{P.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]);return o(()=>{I.current={onEventClick:O,onDateClick:k,onRangeChange:A}}),s(()=>{let e=P.current;if(!e)return;let t=b==null?``:JSON.stringify(b);t!==F.current&&(F.current=t,e.events=b??null)}),o(()=>{let e=P.current,t=[[d,e=>{I.current.onEventClick?.(e.detail)===!1&&e.preventDefault()}],[f,e=>I.current.onDateClick?.(e.detail)],[p,e=>I.current.onRangeChange?.(e.detail)]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),o(()=>{let t=!0;return import(`@webority/ui-elements/calendar`).catch(n=>{e(`[AppCalendar] the calendar failed to load:`,n?.message),t&&R(!0)}),()=>{t=!1}},[]),L?/* @__PURE__ */ u(`div`,{..._,className:j||void 0,style:M,role:`status`,children:/* @__PURE__ */ u(`p`,{className:`wui-calendar-status-text`,children:T||h})}):/* @__PURE__ */ u(`wui-calendar`,{ref:z,label:y||void 0,"events-url":x||void 0,view:S||void 0,date:C||void 0,"empty-text":w||void 0,"error-text":T||void 0,"first-day":E==null?void 0:String(E),"time-zone":D||void 0,className:j||void 0,style:M,..._,...N})});export{g as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{useState as i}from"react";import{Card as a}from"react-bootstrap";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`default`,`elevated`,`outlined`,`muted`,`accent`],u=[`primary`,`success`,`warning`,`danger`,`info`],d=[`none`,`sm`,`md`,`lg`],f=[`sans`,`serif`],p={xs:320,sm:420,md:560,lg:720};function m(m){let{marker:h,props:g}=e(`AppCard`,m),{title:_,subtitle:v,headerIcon:y,titleClassName:b=``,titleFont:x=`sans`,header:S,headerExtra:C,headerActions:w,footer:T,media:E,children:D,variant:O=`default`,tone:k=`primary`,padding:A=`md`,maxWidth:j,className:M=``,bodyClassName:ee=``,headerClassName:te=``,body:N=!0,lifted:P=!1,href:F,onClick:I,linkComponent:L,onClose:R,dismissible:z,closeLabel:B=`Close`,...V}=g,[H,U]=i(!1);r(`AppCard`,V),n(`AppCard`,`variant`,O,l),n(`AppCard`,`tone`,k,u),n(`AppCard`,`padding`,A,d),n(`AppCard`,`titleFont`,x,f);let{style:W,...G}=V,K=F!=null||I!=null,q=[O&&O!=="default"?`card-${O}`:``,O===`accent`&&k&&k!==`primary`?`tone-${k}`:``,A&&A!==`md`?`card-pad-${A}`:``,P?`card-lifted`:``,j==null?``:`card-constrained`,K?`card-clickable`:``,M].filter(Boolean).join(` `)||void 0,J=j==null?void 0:p[j]==null?typeof j==`number`?`${j}px`:j:`${p[j]}px`,Y=J?{"--card-max-width":J,...W}:W,X={};F==null?I!=null&&(X={role:`button`,tabIndex:0,onClick:I,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I(e))}}):(X=L?{as:L,to:F}:{as:`a`,href:F},I&&(X.onClick=I));let Z=z??typeof R==`function`,ne=Z?/* @__PURE__ */ s(`button`,{type:`button`,className:`card-close`,"aria-label":B,onClick:e=>{e.preventDefault(),e.stopPropagation(),U(!0),R?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ s(t,{name:`x`,size:16})}):null,Q=_!=null||v!=null||y!=null,re=S!=null||Q||C!=null||w!=null||Z,$=y==null?null:typeof y==`string`?/* @__PURE__ */ s(t,{name:y,size:18}):y;return H?null:/* @__PURE__ */ c(a,{className:q,style:Y,...h,...G,...X,children:[E!=null&&/* @__PURE__ */ s(`div`,{className:`card-media`,children:E}),re&&/* @__PURE__ */ c(a.Header,{className:te||void 0,children:[S??/* @__PURE__ */ c(o,{children:[Q&&/* @__PURE__ */ c(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ s(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ c(`div`,{className:`card-header-titles`,children:[_!=null&&/* @__PURE__ */ s(`div`,{className:[`card-title`,b].filter(Boolean).join(` `),style:x===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:_}),v!=null&&/* @__PURE__ */ s(`div`,{className:`card-subtitle`,children:v})]})]}),C,w!=null&&/* @__PURE__ */ s(`div`,{className:`card-header-actions`,children:w})]}),ne]}),N?/* @__PURE__ */ s(a.Body,{className:ee||void 0,children:D}):D,T!=null&&/* @__PURE__ */ s(`div`,{className:`card-footer`,children:T})]})}export{m as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{useState as i}from"react";import{Card as a}from"react-bootstrap";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var ee=[`default`,`elevated`,`outlined`,`muted`,`accent`],l=[`primary`,`success`,`warning`,`danger`,`info`],u=[`none`,`sm`,`md`,`lg`],d=[`sans`,`serif`],f={xs:320,sm:420,md:560,lg:720};function p(p){let{marker:m,props:h}=e(`AppCard`,p),{title:g,subtitle:_,headerIcon:v,titleClassName:y=``,titleFont:b=`sans`,header:x,headerExtra:S,headerActions:C,footer:w,media:T,children:E,variant:D=`default`,tone:O=`primary`,padding:k=`md`,maxWidth:A,className:te=``,bodyClassName:ne=``,headerClassName:re=``,body:j=!0,lifted:M=!1,flush:N=!1,divided:P=!1,href:F,onClick:I,linkComponent:L,onClose:R,dismissible:z,closeLabel:B=`Close`,...V}=h,[H,U]=i(!1);r(`AppCard`,V),n(`AppCard`,`variant`,D,ee),n(`AppCard`,`tone`,O,l),n(`AppCard`,`padding`,k,u),n(`AppCard`,`titleFont`,b,d);let{style:W,...G}=V,K=F!=null||I!=null,q=[D&&D!=="default"?`card-${D}`:``,D===`accent`&&O&&O!==`primary`?`tone-${O}`:``,k&&k!==`md`?`card-pad-${k}`:``,N?`card-flush`:``,P?`card-divided`:``,M?`card-lifted`:``,A==null?``:`card-constrained`,K?`card-clickable`:``,te].filter(Boolean).join(` `)||void 0,J=A==null?void 0:f[A]==null?typeof A==`number`?`${A}px`:A:`${f[A]}px`,Y=J?{"--card-max-width":J,...W}:W,X={};F==null?I!=null&&(X={role:`button`,tabIndex:0,onClick:I,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I(e))}}):(X=L?{as:L,to:F}:{as:`a`,href:F},I&&(X.onClick=I));let Z=z??typeof R==`function`,ie=Z?/* @__PURE__ */ s(`button`,{type:`button`,className:`card-close`,"aria-label":B,onClick:e=>{e.preventDefault(),e.stopPropagation(),U(!0),R?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ s(t,{name:`x`,size:16})}):null,Q=g!=null||_!=null||v!=null,ae=x!=null||Q||S!=null||C!=null||Z,$=v==null?null:typeof v==`string`?/* @__PURE__ */ s(t,{name:v,size:18}):v;return H?null:/* @__PURE__ */ c(a,{className:q,style:Y,...m,...G,...X,children:[T!=null&&/* @__PURE__ */ s(`div`,{className:`card-media`,children:T}),ae&&/* @__PURE__ */ c(a.Header,{className:re||void 0,children:[x??/* @__PURE__ */ c(o,{children:[Q&&/* @__PURE__ */ c(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ s(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ c(`div`,{className:`card-header-titles`,children:[g!=null&&/* @__PURE__ */ s(`div`,{className:[`card-title`,y].filter(Boolean).join(` `),style:b===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:g}),_!=null&&/* @__PURE__ */ s(`div`,{className:`card-subtitle`,children:_})]})]}),S,C!=null&&/* @__PURE__ */ s(`div`,{className:`card-header-actions`,children:C})]}),ie]}),j?/* @__PURE__ */ s(a.Body,{className:ne||void 0,children:E}):E,w!=null&&/* @__PURE__ */ s(`div`,{className:`card-footer`,children:w})]})}export{p as default};
@@ -0,0 +1 @@
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";var i=(...e)=>e.filter(Boolean).join(` `),a=e=>e==null||e===``;function o(o){let{marker:s,props:c}=e(`AppCell`,o),{primary:l,secondary:u,href:d,mono:f=!1,numeric:p=!1,className:m=``,...h}=c;t(`AppCell`,h);let g=a(l)?`-`:l;return/* @__PURE__ */ r(`div`,{className:i(`wui-cell`,p&&`wui-cell-numeric`,f&&`wui-cell-mono`,m),...s,...h,children:[d?/* @__PURE__ */ n(`a`,{className:`wui-cell-primary`,href:d,children:g}):/* @__PURE__ */ n(`span`,{className:`wui-cell-primary`,children:g}),a(u)?null:/* @__PURE__ */ n(`span`,{className:`wui-cell-secondary`,children:u})]})}export{o as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as ee}from"react";import{jsx as l}from"react/jsx-runtime";var u=`wui-chart:select`,d=`wui-chart:legend-change`,te=`wui-chart:ready`,f=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],ne=[`none`,`stacked`,`percent`],p=[`ready`,`loading`,`empty`,`error`],m=[`auto`,`svg`,`canvas`],h=[`chart`,`table`],re=`This chart couldn't load. Try again in a moment.`,g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=!1;function v(){!_&&g()&&(_=!0,e("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var y=e=>e===``?void 0:e,b=e=>Array.isArray(e)?e.map(b):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,b(t)])),x=e=>({type:y(e.type),title:y(e.title),description:y(e.description),data:e.data,x:b(e.x),series:b(e.series),group:b(e.group),to:b(e.to),size:b(e.size),trend:e.trend,zoom:e.zoom,bands:b(e.bands),stack:y(e.stack),y:b(e.y),target:b(e.target),centerLabel:y(e.centerLabel),height:e.height>0?e.height:void 0,state:y(e.state),emptyText:y(e.emptyText),errorText:y(e.errorText),renderer:y(e.renderer)}),S=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),C=e=>{try{return JSON.stringify(e)}catch{return null}},w=i(function(i,g){let{marker:_,props:y}=t(`AppChart`,i),{type:b,title:w,description:T,data:E,x:D,series:O,group:k,to:A,size:j,trend:M,zoom:N,bands:P,stack:F,y:I,target:L,centerLabel:R,height:z,state:B,emptyText:V,errorText:H,renderer:U,view:W,onSelect:G,onLegendChange:K,onReady:q,className:J=``,style:Y,...X}=y;r(`AppChart`,X),n(`AppChart`,`type`,b,f),n(`AppChart`,`stack`,F,ne),n(`AppChart`,`state`,B,p),n(`AppChart`,`renderer`,U,m),n(`AppChart`,`view`,W,h),w||v();let Z=c(null),Q=c({props:null,signature:null}),$=c({onSelect:G,onLegendChange:K,onReady:q}),[ie,ae]=ee(!1),oe=a(e=>{Z.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]);return o(()=>{$.current={onSelect:G,onLegendChange:K,onReady:q}}),s(()=>{let e=Z.current;if(!e)return;let t={type:b,title:w,description:T,data:E,x:D,series:O,group:k,to:A,size:j,trend:M,zoom:N,bands:P,stack:F,y:I,target:L,centerLabel:R,height:z,state:B,emptyText:V,errorText:H,renderer:U};if(S(t,Q.current.props))return;Q.current.props=t;let n=x(t),r=C(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),o(()=>{let e=Z.current,t=e=>t=>$.current[e]?.(t.detail),n=[[u,t(`onSelect`)],[d,t(`onLegendChange`)],[te,t(`onReady`)]];for(let[t,r]of n)e.addEventListener(t,r);return()=>{for(let[t,r]of n)e.removeEventListener(t,r)}},[]),o(()=>{let t=!0;return import(`@webority/ui-elements/chart`).catch(n=>{e(`[AppChart] the chart failed to load:`,n?.message),t&&ae(!0)}),()=>{t=!1}},[]),ie?/* @__PURE__ */ l(`div`,{..._,className:J||void 0,style:Y,role:`status`,children:/* @__PURE__ */ l(`p`,{className:`wui-chart-state-text`,children:H||re})}):/* @__PURE__ */ l(`wui-chart`,{ref:oe,view:W||void 0,className:J||void 0,style:Y,..._,...X})});export{w as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i,useCallback as a,useEffect as o,useLayoutEffect as s,useRef as c,useState as ee}from"react";import{jsx as l}from"react/jsx-runtime";var te=`wui-chart:select`,u=`wui-chart:legend-change`,ne=`wui-chart:ready`,d=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],f=[`none`,`stacked`,`percent`],p=[`ready`,`loading`,`empty`,`error`],m=[`auto`,`svg`,`canvas`],h=[`chart`,`table`],re=`This chart couldn't load. Try again in a moment.`,g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=!1;function v(){!_&&g()&&(_=!0,e("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var y=e=>e===``?void 0:e,b=e=>Array.isArray(e)?e.map(b):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,b(t)])),x=e=>({type:y(e.type),title:y(e.title),description:y(e.description),data:e.data,x:b(e.x),series:b(e.series),group:b(e.group),to:b(e.to),size:b(e.size),trend:e.trend,zoom:e.zoom,bands:b(e.bands),stack:y(e.stack),y:b(e.y),target:b(e.target),centerLabel:y(e.centerLabel),height:e.height>0?e.height:void 0,state:y(e.state),emptyText:y(e.emptyText),errorText:y(e.errorText),loadingText:y(e.loadingText),renderer:y(e.renderer),timeZone:y(e.timeZone)}),ie=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),ae=e=>{try{return JSON.stringify(e)}catch{return null}},S=i(function(i,g){let{marker:_,props:y}=t(`AppChart`,i),{type:b,title:S,description:C,data:w,x:T,series:E,group:D,to:O,size:k,trend:A,zoom:j,bands:M,stack:N,y:P,target:F,centerLabel:I,height:L,state:R,emptyText:z,errorText:B,loadingText:V,renderer:H,timeZone:U,view:W,onSelect:G,onLegendChange:K,onReady:q,className:J=``,style:Y,...X}=y;r(`AppChart`,X),n(`AppChart`,`type`,b,d),n(`AppChart`,`stack`,N,f),n(`AppChart`,`state`,R,p),n(`AppChart`,`renderer`,H,m),n(`AppChart`,`view`,W,h),S||v();let Z=c(null),Q=c({props:null,signature:null}),$=c({onSelect:G,onLegendChange:K,onReady:q}),[oe,se]=ee(!1),ce=a(e=>{Z.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]);return o(()=>{$.current={onSelect:G,onLegendChange:K,onReady:q}}),s(()=>{let e=Z.current;if(!e)return;let t={type:b,title:S,description:C,data:w,x:T,series:E,group:D,to:O,size:k,trend:A,zoom:j,bands:M,stack:N,y:P,target:F,centerLabel:I,height:L,state:R,emptyText:z,errorText:B,loadingText:V,renderer:H,timeZone:U};if(ie(t,Q.current.props))return;Q.current.props=t;let n=x(t),r=ae(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),o(()=>{let e=Z.current,t=e=>t=>$.current[e]?.(t.detail),n=[[te,t(`onSelect`)],[u,t(`onLegendChange`)],[ne,t(`onReady`)]];for(let[t,r]of n)e.addEventListener(t,r);return()=>{for(let[t,r]of n)e.removeEventListener(t,r)}},[]),o(()=>{let t=!0;return import(`@webority/ui-elements/chart`).catch(n=>{e(`[AppChart] the chart failed to load:`,n?.message),t&&se(!0)}),()=>{t=!1}},[]),oe?/* @__PURE__ */ l(`div`,{..._,className:J||void 0,style:Y,role:`status`,children:/* @__PURE__ */ l(`p`,{className:`wui-chart-state-text`,children:B||re})}):/* @__PURE__ */ l(`wui-chart`,{ref:ce,view:W||void 0,className:J||void 0,style:Y,..._,...X})});export{S as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppCard.js";import i from"./AppDropdown.js";import a from"./AppIcon.js";import o from"./AppSegmented.js";import s from"./warnUnknownProps.js";import{useLayoutEffect as c,useRef as l,useState as u}from"react";import{Dropdown as d}from"react-bootstrap";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";var h=[{value:`chart`,label:`Chart`,icon:`chart`},{value:`table`,label:`Table`,icon:`grid`}],g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=!1;function v(){!_&&g()&&(_=!0,e("[@webority/ui-react] <AppChartCard> has no `title`, which is the card's heading and names its menu button."))}var y=e=>e.getAttribute(`view`)===`table`?`table`:`chart`;function b(e){let{marker:g,props:_}=t(`AppChartCard`,e),{title:b,subtitle:x,toolbar:S=!0,onRetry:C,footer:w,children:T,className:E=``,...D}=_;s(`AppChartCard`,D),b||v();let O=l(null),k=l(null),[A,j]=u(`chart`),M=l(A);M.current=A;let[N,P]=u(!0),F=()=>O.current?.querySelector(`wui-chart`);c(()=>{let e=O.current,t=()=>{let t=e.querySelector(`wui-chart`);t&&(t===k.current?j(y(t)):(k.current=t,t.hasAttribute(`view`)?j(y(t)):M.current!==`chart`&&t.setAttribute(`view`,M.current)))};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`view`]}),()=>n.disconnect()},[]);let I=/* @__PURE__ */ m(f,{children:[/* @__PURE__ */ p(`button`,{type:`button`,className:`topbar-icon-btn wui-chart-card-tool wui-chart-card-legend-tool`,"aria-pressed":N,"aria-label":`Show legend`,title:`Show or hide the legend`,onClick:()=>P(!N),children:/* @__PURE__ */ p(a,{name:`list`,size:16})}),/* @__PURE__ */ p(o,{size:`sm`,label:`View`,options:h,value:A,onChange:e=>{j(e),F()?.setAttribute(`view`,e)}}),/* @__PURE__ */ m(i,{icon:`more-horizontal`,label:b?`More actions for ${b}`:`More actions`,children:[/* @__PURE__ */ m(d.Item,{as:`button`,type:`button`,onClick:()=>F()?.exportPng?.(),children:[/* @__PURE__ */ p(a,{name:`image`,size:16}),`Download PNG`]}),/* @__PURE__ */ m(d.Item,{as:`button`,type:`button`,onClick:()=>F()?.exportCsv?.(),children:[/* @__PURE__ */ p(a,{name:`download`,size:16}),`Download CSV`]})]})]}),L=[`wui-chart-card`,N?``:`wui-chart-card-legend-off`,E].filter(Boolean).join(` `);return/* @__PURE__ */ m(r,{title:b,subtitle:x,headerActions:S?I:void 0,footer:w,className:L,...g,...D,children:[/* @__PURE__ */ p(`div`,{ref:O,children:T}),C&&/* @__PURE__ */ p(`div`,{className:`wui-chart-card-retry`,children:/* @__PURE__ */ p(n,{variant:`outline`,size:`sm`,onClick:C,children:`Try again`})})]})}export{b 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"./warnUnknownProps.js";import{useLayoutEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{Dropdown as p}from"react-bootstrap";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";var _=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},v=!1;function y(){!v&&_()&&(v=!0,e("[@webority/ui-react] <AppChartCard> has no `title`, which is the card's heading and names its menu button."))}var b=e=>e.getAttribute(`view`)===`table`?`table`:`chart`;function x(e){let{marker:_,props:v}=n(`AppChartCard`,e),{title:x,subtitle:S,toolbar:C=!0,onRetry:w,footer:T,children:E,className:D=``,legendLabel:O=`Show legend`,legendTitle:k=`Show or hide the legend`,viewLabel:A=`View`,chartViewLabel:j=`Chart`,tableViewLabel:M=`Table`,moreActionsLabel:N=`More actions`,moreActionsForLabel:P=`More actions for {title}`,downloadPngLabel:F=`Download PNG`,downloadCsvLabel:I=`Download CSV`,retryLabel:L=`Try again`,...R}=v;c(`AppChartCard`,R),x||y();let z=d(null),B=d(null),[V,H]=f(`chart`),U=d(V);U.current=V;let[W,G]=f(!0),K=()=>z.current?.querySelector(`wui-chart`);l(()=>{let e=z.current,t=()=>{let t=e.querySelector(`wui-chart`);t&&(t===B.current?H(b(t)):(B.current=t,t.hasAttribute(`view`)?H(b(t)):U.current!==`chart`&&t.setAttribute(`view`,U.current)))};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`view`]}),()=>n.disconnect()},[]);let q=e=>{H(e),K()?.setAttribute(`view`,e)},J=u(()=>[{value:`chart`,label:j,icon:`chart`},{value:`table`,label:M,icon:`grid`}],[j,M]),Y=/* @__PURE__ */ g(m,{children:[/* @__PURE__ */ h(`button`,{type:`button`,className:`topbar-icon-btn wui-chart-card-tool wui-chart-card-legend-tool`,"aria-pressed":W,"aria-label":O,title:k,onClick:()=>G(!W),children:/* @__PURE__ */ h(o,{name:`list`,size:16})}),/* @__PURE__ */ h(s,{size:`sm`,label:A,options:J,value:V,onChange:q}),/* @__PURE__ */ g(a,{icon:`more-horizontal`,label:x?t(P,{title:x}):N,children:[/* @__PURE__ */ g(p.Item,{as:`button`,type:`button`,onClick:()=>K()?.exportPng?.(),children:[/* @__PURE__ */ h(o,{name:`image`,size:16}),F]}),/* @__PURE__ */ g(p.Item,{as:`button`,type:`button`,onClick:()=>K()?.exportCsv?.(),children:[/* @__PURE__ */ h(o,{name:`download`,size:16}),I]})]})]}),X=[`wui-chart-card`,W?``:`wui-chart-card-legend-off`,D].filter(Boolean).join(` `);return/* @__PURE__ */ g(i,{title:x,subtitle:S,headerActions:C?Y:void 0,footer:T,className:X,..._,...R,children:[/* @__PURE__ */ h(`div`,{ref:z,children:E}),w&&/* @__PURE__ */ h(`div`,{className:`wui-chart-card-retry`,children:/* @__PURE__ */ h(r,{variant:`outline`,size:`sm`,onClick:w,children:L})})]})}export{x as default};
@@ -1 +1 @@
1
- import e from"../lib/CheckField.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{forwardRef as i}from"react";import{jsx as a}from"react/jsx-runtime";var o=[`circle`],s=i(function(i,s){let{marker:c,props:l}=t(`AppCheckbox`,i),{label:u,id:d,name:f,error:p,hint:m,shape:h,className:g=``,..._}=l;return r(`AppCheckbox`,_),n(`AppCheckbox`,`shape`,h,o),/* @__PURE__ */ a(e,{rootProps:c,ref:s,label:u,id:d,name:f,error:p,hint:m,className:g,rest:_,inputType:`checkbox`,wrapperClass:h===`circle`?`form-check form-check-circle`:`form-check`})});export{s as default};
1
+ import e from"../lib/CheckField.js";import{FIELD_SIZES as t}from"../lib/fieldState.js";import n from"../lib/labelWithHelp.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./warnInvalidValue.js";import a from"./warnUnknownProps.js";import{forwardRef as o}from"react";import{jsx as s}from"react/jsx-runtime";var c=[`circle`],l=o(function(o,l){let{marker:u,props:d}=r(`AppCheckbox`,o),{label:f,id:p,name:m,error:h,hint:g,shape:_,help:v,helpLabel:y=`More information`,readOnly:b=!1,loading:x=!1,size:S=`md`,className:C=``,...w}=d;a(`AppCheckbox`,w),i(`AppCheckbox`,`shape`,_,c),i(`AppCheckbox`,`size`,S,t);let T=_===`circle`?`form-check form-check-circle`:`form-check`;return/* @__PURE__ */ s(e,{rootProps:u,ref:l,label:n(f,v,y),id:p,name:m,error:h,hint:g,className:C,rest:w,inputType:`checkbox`,wrapperClass:T,readOnly:b,loading:x,size:S})});export{l as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";var s={sm:` wui-struct-card-sm`,md:``,lg:` wui-struct-card-lg`},c={inline:``,stacked:` wui-struct-card-stacked`},l={filled:` wui-struct-card-filled`},u={sm:16,md:18,lg:22};function d(d){let{marker:f,props:p}=e(`AppChoiceCard`,d),{name:m,multiple:h=!1,value:g,checked:_,onChange:v,icon:y,iconNode:b,iconSize:x,image:S,imageAlt:C=``,children:w,title:T,description:E,checkIcon:D=`check`,checkSize:O=18,hideCheck:k=!1,disabled:A=!1,size:j=`md`,layout:M=`inline`,selectedStyle:N,className:P=``,...F}=p;r(`AppChoiceCard`,F),n(`AppChoiceCard`,`size`,j,Object.keys(s)),n(`AppChoiceCard`,`layout`,M,Object.keys(c)),n(`AppChoiceCard`,`selectedStyle`,N,Object.keys(l));let I=s[j]??``,L=c[M]??``,R=l[N]??``,z=x??u[j]??u.md;return/* @__PURE__ */ o(`label`,{className:`struct-card${S?` struct-card-img-card`:``}${I}${L}${R}${k?` wui-struct-card-no-check`:``}${P?` ${P}`:``}`,"aria-disabled":A||void 0,...f,...F,children:[/* @__PURE__ */ a(`input`,{type:h?`checkbox`:`radio`,name:m,value:g,className:`struct-card-input`,checked:_,onChange:v,disabled:A}),S?/* @__PURE__ */ a(`span`,{className:`struct-card-media`,children:/* @__PURE__ */ a(`img`,{className:`struct-card-img`,src:S,alt:C})}):b||y?/* @__PURE__ */ a(`span`,{className:`struct-card-ic`,children:b||/* @__PURE__ */ o(i,{children:[/* @__PURE__ */ a(`span`,{className:`wui-struct-card-glyph`,children:/* @__PURE__ */ a(t,{name:y,size:z})}),/* @__PURE__ */ a(`span`,{className:`wui-struct-card-glyph-on`,children:/* @__PURE__ */ a(t,{name:y,size:z,variant:`bold`})})]})}):null,/* @__PURE__ */ a(`span`,{className:`struct-card-body`,children:w||/* @__PURE__ */ o(i,{children:[T&&/* @__PURE__ */ a(`span`,{className:`struct-card-title`,children:T}),E&&/* @__PURE__ */ a(`span`,{className:`struct-card-desc`,children:E})]})}),!k&&/* @__PURE__ */ a(`span`,{className:`struct-card-check`,children:/* @__PURE__ */ a(t,{name:D,size:O})})]})}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"./AppIcon.js";import i from"./AppInfoTip.js";import a from"./warnInvalidValue.js";import o from"./warnUnknownProps.js";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";var u={sm:` wui-struct-card-sm`,md:``,lg:` wui-struct-card-lg`},d={inline:``,stacked:` wui-struct-card-stacked`},f={filled:` wui-struct-card-filled`},p={sm:16,md:18,lg:22};function m(m){let{marker:h,props:g}=n(`AppChoiceCard`,m),{name:_,multiple:v=!1,value:y,checked:b,onChange:x,icon:S,iconNode:C,iconSize:w,image:T,imageAlt:E=``,children:D,title:O,description:k,help:A,helpLabel:j=`More information`,checkIcon:M=`check`,checkSize:N=18,hideCheck:P=!1,disabled:F=!1,readOnly:I=!1,loading:L=!1,size:R=`md`,layout:z=`inline`,selectedStyle:B,className:V=``,...H}=g;o(`AppChoiceCard`,H),a(`AppChoiceCard`,`size`,R,Object.keys(u)),a(`AppChoiceCard`,`layout`,z,Object.keys(d)),a(`AppChoiceCard`,`selectedStyle`,B,Object.keys(f));let U=u[R]??``,W=d[z]??``,G=f[B]??``,K=w??p[R]??p.md;return/* @__PURE__ */ l(`label`,{className:`struct-card${T?` struct-card-img-card`:``}${U}${W}${G}${P?` wui-struct-card-no-check`:``}${V?` ${V}`:``}${L?` ${e}`:``}`,"aria-disabled":F||void 0,"aria-busy":L||void 0,...h,...H,children:[/* @__PURE__ */ c(`input`,{type:v?`checkbox`:`radio`,name:_,value:y,className:`struct-card-input`,checked:b,onChange:x,onClick:t(I||L),"aria-readonly":I||void 0,disabled:F||L}),T?/* @__PURE__ */ c(`span`,{className:`struct-card-media`,children:/* @__PURE__ */ c(`img`,{className:`struct-card-img`,src:T,alt:E})}):C||S?/* @__PURE__ */ c(`span`,{className:`struct-card-ic`,children:C||/* @__PURE__ */ l(s,{children:[/* @__PURE__ */ c(`span`,{className:`wui-struct-card-glyph`,children:/* @__PURE__ */ c(r,{name:S,size:K})}),/* @__PURE__ */ c(`span`,{className:`wui-struct-card-glyph-on`,children:/* @__PURE__ */ c(r,{name:S,size:K,variant:`bold`})})]})}):null,/* @__PURE__ */ l(`span`,{className:`struct-card-body`,children:[D||/* @__PURE__ */ l(s,{children:[O&&/* @__PURE__ */ c(`span`,{className:`struct-card-title`,children:O}),k&&/* @__PURE__ */ c(`span`,{className:`struct-card-desc`,children:k})]}),A&&/* @__PURE__ */ c(i,{label:j,children:A})]}),!P&&/* @__PURE__ */ c(`span`,{className:`struct-card-check`,children:/* @__PURE__ */ c(r,{name:M,size:N})})]})}export{m as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`sm`,`md`,`lg`],o=[`soft`,`solid`];function s(s){let{marker:c,props:l}=e(`AppChoiceChip`,s),{multiple:u=!0,label:d,name:f,value:p,checked:m,onChange:h,children:g,count:_,size:v=`md`,variant:y=`soft`,disabled:b=!1,className:x=``,...S}=l;return n(`AppChoiceChip`,S),t(`AppChoiceChip`,`size`,v,a),t(`AppChoiceChip`,`variant`,y,o),/* @__PURE__ */ i(`label`,{className:`choice-chip${m?` checked`:``}${v===`sm`?` choice-chip-sm`:v===`lg`?` choice-chip-lg`:``}${y===`solid`?` wui-choice-chip-solid`:``}${x?` ${x}`:``}`,...c,...S,children:[/* @__PURE__ */ r(`input`,{type:u?`checkbox`:`radio`,name:f,value:p,checked:m,disabled:b,onChange:h}),/* @__PURE__ */ r(`span`,{children:d??g}),_!=null&&/* @__PURE__ */ r(`span`,{className:`count`,children:_})]})}export{s 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"./warnInvalidValue.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=``,...A}=p;return a(`AppChoiceChip`,A),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,...A,children:[/* @__PURE__ */ s(`input`,{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/FieldMessage.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppRequiredMark.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import{useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`sm`,`md`,`lg`];function l(l){let{marker:u,props:d}=t(`AppColorField`,l),{value:f=`#000000`,onChange:p,label:m,required:h=!1,optional:g=!1,error:_,hint:v,name:y,id:b,disabled:x=!1,size:S=`md`,className:C=``,fieldClassName:w=``,...T}=d;i(`AppColorField`,T),r(`AppColorField`,`size`,S,c);let E=a(),D=b||E,O=_?`${D}-error`:v?`${D}-hint`:void 0,k=e=>/^#[0-9a-f]{6}$/i.test(e),A=S===`sm`?` color-field-sm`:S===`lg`?` color-field-lg`:``,j=S===`sm`?` input-sm`:S===`lg`?` input-lg`:``;return/* @__PURE__ */ s(`div`,{...u,className:`field${w?` ${w}`:``}`,children:[m&&/* @__PURE__ */ s(`label`,{className:`label`,htmlFor:D,children:[m,g&&!h&&/* @__PURE__ */ o(`span`,{className:`label-optional`,children:` (optional)`}),h&&/* @__PURE__ */ o(n,{})]}),/* @__PURE__ */ s(`div`,{className:`color-field${A}`,children:[/* @__PURE__ */ o(`input`,{type:`color`,className:`color-field-swatch`,value:k(f)?f:`#000000`,onChange:e=>p?.(e.target.value),disabled:x,"aria-label":`${m||`Colour`}, colour picker`,tabIndex:-1}),/* @__PURE__ */ o(`input`,{type:`text`,className:`input color-field-hex${j}${_?` error`:``}${C?` ${C}`:``}`,id:D,name:y,value:f,onChange:e=>p?.(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:h,disabled:x,"aria-invalid":_?`true`:`false`,"aria-describedby":O,...T})]}),/* @__PURE__ */ o(e,{error:_,hint:v,errorId:`${D}-error`,hintId:`${D}-hint`})]})}export{l 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{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./warnInvalidValue.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,hint: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 +1 @@
1
- import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppModal.js";import a from"./AppSpinner.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import{matchSegments as c}from"@webority/ui-elements/helpers";import{Fragment as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/command-palette";var g=`lg`;function _(e){let{marker:t,props:r}=n(`AppCommandPalette`,e),{open:a,onClose:o,query:c=``,onQueryChange:l,placeholder:u=`Search…`,groups:f=[],path:p=[],onPathChange:h,rootLabel:_,backLabel:y=`Back`,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C=!1,emptyText:w=`No results`,footer:T,ariaLabel:E=`Search`,highlight:D=!0,id:O,className:k=``,...A}=r;s(`AppCommandPalette`,A);let j=d(),M=O||j;return/* @__PURE__ */ m(i,{...t,open:a,onClose:o,hideHeader:!0,placement:`top`,size:g,ariaLabel:E,className:`wui-cmd-card${k?` ${k}`:``}`,children:/* @__PURE__ */ m(v,{baseId:M,query:c,onQueryChange:l,placeholder:u,groups:f,path:p,onPathChange:h,rootLabel:_,backLabel:y,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C,emptyText:w,footer:T,ariaLabel:E,highlight:D,onClose:o,rest:A})})}function v({baseId:n,query:i,onQueryChange:s,placeholder:c,groups:l,path:d,onPathChange:g,rootLabel:_,backLabel:v,recentsKey:x,recentsLimit:S,recentsLabel:C,loading:w,emptyText:T,footer:E,ariaLabel:D,highlight:O,onClose:k,rest:A}){let j=p(null),M=`${n}-list`,N=l.filter(e=>e.items?.length),P=!w&&i.trim()!==``&&N.length===0;return f(()=>{j.current?.refresh?.()}),u(()=>{let e=j.current,t=e=>{let t=l.find(t=>String(t.key)===e.detail.groupKey)?.items?.find(t=>String(t.key)===e.detail.key);t&&(e.preventDefault(),t.page?(s?.(``),g?.([...d,{key:t.page.key,label:t.page.label}])):(t.onSelect?.(),k?.()))},n=e=>{e.preventDefault(),s?.(``),g?.(e.detail.path)};return e.addEventListener(`wui-command-palette:select`,t),e.addEventListener(`wui-command-palette:navigate`,n),()=>{e.removeEventListener(`wui-command-palette:select`,t),e.removeEventListener(`wui-command-palette:navigate`,n)}},[l,d,k,s,g]),/* @__PURE__ */ h(`wui-command-palette`,{ref:j,path:JSON.stringify(d),"root-label":_,"recents-key":x,"recents-limit":S,"recents-label":C,...A,children:[/* @__PURE__ */ h(`div`,{className:`wui-cmd-search`,children:[/* @__PURE__ */ m(`span`,{className:`wui-cmd-search-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ m(r,{name:`search`,size:18})}),/* @__PURE__ */ m(`input`,{className:`wui-cmd-input`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":M,"aria-autocomplete":`list`,"aria-label":D,placeholder:c,autoComplete:`off`,spellCheck:!1,"data-autofocus":``,value:i,onChange:e=>s?.(e.target.value)}),w&&/* @__PURE__ */ m(a,{size:`sm`,className:`wui-cmd-spinner`})]}),/* @__PURE__ */ h(`div`,{className:`wui-cmd-crumbs`,hidden:!0,children:[/* @__PURE__ */ m(`button`,{type:`button`,className:`wui-cmd-back`,"aria-label":v,children:/* @__PURE__ */ m(r,{name:`chevron-left`,size:16})}),/* @__PURE__ */ m(`ol`,{className:`wui-cmd-trail`})]}),/* @__PURE__ */ h(`div`,{className:`wui-cmd-list`,role:`listbox`,id:M,"aria-label":`Results`,"aria-busy":w?`true`:void 0,hidden:N.length===0,children:[/* @__PURE__ */ m(`div`,{className:`wui-cmd-recents`}),N.map(a=>{let s=`${n}-${b(a.key)}`;return/* @__PURE__ */ h(`div`,{className:`wui-cmd-group`,role:`group`,"aria-labelledby":s,children:[/* @__PURE__ */ m(`div`,{className:`wui-cmd-group-label`,role:`presentation`,id:s,children:a.label}),a.items.map(n=>{let c=`${s}-${b(n.key)}`,l=n.description==null?null:`${c}-desc`,u=n.meta==null?null:`${c}-meta`;return/* @__PURE__ */ h(`div`,{className:`wui-cmd-item`,role:`option`,id:c,"data-group-key":String(a.key),"data-key":String(n.key),"data-opens":n.page?String(n.page.key):void 0,"aria-label":n.ariaLabel||(typeof n.label==`string`?n.label:``)||void 0,"aria-describedby":[l,u].filter(Boolean).join(` `)||void 0,"aria-disabled":n.disabled?`true`:void 0,"aria-keyshortcuts":e(n.shortcut),children:[n.icon!=null&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-icon`,"aria-hidden":`true`,children:o(n.icon,{size:18})}),/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-text`,children:[/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-label`,children:O?y(n.label,i):n.label}),l&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-desc`,id:l,children:n.description})]}),u&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-meta`,id:u,children:n.meta}),t(n.shortcut),n.page&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-chevron`,"aria-hidden":`true`,children:/* @__PURE__ */ m(r,{name:`chevron-right`,size:16})})]},n.key)})]},a.key)})]}),/* @__PURE__ */ m(`div`,{className:`wui-cmd-empty`,role:`status`,children:P?T:null}),E!=null&&/* @__PURE__ */ m(`div`,{className:`wui-cmd-footer`,children:E})]})}function y(e,t){if(typeof e!=`string`)return e;let n=c(e,t);if(n.length===1&&!n[0].match)return e;let r=0;return n.map(e=>{let t=r;return r+=e.text.length,e.match?/* @__PURE__ */ m(`mark`,{className:`wui-cmd-mark`,children:e.text},t):/* @__PURE__ */ m(l,{children:e.text},t)})}function b(e){return String(e).replace(/\s+/g,`_`)}export{_ as default};
1
+ import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppModal.js";import a from"./AppSpinner.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import{matchSegments as c}from"@webority/ui-elements/helpers";import{Fragment as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/command-palette";var g=`lg`;function _(e){let{marker:t,props:r}=n(`AppCommandPalette`,e),{open:a,onClose:o,query:c=``,onQueryChange:l,placeholder:u=`Search…`,groups:f=[],path:p=[],onPathChange:h,rootLabel:_,backLabel:y=`Back`,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C=!1,emptyText:w=`No results`,footer:T,ariaLabel:E=`Search`,resultsLabel:D=`Results`,highlight:O=!0,id:k,className:A=``,...j}=r;s(`AppCommandPalette`,j);let M=d(),N=k||M;return/* @__PURE__ */ m(i,{...t,open:a,onClose:o,hideHeader:!0,placement:`top`,size:g,ariaLabel:E,className:`wui-cmd-card${A?` ${A}`:``}`,children:/* @__PURE__ */ m(v,{baseId:N,query:c,onQueryChange:l,placeholder:u,groups:f,path:p,onPathChange:h,rootLabel:_,backLabel:y,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C,emptyText:w,footer:T,ariaLabel:E,resultsLabel:D,highlight:O,onClose:o,rest:j})})}function v({baseId:n,query:i,onQueryChange:s,placeholder:c,groups:l,path:d,onPathChange:g,rootLabel:_,backLabel:v,recentsKey:x,recentsLimit:S,recentsLabel:C,loading:w,emptyText:T,footer:E,ariaLabel:D,resultsLabel:O,highlight:k,onClose:A,rest:j}){let M=p(null),N=`${n}-list`,P=l.filter(e=>e.items?.length),F=!w&&i.trim()!==``&&P.length===0;return f(()=>{M.current?.refresh?.()}),u(()=>{let e=M.current,t=e=>{let t=l.find(t=>String(t.key)===e.detail.groupKey)?.items?.find(t=>String(t.key)===e.detail.key);t&&(e.preventDefault(),t.page?(s?.(``),g?.([...d,{key:t.page.key,label:t.page.label}])):(t.onSelect?.(),A?.()))},n=e=>{e.preventDefault(),s?.(``),g?.(e.detail.path)};return e.addEventListener(`wui-command-palette:select`,t),e.addEventListener(`wui-command-palette:navigate`,n),()=>{e.removeEventListener(`wui-command-palette:select`,t),e.removeEventListener(`wui-command-palette:navigate`,n)}},[l,d,A,s,g]),/* @__PURE__ */ h(`wui-command-palette`,{ref:M,path:JSON.stringify(d),"root-label":_,"recents-key":x,"recents-limit":S,"recents-label":C,...j,children:[/* @__PURE__ */ h(`div`,{className:`wui-cmd-search`,children:[/* @__PURE__ */ m(`span`,{className:`wui-cmd-search-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ m(r,{name:`search`,size:18})}),/* @__PURE__ */ m(`input`,{className:`wui-cmd-input`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":N,"aria-autocomplete":`list`,"aria-label":D,placeholder:c,autoComplete:`off`,spellCheck:!1,"data-autofocus":``,value:i,onChange:e=>s?.(e.target.value)}),w&&/* @__PURE__ */ m(a,{size:`sm`,className:`wui-cmd-spinner`})]}),/* @__PURE__ */ h(`div`,{className:`wui-cmd-crumbs`,hidden:!0,children:[/* @__PURE__ */ m(`button`,{type:`button`,className:`wui-cmd-back`,"aria-label":v,children:/* @__PURE__ */ m(r,{name:`chevron-left`,size:16})}),/* @__PURE__ */ m(`ol`,{className:`wui-cmd-trail`})]}),/* @__PURE__ */ h(`div`,{className:`wui-cmd-list`,role:`listbox`,id:N,"aria-label":O,"aria-busy":w?`true`:void 0,hidden:P.length===0,children:[/* @__PURE__ */ m(`div`,{className:`wui-cmd-recents`}),P.map(a=>{let s=`${n}-${b(a.key)}`;return/* @__PURE__ */ h(`div`,{className:`wui-cmd-group`,role:`group`,"aria-labelledby":s,children:[/* @__PURE__ */ m(`div`,{className:`wui-cmd-group-label`,role:`presentation`,id:s,children:a.label}),a.items.map(n=>{let c=`${s}-${b(n.key)}`,l=n.description==null?null:`${c}-desc`,u=n.meta==null?null:`${c}-meta`;return/* @__PURE__ */ h(`div`,{className:`wui-cmd-item`,role:`option`,id:c,"data-group-key":String(a.key),"data-key":String(n.key),"data-opens":n.page?String(n.page.key):void 0,"aria-label":n.ariaLabel||(typeof n.label==`string`?n.label:``)||void 0,"aria-describedby":[l,u].filter(Boolean).join(` `)||void 0,"aria-disabled":n.disabled?`true`:void 0,"aria-keyshortcuts":e(n.shortcut),children:[n.icon!=null&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-icon`,"aria-hidden":`true`,children:o(n.icon,{size:18})}),/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-text`,children:[/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-label`,children:k?y(n.label,i):n.label}),l&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-desc`,id:l,children:n.description})]}),u&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-meta`,id:u,children:n.meta}),t(n.shortcut),n.page&&/* @__PURE__ */ m(`span`,{className:`wui-cmd-item-chevron`,"aria-hidden":`true`,children:/* @__PURE__ */ m(r,{name:`chevron-right`,size:16})})]},n.key)})]},a.key)})]}),/* @__PURE__ */ m(`div`,{className:`wui-cmd-empty`,role:`status`,children:F?T:null}),E!=null&&/* @__PURE__ */ m(`div`,{className:`wui-cmd-footer`,children:E})]})}function y(e,t){if(typeof e!=`string`)return e;let n=c(e,t);if(n.length===1&&!n[0].match)return e;let r=0;return n.map(e=>{let t=r;return r+=e.text.length,e.match?/* @__PURE__ */ m(`mark`,{className:`wui-cmd-mark`,children:e.text},t):/* @__PURE__ */ m(l,{children:e.text},t)})}function b(e){return String(e).replace(/\s+/g,`_`)}export{_ as default};
@@ -1 +1 @@
1
- import{initialsOf as e}from"../lib/initials.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppAvatar.js";import r from"./AppBadge.js";import i from"./AppButton.js";import a from"./AppIcon.js";import o from"./warnInvalidValue.js";import s from"./warnUnknownProps.js";import{parseMentionValue as c}from"@webority/ui-elements/elements/mention-input";import{formatDate as l,formatFileSize as u,formatNumber as d,toInstant as f}from"@webority/ui-elements/helpers";import{Fragment as p,useEffect as m,useId as h,useRef as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{COMMENT_REACTIONS as y,COMMENT_TEXT as b}from"@webority/ui-elements/elements/comment-thread";var x=[`stacked`,`inline`],S=[`list`,`conversation`];function C(e){let{marker:r,props:a}=t(`AppCommentThread`,e),{comments:c=[],onPost:l,onReply:u,onEdit:d,onDelete:f,onReact:p,people:C,loadPeople:T,reactionChoices:E,allowReplies:D=!0,allowReactions:O=!0,composerPlaceholder:k,variant:A=`list`,composer:j=`stacked`,author:M,postLabel:N=b.post,composerRows:P,readOnly:F=!1,label:I=b.listName,id:L,className:R=``,...z}=a;s(`AppCommentThread`,z),o(`AppCommentThread`,`variant`,A,S),o(`AppCommentThread`,`composer`,j,x);let B=h(),V=L||`comment-thread-${B.replace(/[^a-zA-Z0-9_-]/g,``)}`,H=g(null),U=typeof T==`function`,W=E?.length?E:y,G=j===`inline`,K=P??(G?1:3),q=g(null);return q.current={onPost:l,onReply:u,onEdit:d,onDelete:f,onReact:p,loadPeople:T},m(()=>{let e=H.current;if(e)return e.submit=async({intent:e,commentId:t,parentId:n,body:r,emoji:i})=>{let a=q.current;e===`post`?await a.onPost?.(r):e===`reply`?await a.onReply?.(n,r):e===`edit`?await a.onEdit?.(t,r):e===`delete`?await a.onDelete?.(t):e===`react`&&await a.onReact?.(t,i)},()=>{e.submit=void 0}},[]),m(()=>{let e=H.current;e&&!U&&(e.people=C||[])},[C,U]),m(()=>{let e=H.current;if(!e||!U)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target,r=(t.get(n)??0)+1;t.set(n,r),n.loading=!0;try{let i=await q.current.loadPeople(e.detail.query);t.get(n)===r&&(n.people=i||[])}catch{t.get(n)===r&&(n.people=[])}finally{t.get(n)===r&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[U]),/* @__PURE__ */ v(`wui-comment-thread`,{ref:H,id:V,class:[`wui-comment-thread`,A===`conversation`&&`wui-comment-thread--conversation`,R].filter(Boolean).join(` `),controlled:``,"read-only":F?``:void 0,remote:U?``:void 0,"reaction-choices":E?.length?E.join(` `):void 0,"no-replies":D?void 0:``,"no-reactions":O?void 0:``,"composer-placeholder":k,...r,...z,children:[/* @__PURE__ */ _(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:c.length?/* @__PURE__ */ _(`ol`,{className:`wui-comment-list`,"aria-label":I,children:c.map(e=>/* @__PURE__ */ _(w,{comment:e,topLevel:!0,readOnly:F,allowReplies:D,allowReactions:O},e.id))}):/* @__PURE__ */ _(`p`,{className:`wui-comment-empty`,children:b.empty})}),!F&&O&&/* @__PURE__ */ _(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":b.pickerName,"data-wui-picker":``,hidden:!0,children:W.map(e=>/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!F&&/* @__PURE__ */ v(`div`,{className:G?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[G&&M?/* @__PURE__ */ _(n,{name:M,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ _(`wui-mention-input`,{id:`${V}-new`,class:`wui-mention-input`,label:b.composerLabel,placeholder:k??b.composerPlaceholder,rows:String(K),remote:U?``:void 0}),/* @__PURE__ */ _(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ _(i,{variant:G?`outline`:`primary`,size:`sm`,"data-wui-action":`post`,children:N})}),/* @__PURE__ */ _(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ _(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function w({comment:t,topLevel:n=!1,readOnly:o,allowReplies:s,allowReactions:m}){let{id:h,author:g,at:y,value:x,edited:S,mine:C,internal:T,attachments:E=[],deleted:D,canEdit:O,canDelete:k,reactions:A=[],replies:j=[]}=t,M=g?.name||``,N=f(y),P=!o&&!D&&O,F=!o&&!D&&k,I=n&&s,L=[`wui-comment`,T&&`wui-comment--internal`,C&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ v(`li`,{className:L,"data-wui-comment":h,"data-value":x??``,"data-wui-deleted":D?``:void 0,children:[/* @__PURE__ */ v(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ v(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ _(`span`,{className:`avatar-face`,children:e(M)||`?`}),g?.src&&/* @__PURE__ */ _(`img`,{className:`avatar-img`,src:g.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ v(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ v(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ _(`span`,{className:`wui-comment-author`,children:M}),/* @__PURE__ */ _(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(N)?new Date(N).toISOString():void 0,children:l(y,{pattern:`datetime`})}),S&&!D&&/* @__PURE__ */ _(`span`,{className:`wui-comment-edited`,children:b.edited}),T&&/* @__PURE__ */ _(r,{className:`wui-comment-internal-badge`,children:`Internal note`})]}),D?/* @__PURE__ */ _(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:b.deleted}):/* @__PURE__ */ _(`div`,{className:`wui-comment-text`,"data-wui-text":``,children:c(x).map((e,t)=>`text`in e?/* @__PURE__ */ _(p,{children:e.text},t):/* @__PURE__ */ v(`span`,{className:`wui-mention`,"data-mention-id":e.id,children:[`@`,e.label]},t))}),!D&&E.length>0&&/* @__PURE__ */ _(`ul`,{className:`wui-comment-attachments`,"aria-label":`Attachments`,children:E.map(e=>/* @__PURE__ */ v(`li`,{children:[/* @__PURE__ */ v(`a`,{className:`wui-comment-attachment`,href:e.href,download:!0,children:[/* @__PURE__ */ _(a,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ _(`span`,{className:`wui-comment-attachment-size`,children:u(e.sizeBytes)})]},e.href))}),P&&/* @__PURE__ */ _(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),m&&!D&&(A.length>0||!o)&&/* @__PURE__ */ v(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":b.reactions,children:[A.map(e=>o?/* @__PURE__ */ v(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ _(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ _(`span`,{className:`wui-reaction-count`,children:d(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ v(`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__ */ _(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ _(`span`,{className:`wui-reaction-count`,children:d(e.count,{decimals:0})})]},e.emoji)),!o&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":b.addReaction,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ _(a,{name:`emoji-smile`,size:16})})]}),!o&&!D&&(I||P||F)&&/* @__PURE__ */ v(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[I&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:b.reply}),P&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:b.edit}),F&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:b.delete})]}),F&&/* @__PURE__ */ v(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ _(`span`,{className:`wui-comment-confirm-text`,children:b.confirmDelete}),/* @__PURE__ */ _(i,{variant:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:b.delete}),/* @__PURE__ */ _(i,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:b.cancel})]}),!o&&/* @__PURE__ */ _(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),n&&j.length>0&&/* @__PURE__ */ _(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":b.repliesName(M),children:j.map(e=>/* @__PURE__ */ _(w,{comment:e,readOnly:o,allowReactions:m},e.id))}),I&&!o&&!D&&/* @__PURE__ */ _(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{C 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{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppAvatar.js";import a from"./AppBadge.js";import o from"./AppButton.js";import s from"./AppIcon.js";import c from"./warnInvalidValue.js";import l from"./warnUnknownProps.js";import{parseMentionValue as u}from"@webority/ui-elements/elements/mention-input";import{formatDate as d,formatFileSize as f,formatNumber as p,toInstant as m}from"@webority/ui-elements/helpers";import{Fragment as h,useEffect as g,useId as _,useRef as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{COMMENT_REACTIONS as x,COMMENT_TEXT as S}from"@webority/ui-elements/elements/comment-thread";var C=[`stacked`,`inline`],w=[`list`,`conversation`];function T(e){let{marker:t,props:n}=r(`AppCommentThread`,e),{comments:a=[],onPost:s,onReply:u,onEdit:d,onDelete:f,onReact:p,people:m,loadPeople:h,reactionChoices:T,allowReplies:D=!0,allowReactions:O=!0,composerPlaceholder:k,variant:A=`list`,composer:j=`stacked`,author:M,postLabel:N=S.post,composerRows:P,readOnly:F=!1,linkComponent:I,label:L=S.listName,internalLabel:R=`Internal note`,attachmentsLabel:z=`Attachments`,composerLabel:B=`Add a comment`,noCommentsText:V=`No comments yet.`,reactionsLabel:H=`Reactions`,repliesToLabel:U=`Replies to {name}`,editedLabel:W=`Edited`,deletedText:G=`This comment was deleted.`,replyLabel:K=`Reply`,editLabel:q=`Edit`,deleteLabel:ee=`Delete`,deleteConfirmText:te=`Delete this comment?`,cancelLabel:ne=`Cancel`,addReactionLabel:re=`Add a reaction`,chooseReactionLabel:ie=`Choose a reaction`,peopleLabel:ae=`People`,id:oe,className:se=``,...J}=n;l(`AppCommentThread`,J),c(`AppCommentThread`,`variant`,A,w),c(`AppCommentThread`,`composer`,j,C);let ce=_(),Y=oe||`comment-thread-${ce.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=v(null),Z=typeof h==`function`,le=T?.length?T:x,Q=j===`inline`,ue=P??(Q?1:3),de={reactionsLabel:H,repliesToLabel:U,editedLabel:W,deletedText:G,replyLabel:K,editLabel:q,deleteLabel:ee,deleteConfirmText:te,cancelLabel:ne,addReactionLabel:re},$=v(null);return $.current={onPost:s,onReply:u,onEdit:d,onDelete:f,onReact:p,loadPeople:h},g(()=>{let e=X.current;if(e)return e.submit=async({intent:e,commentId:t,parentId:n,body:r,emoji:i})=>{let a=$.current;e===`post`?await a.onPost?.(r):e===`reply`?await a.onReply?.(n,r):e===`edit`?await a.onEdit?.(t,r):e===`delete`?await a.onDelete?.(t):e===`react`&&await a.onReact?.(t,i)},()=>{e.submit=void 0}},[]),g(()=>{let e=X.current;e&&!Z&&(e.people=m||[])},[m,Z]),g(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target,r=(t.get(n)??0)+1;t.set(n,r),n.loading=!0;try{let i=await $.current.loadPeople(e.detail.query);t.get(n)===r&&(n.people=i||[])}catch{t.get(n)===r&&(n.people=[])}finally{t.get(n)===r&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ b(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,A===`conversation`&&`wui-comment-thread--conversation`,se].filter(Boolean).join(` `),controlled:``,"read-only":F?``:void 0,remote:Z?``:void 0,"reaction-choices":T?.length?T.join(` `):void 0,"no-replies":D?void 0:``,"no-reactions":O?void 0:``,"composer-placeholder":k,...t,...J,children:[/* @__PURE__ */ y(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:a.length?/* @__PURE__ */ y(`ol`,{className:`wui-comment-list`,"aria-label":L,children:a.map(e=>/* @__PURE__ */ y(E,{comment:e,topLevel:!0,readOnly:F,allowReplies:D,allowReactions:O,linkComponent:I,internalLabel:R,attachmentsLabel:z,text:de},e.id))}):/* @__PURE__ */ y(`p`,{className:`wui-comment-empty`,children:V})}),!F&&O&&/* @__PURE__ */ y(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":ie,"data-wui-picker":``,hidden:!0,children:le.map(e=>/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!F&&/* @__PURE__ */ b(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&M?/* @__PURE__ */ y(i,{name:M,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ y(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:B,"people-label":ae,placeholder:k??S.composerPlaceholder,rows:String(ue),remote:Z?``:void 0}),/* @__PURE__ */ y(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ y(o,{variant:Q?`outline`:`primary`,size:`sm`,"data-wui-action":`post`,children:N})}),/* @__PURE__ */ y(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ y(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function E({comment:r,topLevel:i=!1,readOnly:c,allowReplies:l,allowReactions:g,linkComponent:_,internalLabel:v,attachmentsLabel:x,text:S}){let{id:C,author:w,at:T,value:D,edited:O,mine:k,internal:A,attachments:j=[],deleted:M,canEdit:N,canDelete:P,reactions:F=[],replies:I=[]}=r,L=w?.name||``,R=m(T),z=!c&&!M&&N,B=!c&&!M&&P,V=i&&l,H=[`wui-comment`,A&&`wui-comment--internal`,k&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ b(`li`,{className:H,"data-wui-comment":C,"data-value":D??``,"data-wui-deleted":M?``:void 0,children:[/* @__PURE__ */ b(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ b(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ y(`span`,{className:`avatar-face`,children:t(L)||`?`}),w?.src&&/* @__PURE__ */ y(`img`,{className:`avatar-img`,src:w.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ b(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ b(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ y(`span`,{className:`wui-comment-author`,children:L}),/* @__PURE__ */ y(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(R)?new Date(R).toISOString():void 0,children:d(T,{pattern:`datetime`})}),O&&!M&&/* @__PURE__ */ y(`span`,{className:`wui-comment-edited`,children:S.editedLabel}),A&&/* @__PURE__ */ y(a,{className:`wui-comment-internal-badge`,children:v})]}),M?/* @__PURE__ */ y(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:S.deletedText}):/* @__PURE__ */ y(`div`,{className:`wui-comment-text`,"data-wui-text":``,children:u(D).map((e,t)=>`text`in e?/* @__PURE__ */ y(h,{children:e.text},t):/* @__PURE__ */ b(`span`,{className:`wui-mention`,"data-mention-id":e.id,children:[`@`,e.label]},t))}),!M&&j.length>0&&/* @__PURE__ */ y(`ul`,{className:`wui-comment-attachments`,"aria-label":x,children:j.map(e=>{let{Tag:t,linkProps:r}=n(_,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ b(`li`,{children:[/* @__PURE__ */ b(t,{className:`wui-comment-attachment`,...r,...e.to?{}:{download:!0},children:[/* @__PURE__ */ y(s,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ y(`span`,{className:`wui-comment-attachment-size`,children:f(e.sizeBytes)})]},e.to??e.href)})}),z&&/* @__PURE__ */ y(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),g&&!M&&(F.length>0||!c)&&/* @__PURE__ */ b(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":S.reactionsLabel,children:[F.map(e=>c?/* @__PURE__ */ b(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ y(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ y(`span`,{className:`wui-reaction-count`,children:p(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ b(`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__ */ y(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ y(`span`,{className:`wui-reaction-count`,children:p(e.count,{decimals:0})})]},e.emoji)),!c&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":S.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ y(s,{name:`emoji-smile`,size:16})})]}),!c&&!M&&(V||z||B)&&/* @__PURE__ */ b(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[V&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:S.replyLabel}),z&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:S.editLabel}),B&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:S.deleteLabel})]}),B&&/* @__PURE__ */ b(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ y(`span`,{className:`wui-comment-confirm-text`,children:S.deleteConfirmText}),/* @__PURE__ */ y(o,{variant:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:S.deleteLabel}),/* @__PURE__ */ y(o,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:S.cancelLabel})]}),!c&&/* @__PURE__ */ y(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),i&&I.length>0&&/* @__PURE__ */ y(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":e(S.repliesToLabel,{name:L}),children:I.map(e=>/* @__PURE__ */ y(E,{comment:e,readOnly:c,allowReactions:g,linkComponent:_,internalLabel:v,attachmentsLabel:x,text:S},e.id))}),V&&!c&&!M&&/* @__PURE__ */ y(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{T as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{isValidElement as i,useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`stack`,`scroll`],d=[`comfortable`,`relaxed`],f=[`start`,`center`],p={yes:{icon:`tick-circle`,label:`Yes`},no:{icon:`close-circle`,label:`No`},warn:{icon:`danger`,label:`Warning`},partial:{icon:`minus-circle`,label:`Partial`}};function m(e){return typeof e==`object`&&!!e&&!i(e)}function h(e){return e.scrollLeft+e.clientWidth<e.scrollWidth-1}function g(...e){return e.filter(Boolean).join(` `)||void 0}function _(e){return g(e.highlight&&`is-highlight`,e.align===`center`&&`wui-compare-center`,e.nowrap&&`wui-compare-nowrap`)}function v(e){if(e===!0)return/* @__PURE__ */ l(`span`,{className:`compare-yes`,children:[/* @__PURE__ */ c(t,{name:`check`,size:16}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:`Yes`})]});if(e===!1)return/* @__PURE__ */ l(`span`,{className:`compare-no`,children:[/* @__PURE__ */ c(`span`,{"aria-hidden":`true`,children:`-`}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:`No`})]});if(m(e)&&`state`in e){let r=p[e.state];return n(`AppCompareTable`,`state`,e.state,Object.keys(p)),/* @__PURE__ */ l(`span`,{className:`wui-compare-state wui-compare-state-${e.state}`,children:[r&&/* @__PURE__ */ c(t,{name:r.icon,size:16,variant:`bulk`}),r&&/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:`${r.label}: `}),e.text]})}return m(e)&&`code`in e?/* @__PURE__ */ c(`span`,{className:`wui-compare-code`,children:e.code}):e}function y(e,t){let n=[],r=null;return t.forEach((t,i)=>{t.group!=null&&t.group!==r&&n.push(/* @__PURE__ */ c(`tr`,{className:`wui-compare-group-row`,children:/* @__PURE__ */ c(`th`,{colSpan:e.length,scope:`rowgroup`,className:`wui-compare-group`,children:t.group})},`group:${t.group}:${t.key??t.label}`)),r=t.group??null,n.push(/* @__PURE__ */ l(`tr`,{children:[/* @__PURE__ */ c(`th`,{scope:`row`,children:t.label}),t.values.map((t,n)=>{let r=e[n+1];return/* @__PURE__ */ c(`td`,{className:_(r??{}),"data-label":r?.label,children:v(t)},r?.label??n)})]},t.key??`${t.label}-${i}`))}),n}function b(t){let{marker:i,props:p}=e(`AppCompareTable`,t),{columns:m,rows:v,caption:b,mobile:x=`stack`,stickyFirstColumn:S=!1,stickyHeader:C=!1,density:w=`comfortable`,className:T=``,...E}=p,D=o(null),[O,k]=s(!1);if(a(()=>{let e=()=>{let e=D.current;e&&k(h(e))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),!Array.isArray(m))throw Error(`<AppCompareTable> columns is required: pass the feature-name column, then one per option.`);if(!Array.isArray(v))throw Error(`<AppCompareTable> rows is required: pass one row per capability.`);r(`AppCompareTable`,E),n(`AppCompareTable`,`mobile`,x,u),n(`AppCompareTable`,`density`,w,d);for(let e of m)n(`AppCompareTable`,`align`,e.align,f);let A=x===`scroll`,j=/* @__PURE__ */ l(`table`,{className:g(A&&`wui-compare-scroll-table`,A&&S&&`wui-compare-sticky-first`),children:[b&&/* @__PURE__ */ c(`caption`,{className:`visually-hidden`,children:b}),/* @__PURE__ */ c(`thead`,{children:/* @__PURE__ */ c(`tr`,{children:m.map((e,t)=>/* @__PURE__ */ c(`th`,{scope:`col`,className:_(e),children:e.label},e.label?`col-${t}-${e.label}`:`col-${t}`))})}),/* @__PURE__ */ c(`tbody`,{children:y(m,v)})]});return/* @__PURE__ */ c(`div`,{className:g(`compare-table`,w===`relaxed`&&`wui-compare-relaxed`,C&&`wui-compare-sticky-head`,T),"data-mobile":x,...i,...E,children:A?/* @__PURE__ */ c(`div`,{className:`wui-compare-scroll`,ref:D,tabIndex:0,role:b?`region`:void 0,"aria-label":b||void 0,"data-more":O?`end`:void 0,onScroll:e=>k(h(e.currentTarget)),children:j}):j})}export{b as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{isValidElement as i,useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`stack`,`scroll`],d=[`comfortable`,`relaxed`],f=[`start`,`center`],p={yes:{icon:`tick-circle`},no:{icon:`close-circle`},warn:{icon:`danger`},partial:{icon:`minus-circle`}};function m(e){return typeof e==`object`&&!!e&&!i(e)}function h(e){return e.scrollLeft+e.clientWidth<e.scrollWidth-1}function g(...e){return e.filter(Boolean).join(` `)||void 0}function _(e){return g(e.highlight&&`is-highlight`,e.align===`center`&&`wui-compare-center`,e.nowrap&&`wui-compare-nowrap`)}function v(e,r){if(e===!0)return/* @__PURE__ */ l(`span`,{className:`compare-yes`,children:[/* @__PURE__ */ c(t,{name:`check`,size:16}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:r.yesLabel})]});if(e===!1)return/* @__PURE__ */ l(`span`,{className:`compare-no`,children:[/* @__PURE__ */ c(`span`,{"aria-hidden":`true`,children:`-`}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:r.noLabel})]});if(m(e)&&`state`in e){let i=p[e.state],a={yes:r.yesLabel,no:r.noLabel,warn:r.warningLabel,partial:r.partialLabel};return n(`AppCompareTable`,`state`,e.state,Object.keys(p)),/* @__PURE__ */ l(`span`,{className:`wui-compare-state wui-compare-state-${e.state}`,children:[i&&/* @__PURE__ */ c(t,{name:i.icon,size:16,variant:`bulk`}),i&&/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:`${a[e.state]}: `}),e.text]})}return m(e)&&`code`in e?/* @__PURE__ */ c(`span`,{className:`wui-compare-code`,children:e.code}):e}function y(e,t,n){let r=[],i=null;return t.forEach((t,a)=>{t.group!=null&&t.group!==i&&r.push(/* @__PURE__ */ c(`tr`,{className:`wui-compare-group-row`,children:/* @__PURE__ */ c(`th`,{colSpan:e.length,scope:`rowgroup`,className:`wui-compare-group`,children:t.group})},`group:${t.group}:${t.key??t.label}`)),i=t.group??null,r.push(/* @__PURE__ */ l(`tr`,{children:[/* @__PURE__ */ c(`th`,{scope:`row`,children:t.label}),t.values.map((t,r)=>{let i=e[r+1];return/* @__PURE__ */ c(`td`,{className:_(i??{}),"data-label":i?.label,children:v(t,n)},i?.label??r)})]},t.key??`${t.label}-${a}`))}),r}function b(t){let{marker:i,props:p}=e(`AppCompareTable`,t),{columns:m,rows:v,caption:b,mobile:x=`stack`,stickyFirstColumn:S=!1,stickyHeader:C=!1,density:w=`comfortable`,yesLabel:T=`Yes`,noLabel:E=`No`,warningLabel:D=`Warning`,partialLabel:O=`Partial`,className:k=``,...A}=p,j={yesLabel:T,noLabel:E,warningLabel:D,partialLabel:O},M=o(null),[N,P]=s(!1);if(a(()=>{let e=()=>{let e=M.current;e&&P(h(e))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),!Array.isArray(m))throw Error(`<AppCompareTable> columns is required: pass the feature-name column, then one per option.`);if(!Array.isArray(v))throw Error(`<AppCompareTable> rows is required: pass one row per capability.`);r(`AppCompareTable`,A),n(`AppCompareTable`,`mobile`,x,u),n(`AppCompareTable`,`density`,w,d);for(let e of m)n(`AppCompareTable`,`align`,e.align,f);let F=x===`scroll`,I=/* @__PURE__ */ l(`table`,{className:g(F&&`wui-compare-scroll-table`,F&&S&&`wui-compare-sticky-first`),children:[b&&/* @__PURE__ */ c(`caption`,{className:`visually-hidden`,children:b}),/* @__PURE__ */ c(`thead`,{children:/* @__PURE__ */ c(`tr`,{children:m.map((e,t)=>/* @__PURE__ */ c(`th`,{scope:`col`,className:_(e),children:e.label},e.label?`col-${t}-${e.label}`:`col-${t}`))})}),/* @__PURE__ */ c(`tbody`,{children:y(m,v,j)})]});return/* @__PURE__ */ c(`div`,{className:g(`compare-table`,w===`relaxed`&&`wui-compare-relaxed`,C&&`wui-compare-sticky-head`,k),"data-mobile":x,...i,...A,children:F?/* @__PURE__ */ c(`div`,{className:`wui-compare-scroll`,ref:M,tabIndex:0,role:b?`region`:void 0,"aria-label":b||void 0,"data-more":N?`end`:void 0,onScroll:e=>P(h(e.currentTarget)),children:I}):I})}export{b as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppButton.js";import n from"./AppIcon.js";import r from"./AppInput.js";import i from"./AppModal.js";import{MODAL_ICONS as a}from"./ModalIcons.js";import o from"./warnInvalidValue.js";import s from"./warnUnknownProps.js";import{useEffect as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`sm`,`md`,`lg`,`xl`],m=[`default`,`plain`];function h(h){let{marker:g,props:_}=e(`AppConfirmDialog`,h),{open:v,title:y,variant:b=`default`,message:x,confirmLabel:S=`Confirm`,cancelLabel:C=`Cancel`,danger:w=!1,tone:T,image:E,icon:D,iconSize:O,confirmPhrase:k,onConfirm:A,onClose:j,loading:M=!1,staticBackdrop:N=!1,placement:P=`center`,size:F=`md`,className:I=``,children:L,...R}=_;s(`AppConfirmDialog`,R),o(`AppConfirmDialog`,`tone`,T,Object.keys(a)),o(`AppConfirmDialog`,`size`,typeof F==`string`?F:null,p),o(`AppConfirmDialog`,`variant`,b,m);let[z,B]=l(``);if(c(()=>{v||B(``)},[v]),!v)return null;let V=!!k&&z.trim()!==k,H=b===`plain`,U=H?`sm`:`md`,W=H||E||D?null:a[T||(w?`delete`:`info`)],G=O>0?{"--wui-confirm-icon-size":`${O}px`}:void 0,K=()=>{M||j?.()};return/* @__PURE__ */ d(i,{...g,...R,open:v,hideHeader:!0,title:y,onClose:K,staticBackdrop:N,placement:P,size:F,className:[`wui-confirm`,H&&`wui-confirm-plain`,I].filter(Boolean).join(` `),footer:/* @__PURE__ */ f(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ d(t,{variant:H?`light`:`secondary`,size:U,disabled:M,onClick:K,children:C}),/* @__PURE__ */ d(t,{variant:w?`danger`:`primary`,size:U,disabled:V,loading:M,onClick:A,children:S})]}),children:/* @__PURE__ */ f(`div`,{className:`wui-confirm-content`,children:[!H&&E?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:G,children:/* @__PURE__ */ d(`img`,{src:E,alt:``,"aria-hidden":`true`})}):!H&&D?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:G,children:typeof D==`string`?/* @__PURE__ */ d(n,{name:D,size:80}):D}):W&&/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:G,children:/* @__PURE__ */ d(W,{size:120})}),/* @__PURE__ */ d(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:y}),x&&/* @__PURE__ */ d(`p`,{className:`wui-confirm-msg`,children:x}),L!=null&&L!==!1&&/* @__PURE__ */ d(`div`,{className:`wui-confirm-body`,children:L}),k&&/* @__PURE__ */ d(r,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ f(u,{children:[`Type `,/* @__PURE__ */ d(`strong`,{children:k}),` to confirm`]}),value:z,onChange:e=>B(e.target.value),"aria-label":`Type ${k} to confirm`,disabled:M})]})})}export{h as default};
1
+ import e from"../lib/fillLabel.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import i from"./AppInput.js";import a from"./AppModal.js";import{MODAL_ICONS as o}from"./ModalIcons.js";import s from"./warnInvalidValue.js";import c from"./warnUnknownProps.js";import{useEffect as l,useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`,`xl`],h=[`default`,`plain`];function g(g){let{marker:_,props:v}=t(`AppConfirmDialog`,g),{open:y,title:b,variant:x=`default`,message:S,confirmLabel:C=`Confirm`,cancelLabel:w=`Cancel`,typePhraseLabel:T=`Type {phrase} to confirm`,danger:E=!1,tone:D,image:O,icon:k,iconSize:A,confirmPhrase:j,onConfirm:M,onClose:N,loading:P=!1,staticBackdrop:F=!1,placement:I=`center`,size:L=`md`,className:R=``,children:z,...B}=v;c(`AppConfirmDialog`,B),s(`AppConfirmDialog`,`tone`,D,Object.keys(o)),s(`AppConfirmDialog`,`size`,typeof L==`string`?L:null,m),s(`AppConfirmDialog`,`variant`,x,h);let[V,H]=u(``);if(l(()=>{y||H(``)},[y]),!y)return null;let U=!!j&&V.trim()!==j,[W,...G]=T.split(`{phrase}`),K=G.join(j),q=x===`plain`,J=q?`sm`:`md`,Y=q||O||k?null:o[D||(E?`delete`:`info`)],X=A>0?{"--wui-confirm-icon-size":`${A}px`}:void 0,Z=()=>{P||N?.()};return/* @__PURE__ */ f(a,{..._,...B,open:y,hideHeader:!0,title:b,onClose:Z,staticBackdrop:F,placement:I,size:L,className:[`wui-confirm`,q&&`wui-confirm-plain`,R].filter(Boolean).join(` `),footer:/* @__PURE__ */ p(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ f(n,{variant:q?`light`:`secondary`,size:J,disabled:P,onClick:Z,children:w}),/* @__PURE__ */ f(n,{variant:E?`danger`:`primary`,size:J,disabled:U,loading:P,onClick:M,children:C})]}),children:/* @__PURE__ */ p(`div`,{className:`wui-confirm-content`,children:[!q&&O?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(`img`,{src:O,alt:``,"aria-hidden":`true`})}):!q&&k?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:typeof k==`string`?/* @__PURE__ */ f(r,{name:k,size:80}):k}):Y&&/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(Y,{size:120})}),/* @__PURE__ */ f(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:b}),S&&/* @__PURE__ */ f(`p`,{className:`wui-confirm-msg`,children:S}),z!=null&&z!==!1&&/* @__PURE__ */ f(`div`,{className:`wui-confirm-body`,children:z}),j&&/* @__PURE__ */ f(i,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ p(d,{children:[W,/* @__PURE__ */ f(`strong`,{children:j}),K]}),value:V,onChange:e=>H(e.target.value),"aria-label":e(T,{phrase:j}),disabled:P})]})})}export{g as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppButton.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import a from"./withTooltip.js";import{COPY_FEEDBACK_MS as o,copyTextToClipboard as s}from"@webority/ui-elements/helpers";import{useCallback as c,useEffect as l,useRef as u,useState as d}from"react";import{jsx as f}from"react/jsx-runtime";var p={sm:14,md:16,lg:20};function m(m){let{marker:h,props:g}=e(`AppCopyButton`,m),{text:_,label:v=`Copy`,copiedLabel:y=`Copied`,iconOnly:b=!1,size:x=`md`,variant:S=`ghost`,onCopied:C,className:w=``,tooltip:T,tooltipPlacement:E,...D}=g;i(`AppCopyButton`,D),r(`AppCopyButton`,`size`,x,Object.keys(p));let[O,k]=d(!1),A=u(null);l(()=>()=>clearTimeout(A.current),[]);let j=c(async()=>{await s(_)&&(k(!0),clearTimeout(A.current),A.current=setTimeout(()=>k(!1),o),C?.())},[_,C]),M=O?y:v,N=O?`check`:`files`;return a(b?/* @__PURE__ */ f(t,{icon:N,label:M,size:p[x]??p.md,onClick:j,className:w,...D,...h}):/* @__PURE__ */ f(n,{leftIcon:N,variant:S,size:x,onClick:j,className:w,"aria-live":`polite`,...D,...h,children:M}),T,E)}export{m as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppActionIcon.js";import n from"./AppButton.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import a from"./withTooltip.js";import{COPY_FEEDBACK_MS as o,copyTextToClipboard as s}from"@webority/ui-elements/helpers";import{useCallback as c,useEffect as l,useRef as u,useState as d}from"react";import{jsx as f}from"react/jsx-runtime";var p={sm:14,md:16,lg:20},m=[`ghost`,`outline`,`secondary`,`light`];function h(h){let{marker:g,props:_}=e(`AppCopyButton`,h),{text:v,label:y=`Copy`,copiedLabel:b=`Copied`,iconOnly:x=!1,size:S=`md`,variant:C=`ghost`,onCopied:w,className:T=``,tooltip:E,tooltipPlacement:D,...O}=_;i(`AppCopyButton`,O),r(`AppCopyButton`,`size`,S,Object.keys(p)),r(`AppCopyButton`,`variant`,C,m);let[k,A]=d(!1),j=u(null);l(()=>()=>clearTimeout(j.current),[]);let M=c(async()=>{await s(v)&&(A(!0),clearTimeout(j.current),j.current=setTimeout(()=>A(!1),o),w?.())},[v,w]),N=k?b:y,P=k?`check`:`files`;return a(x?/* @__PURE__ */ f(t,{icon:P,label:N,size:p[S]??p.md,onClick:M,className:T,...O,...g}):/* @__PURE__ */ f(n,{leftIcon:P,variant:C,size:S,onClick:M,className:T,"aria-live":`polite`,...O,...g,children:N}),E,D)}export{h as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{loadFlagStyles as t}from"../lib/flagStyles.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import o from"./warnInvalidValue.js";import s from"./warnUnknownProps.js";import{cloneElement as c,forwardRef as l,useEffect as u,useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/country-select";var m=[`sm`,`md`,`lg`],h=[`off`,`border`],g=l(function(l,g){let{marker:_,props:v}=n(`AppCountrySelect`,l),{value:y,onChange:b,countries:x,placeholder:S=`Select country`,searchPlaceholder:C=`Search countries...`,searchable:w=!0,clearable:T=!1,size:E=`md`,floatingLabel:D=`off`,disabled:O,open:k,label:A,required:j=!1,optional:M=!1,error:N,hint:P,help:F,helpLabel:I=`More information`,id:L,name:R,className:z=``,fieldClassName:B=``,"aria-label":V,"aria-labelledby":H,"aria-describedby":U,...W}=v;s(`AppCountrySelect`,W),o(`AppCountrySelect`,`size`,E,m),o(`AppCountrySelect`,`floatingLabel`,D,h),u(()=>{t()},[]);let G=d(),{setRef:K}=a({ref:g,value:y??``,onChange:b}),q=L||G,J=D!==`off`&&A,Y=N&&q?`${q}-error`:void 0,X=P&&q?`${q}-hint`:void 0,Z=/* @__PURE__ */ f(`wui-country-select`,{"aria-label":V||(typeof A==`string`?A:void 0),"aria-labelledby":H||void 0,"aria-describedby":Y||X||U||void 0,"aria-invalid":N?`true`:void 0,ref:K,id:q,name:R,countries:Array.isArray(x)?x.join(`,`):void 0,placeholder:J?` `:S,"search-placeholder":C,searchable:w?``:void 0,clearable:T?``:void 0,size:E===`sm`||E===`lg`?E:void 0,disabled:O?``:void 0,open:k?``:void 0,required:j?``:void 0,className:z||void 0,...W});if(!A&&!N&&!P)return c(Z,_);let Q=[`field`,B].filter(Boolean).join(` `);return/* @__PURE__ */ p(`div`,{..._,className:Q,children:[A&&!J&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:q,children:[A,M&&!j&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` (optional)`}),j&&/* @__PURE__ */ f(i,{}),F&&/* @__PURE__ */ f(r,{label:I,children:F})]}),J?/* @__PURE__ */ p(`div`,{className:`field-float`,children:[Z,/* @__PURE__ */ p(`label`,{className:`float-label`,htmlFor:q,children:[A,M&&!j&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` (optional)`}),j&&/* @__PURE__ */ f(i,{})]})]}):Z,/* @__PURE__ */ f(e,{error:N,hint:P,errorId:Y,hintId:X})]})});export{g as default};
1
+ import e from"../lib/FieldMessage.js";import{loadFlagStyles as t}from"../lib/flagStyles.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import o from"./warnInvalidValue.js";import s from"./warnUnknownProps.js";import{cloneElement as c,forwardRef as l,useEffect as u,useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/country-select";var m=[`sm`,`md`,`lg`],h=[`off`,`border`],g=l(function(l,g){let{marker:_,props:v}=n(`AppCountrySelect`,l),{value:y,onChange:b,countries:x,placeholder:S=`Select country`,searchPlaceholder:C=`Search countries...`,searchable:w=!0,clearable:T=!1,size:E=`md`,floatingLabel:D=`off`,disabled:O,open:k,label:A,required:j=!1,optional:M=!1,optionalLabel:N=`(optional)`,error:P,hint:F,help:I,helpLabel:L=`More information`,id:R,name:z,className:B=``,fieldClassName:V=``,"aria-label":H,"aria-labelledby":U,"aria-describedby":W,...G}=v;s(`AppCountrySelect`,G),o(`AppCountrySelect`,`size`,E,m),o(`AppCountrySelect`,`floatingLabel`,D,h),u(()=>{t()},[]);let K=d(),{setRef:q}=a({ref:g,value:y??``,onChange:b}),J=R||K,Y=D!==`off`&&A,X=P&&J?`${J}-error`:void 0,Z=F&&J?`${J}-hint`:void 0,Q=/* @__PURE__ */ f(`wui-country-select`,{"aria-label":H||(typeof A==`string`?A:void 0),"aria-labelledby":U||void 0,"aria-describedby":X||Z||W||void 0,"aria-invalid":P?`true`:void 0,ref:q,id:J,name:z,countries:Array.isArray(x)?x.join(`,`):void 0,placeholder:Y?` `:S,"search-placeholder":C,searchable:w?``:void 0,clearable:T?``:void 0,size:E===`sm`||E===`lg`?E:void 0,disabled:O?``:void 0,open:k?``:void 0,required:j?``:void 0,className:B||void 0,...G});if(!A&&!P&&!F)return c(Q,_);let $=[`field`,V].filter(Boolean).join(` `);return/* @__PURE__ */ p(`div`,{..._,className:$,children:[A&&!Y&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:J,children:[A,M&&!j&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${N}`}),j&&/* @__PURE__ */ f(i,{}),I&&/* @__PURE__ */ f(r,{label:L,children:I})]}),Y?/* @__PURE__ */ p(`div`,{className:`field-float`,children:[Q,/* @__PURE__ */ p(`label`,{className:`float-label`,htmlFor:J,children:[A,M&&!j&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${N}`}),j&&/* @__PURE__ */ f(i,{})]})]}):Q,/* @__PURE__ */ f(e,{error:P,hint:F,errorId:X,hintId:Z})]})});export{g as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./AppSkeleton.js";import i from"./AppTablePagination.js";import a from"./warnInvalidValue.js";import o from"./warnUnknownProps.js";import{attachRowDrag as s,attachScrollEdges as c,syncTargets as ee}from"@webority/ui-elements/helpers";import{Children as l,Fragment as te,useEffect as u,useLayoutEffect as d,useMemo as ne,useRef as f,useState as p}from"react";import{Fragment as re,jsx as m,jsxs as h}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as ie}from"@webority/theme/runtime";import{COLUMN_MAX_WIDTH as ae,COLUMN_MIN_WIDTH as oe,DATA_TABLE_TEXT as se,PIN_AT_VAR as ce,PIN_SIDES as le,ROW_HEIGHTS as ue,ROW_MOVE_LIMIT as de,ROW_SAVE_ERROR_CLASS as fe,groupCount as pe,groupItems as me,measureRows as he,pinAtValue as ge,pinClasses as _e,planPins as ve,playRowMoves as ye,rowOrderChanged as be,saveOutcomeText as xe,settledRows as Se,virtualRange as Ce}from"@webority/ui-elements/elements/data-table";var we=[`comfortable`,`cozy`,`compact`],Te=[`auto`,`fixed`],Ee=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},g=/* @__PURE__ */ new Set;function _(t,n){!g.has(t)&&Ee()&&(g.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var De=100,Oe=e=>e.id,ke=()=>{},Ae=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function v(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function je(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function Me(e){return e==null||e===``?`-`:Array.isArray(e)?l.toArray(e):typeof e==`boolean`?String(e):e}function Ne(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function y(e){let{marker:l,props:Ee}=t(`AppDataTable`,e),{columns:g,rows:y,rowKey:b=Oe,sort:x,onSort:S,loading:C=!1,skeletonRows:Pe=5,empty:Fe=`No records found.`,emptyFiltered:Ie,sourceCount:Le,rowActions:w,rowActionsLabel:Re,pagination:T,ariaLabel:ze,className:Be=``,wrapperClassName:Ve=``,selectable:E=!1,selectedIds:D,isRowSelectable:He,onToggleRow:Ue,onToggleAll:We,onSelectRange:Ge,renderExpanded:Ke,density:O=`comfortable`,tableLayout:qe=`auto`,striped:Je=!1,flush:Ye=!1,pad:Xe,headerTone:Ze,rowDrag:k=!1,maxHeight:Qe,stickyFirstColumn:$e=!1,stickyActions:et=!1,stackOnMobile:A=!1,hiddenColumns:tt,rowStatus:nt,rowHref:j,onRowClick:rt,activeRowKey:it,hoverRowKey:at,resizableColumns:M=!1,viewKey:ot,groupBy:N,groupLabel:st,virtual:P=!1,rowSaving:F,rowSaveError:I,...ct}=Ee;o(`AppDataTable`,ct);let{style:lt,...ut}=ct,dt=tt?.length?new Set(tt):null;g=dt?g.filter(e=>!(e.hideable&&dt.has(e.key))):g,a(`AppDataTable`,`density`,O,we),a(`AppDataTable`,`tableLayout`,qe,Te);for(let e of g)a(`AppDataTable`,`column.pin`,e.pin,le);let ft=[`table table-ledger`,O===`cozy`||O===`compact`?`wui-table-${O}`:``,Je?`wui-table-striped`:``,$e?`wui-table-sticky-first`:``,et?`wui-table-sticky-actions`:``,A?`wui-table-stack`:``,Be].filter(Boolean).join(` `),L=typeof Ke==`function`,[pt,mt]=p(()=>/* @__PURE__ */ new Set),ht=e=>mt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),gt=g.some(e=>typeof e.footer==`function`),R=typeof j==`function`||typeof rt==`function`,_t=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),vt=(e,t)=>{if(_t(t)||(rt&&rt(e),!j))return;let n=j(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},z=Qe!==void 0,yt=[`table-wrap`,z?`wui-table-scroll`:``,Ye?`wui-table-flush`:``,Ve].filter(Boolean).join(` `),bt={maxHeight:z?Qe:void 0,"--wui-table-pad":Xe!=null&&!Ye?`${Xe}px`:void 0,"--wui-table-header-bg":Ze??void 0},xt=Object.values(bt).some(e=>e!==void 0)||lt!==void 0?{...bt,...lt}:void 0,St=Math.max(1,g.length+ +!!w+ +!!E+ +!!L),Ct=g.some(e=>e.pin===`start`||e.pin===`end`),B=Ct||M||!!N||P,V=+!!L+ +!!E,wt=Ct?ve([...L?[`lead`]:[],...E?[`lead`]:[],...g.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...w?[null]:[]]):[],H=(e,t=``)=>{let n=wt[e];return n?{className:`${t.trim()} ${_e(n)}`.trim(),style:{[ce]:ge(n.side,n.ordinal)}}:{className:t,style:void 0}},U=(e,t)=>wt[e]?{...t,...H(e).style}:t,Tt=g.length-1+ +!!w;ot&&!M&&_(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),P&&!z&&_(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),P&&(L||A)&&_(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!P&&y?.length>500&&_(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let W=P&&z&&!L&&!A&&!C&&y?.length>0,G=(e,t)=>!He||!!He(e,t),Et=E&&y?y.reduce((e,t,n)=>e+ +!!G(t,n),0):0,K=E&&y?y.reduce((e,t,n)=>e+(G(t,n)&&D?.has(b(t,n))?1:0),0):0,Dt=Et>0&&K===Et,Ot=K>0&&!Dt,kt=e=>{e&&(e.indeterminate=Ot)},At=f(null),jt=(e,t)=>{let n=At.current;At.current=e;let r=t&&n!==null?y.findIndex((e,t)=>b(e,t)===n):-1,i=y.findIndex((t,n)=>b(t,n)===e);if(r<0||i<0||r===i){Ue?.(e);return}let a=!D?.has(e),o=Math.min(r,i),s=y.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>G(e,t)).map(([e,t])=>b(e,t)).filter(e=>(D?.has(e)||!1)!==a);if(Ge)Ge(s,a);else for(let e of s)Ue?.(e)},Mt=e=>{He?(y||[]).forEach((t,n)=>{let r=b(t,n);G(t,n)&&(D?.has(r)||!1)!==e&&Ue?.(r)}):We?.(e)},[Nt,Pt]=p(()=>/* @__PURE__ */ new Set),Ft=e=>Pt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),q=ne(()=>{let e=(y||[]).map((e,t)=>({row:e,i:t}));return N?me(e,({row:e})=>String(e[N]??``)).flatMap(e=>[{group:e,open:!Nt.has(e.key)},...Nt.has(e.key)?[]:e.items]):e},[y,N,Nt]),J=f(null),It=f(null);u(()=>{let e=J.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);It.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(It.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=c(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[B]),u(()=>{if(!k||!J.current)return;let e=s(J.current);return ee(document),e},[k,B]);let Lt=f(!1);u(()=>{!Lt.current&&(Lt.current=!0,K===0)||J.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:K,total:y?.length??0,keys:y?y.flatMap((e,t)=>{let n=b(e,t);return G(e,t)&&D?.has(n)?[String(n)]:[]}):[]}}))},[E,K]);let[Rt,zt]=p({top:0,height:0}),[Y,Bt]=p(ue[O]??ue.comfortable);u(()=>{let e=J.current;if(!W||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};zt(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[W,B]),d(()=>{if(!W)return;let e=(J.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-Y)>.5&&Bt(e)},[O,y?.length,P,W]);let X={start:0,end:q.length,before:0,after:0};if(W){X=Ce({scrollTop:Rt.top,viewport:Rt.height||Number.parseFloat(Qe)||0,rowHeight:Y,count:q.length});let e=It.current;e!==null&&e>=0&&e<q.length&&(e<X.start&&X.start-e<=De&&(X={...X,start:e,before:e*Y}),e>=X.end&&e-X.end<De&&(X={...X,end:e+1,after:(q.length-e-1)*Y}))}let Vt=f(null),Ht=f(null),Ut=f(null),Wt=!P&&!C&&y?.length>0&&y.length<=de;d(()=>{let e=Vt.current;if(!Wt||!e){Ht.current=null,Ut.current=null;return}let t=y.map((e,t)=>b(e,t));be(Ut.current,t)&&ye(e.rows,Ht.current),Ht.current=he(e.rows),Ut.current=t});let Gt=typeof F==`function`||typeof I==`function`,Kt=f(null),qt=f(null);u(()=>{if(!Gt){qt.current=null;return}let e=g[0]?.key,t=/* @__PURE__ */ new Map;(y||[]).forEach((n,r)=>{let i=e===void 0?void 0:n[e],a=typeof i==`string`||typeof i==`number`?String(i):``;t.set(b(n,r),{...Ae(n,F,I),label:a})});let n=xe(Se(qt.current,t));qt.current=t,n&&Kt.current&&(Kt.current.textContent=n)},[y,F,I,b]);let Z=Ie!==void 0&&(Le===void 0||Le>0)?Ie:Fe,Jt=({group:e,open:t},r)=>{let i=e.items[0].row[N],a=e.items.map(e=>e.row);return/* @__PURE__ */ m(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":W?r+2:void 0,children:/* @__PURE__ */ m(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:St,children:/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>Ft(e.key),children:[/* @__PURE__ */ m(n,{name:`chevron-down`,size:16}),/* @__PURE__ */ m(`span`,{className:`wui-group-label`,children:st?st(i,a):Me(i)}),/* @__PURE__ */ m(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:pe(e.items.length)}),/* @__PURE__ */ m(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${se.rows(e.items.length)}`})]})})},`group:${e.key}`)},Yt=({row:e,i:t},r)=>{let i=b(e,t),a=L&&pt.has(i),o=it!=null&&String(it)===String(i),s=at!=null&&String(at)===String(i),c=String(i).replace(/[^a-z0-9]/gi,`_`),ee=H(0,`wui-expand-cell`),l=H(+!!L,`wui-select-cell`),u=Gt?Ae(e,F,I):null,d=G(e,t);return/* @__PURE__ */ h(te,{children:[/* @__PURE__ */ h(`tr`,{className:[E&&d&&D?.has(i)?`is-selected`:``,R?`wui-row-link`:``,o?`wui-row-active`:``,s?ie.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":W?r+2:void 0,"aria-busy":u?.state===`saving`?`true`:void 0,"data-wui-save-state":u?.state||void 0,"data-status":nt?.(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=>vt(e,t):void 0,onAuxClick:R&&j?t=>t.button===1&&vt(e,t):void 0,onKeyDown:R?t=>{t.key===`Enter`&&t.target===t.currentTarget&&vt(e,t)}:void 0,children:[L&&/* @__PURE__ */ m(`td`,{className:ee.className,style:ee.style,children:/* @__PURE__ */ m(`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:()=>ht(i),children:/* @__PURE__ */ m(n,{name:`chevron-down`,size:16})})}),E&&/* @__PURE__ */ m(`td`,{className:l.className,style:l.style,children:/* @__PURE__ */ m(`input`,{type:`checkbox`,className:`wui-check`,checked:d&&(D?.has(i)||!1),disabled:!d,onChange:e=>jt(i,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),g.map((t,n)=>/* @__PURE__ */ h(`td`,{className:H(V+n,(n===0?`wui-name-cell `:``)+(t.nowrap?`text-nowrap `:``)+v(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:U(V+n,t.cellStyle),"data-label":A&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):Me(e[t.key]),n===0&&u?.state===`error`&&/* @__PURE__ */ m(`span`,{className:fe,children:u.message})]},t.key)),w&&/* @__PURE__ */ m(`td`,{children:/* @__PURE__ */ m(`div`,{className:`u-row-actions`,children:w(e)})})]}),a&&/* @__PURE__ */ m(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ m(`td`,{id:`${c}-expanded`,colSpan:St,children:Ke(e)})})]},i)},Xt=(e,t)=>e.group?Jt(e,t):Yt(e,t),Zt=(e,t)=>W?/* @__PURE__ */ m(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ m(`td`,{colSpan:St,style:{height:t}})},e):null,Q=H(0,`wui-expand-cell`),$=H(+!!L,`wui-select-cell`),Qt=()=>Array.from({length:Pe},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ h(`tr`,{children:[L&&/* @__PURE__ */ m(`td`,{className:Q.className,style:Q.style}),E&&/* @__PURE__ */ m(`td`,{className:$.className,style:$.style}),g.map((e,t)=>/* @__PURE__ */ m(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+v(e.align)).className,style:U(V+t,void 0),"data-label":A&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ m(r,{width:je(e.align),height:12,radius:6})},e.key)),w&&/* @__PURE__ */ m(`td`,{children:/* @__PURE__ */ m(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ m(r,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ h(re,{children:[/* @__PURE__ */ h(B?`wui-data-table`:`div`,{ref:J,...B?{class:yt,resizable:M?``:void 0,"view-key":ot||void 0,"data-wui-row-drag":k?``:void 0}:{className:yt,"data-wui-row-drag":k?``:void 0},style:xt,tabIndex:0,...l,...ut,children:[/* @__PURE__ */ h(`table`,{className:ft,"aria-label":ze,"aria-rowcount":W?q.length+1:void 0,style:qe===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ m(`thead`,{children:/* @__PURE__ */ h(`tr`,{"aria-rowindex":W?1:void 0,children:[L&&/* @__PURE__ */ m(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ m(`span`,{className:`visually-hidden`,children:`Expand`})}),E&&/* @__PURE__ */ m(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ m(`input`,{ref:kt,type:`checkbox`,className:`wui-check`,checked:Dt,disabled:C,onChange:e=>Mt(e.target.checked),"aria-label":`Select all rows`})}),g.map((e,t)=>{let r=!!(e.sortable&&S),i=x&&x.key===e.key,a=e.align===`num`||e.align===`end`,o=r&&/* @__PURE__ */ m(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:/* @__PURE__ */ m(n,{name:`chevrons-up-down`,size:14})}),s=M&&t!==Tt,c=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ h(`th`,{className:H(V+t,(r?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+v(e.align)).className,style:U(V+t,c),"data-key":B?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:r?0:void 0,"aria-sort":i?x.dir===`asc`?`ascending`:`descending`:r?`none`:void 0,onClick:r?()=>{C||S(e.key)}:void 0,onKeyDown:r?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),C||S(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&/* @__PURE__ */ m(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":oe,"aria-valuemax":ae,tabIndex:0,"aria-label":se.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),w&&(Re?/* @__PURE__ */ m(`th`,{className:`wui-cell-end`,children:Re}):/* @__PURE__ */ m(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ m(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),/* @__PURE__ */ m(`tbody`,{ref:Vt,children:C?Qt():y?.length?/* @__PURE__ */ h(re,{children:[Zt(`before`,X.before),q.slice(X.start,X.end).map((e,t)=>Xt(e,X.start+t)),Zt(`after`,X.after)]}):null}),gt&&!C&&y?.length>0&&/* @__PURE__ */ m(`tfoot`,{children:/* @__PURE__ */ h(`tr`,{children:[L&&/* @__PURE__ */ m(`td`,{className:Q.className,style:Q.style}),E&&/* @__PURE__ */ m(`td`,{className:$.className,style:$.style}),g.map((e,t)=>/* @__PURE__ */ m(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+v(e.align)).className,style:U(V+t,void 0),children:e.footer?e.footer(y):null},e.key)),w&&/* @__PURE__ */ m(`td`,{})]})})]}),!C&&!y?.length&&/* @__PURE__ */ m(`div`,{className:`tbl-empty-block`,children:typeof Z==`string`?/* @__PURE__ */ m(`div`,{className:`tbl-empty-plain`,children:Z}):Z})]}),Ne(T)&&/* @__PURE__ */ m(i,{page:T.page,totalPages:T.totalPages,pageSize:T.pageSize,onPageChange:C?ke:T.setPage,onPageSizeChange:C?ke:T.setPageSize,pageSizes:T.pageSizes,mode:T.mode}),Gt&&/* @__PURE__ */ m(`div`,{ref:Kt,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{y as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./AppSkeleton.js";import i from"./AppTablePagination.js";import a from"./warnInvalidValue.js";import o from"./warnUnknownProps.js";import{attachRowDrag as s,attachScrollEdges as c,syncTargets as ee}from"@webority/ui-elements/helpers";import{Children as l,Fragment as te,useEffect as u,useLayoutEffect as d,useMemo as ne,useRef as f,useState as p}from"react";import{Fragment as re,jsx as m,jsxs as h}from"react/jsx-runtime";import{FORCED_STATE_CLASSES as ie}from"@webority/theme/runtime";import{COLUMN_MAX_WIDTH as ae,COLUMN_MIN_WIDTH as oe,DATA_TABLE_TEXT as se,PIN_AT_VAR as ce,PIN_SIDES as le,ROW_HEIGHTS as ue,ROW_MOVE_LIMIT as de,ROW_SAVE_ERROR_CLASS as fe,groupCount as pe,groupItems as me,measureRows as he,pinAtValue as ge,pinClasses as _e,planPins as ve,playRowMoves as ye,rowOrderChanged as be,saveOutcomeText as xe,settledRows as Se,virtualRange as Ce}from"@webority/ui-elements/elements/data-table";var we=[`comfortable`,`cozy`,`compact`],Te=[`auto`,`fixed`],Ee=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},g=/* @__PURE__ */ new Set;function _(t,n){!g.has(t)&&Ee()&&(g.add(t),e(`[@webority/ui-react] <AppDataTable> ${n}`))}var De=100,Oe=e=>e.id,ke=()=>{},Ae=(e,t,n)=>{let r=!!t?.(e),i=r?``:n?.(e)||``;return{state:r?`saving`:i?`error`:null,message:i}};function v(e){return e===`end`?`wui-cell-end`:e===`num`?`num`:e===`center`?`text-center`:``}function je(e){return e===`center`?`44%`:e===`end`||e===`num`?`56%`:`60%`}function Me(e){return e==null||e===``?`-`:Array.isArray(e)?l.toArray(e):typeof e==`boolean`?String(e):e}function Ne(e){if(!e||!(e.total>0))return!1;let t=e.pageSizes?.length?e.pageSizes:[e.pageSize];return e.total>Math.min(...t)}function y(e){let{marker:l,props:Ee}=t(`AppDataTable`,e),{columns:g,rows:y,rowKey:b=Oe,sort:x,onSort:S,loading:C=!1,skeletonRows:Pe=5,empty:Fe=`No records found.`,emptyFiltered:Ie,sourceCount:Le,rowActions:w,rowActionsLabel:Re,pagination:T,ariaLabel:ze,className:Be=``,wrapperClassName:Ve=``,selectable:E=!1,selectedIds:D,isRowSelectable:He,onToggleRow:Ue,onToggleAll:We,onSelectRange:Ge,renderExpanded:Ke,density:O=`comfortable`,tableLayout:qe=`auto`,striped:Je=!1,flush:Ye=!1,pad:Xe,headerTone:Ze,rowDrag:k=!1,maxHeight:Qe,stickyFirstColumn:$e=!1,stickyActions:et=!1,stackOnMobile:A=!1,hiddenColumns:tt,rowStatus:nt,rowHref:j,onRowClick:rt,activeRowKey:it,hoverRowKey:at,resizableColumns:M=!1,viewKey:ot,groupBy:N,groupLabel:st,virtual:P=!1,rowSaving:F,rowSaveError:I,...ct}=Ee;o(`AppDataTable`,ct);let{style:lt,...ut}=ct,dt=tt?.length?new Set(tt):null;g=dt?g.filter(e=>!(e.hideable&&dt.has(e.key))):g,a(`AppDataTable`,`density`,O,we),a(`AppDataTable`,`tableLayout`,qe,Te);for(let e of g)a(`AppDataTable`,`column.pin`,e.pin,le);let ft=[`table table-ledger`,O===`cozy`||O===`compact`?`wui-table-${O}`:``,Je?`wui-table-striped`:``,$e?`wui-table-sticky-first`:``,et?`wui-table-sticky-actions`:``,A?`wui-table-stack`:``,Be].filter(Boolean).join(` `),L=typeof Ke==`function`,[pt,mt]=p(()=>/* @__PURE__ */ new Set),ht=e=>mt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),gt=g.some(e=>typeof e.footer==`function`),R=typeof j==`function`||typeof rt==`function`,_t=e=>!!e.target.closest(`a, button, input, select, textarea, label, [role='menu'], [role='menuitem'], .dropdown`),vt=(e,t)=>{if(_t(t)||(rt&&rt(e),!j))return;let n=j(e);n&&(t.ctrlKey||t.metaKey||t.button===1?window.open(n,`_blank`,`noopener`):window.location.assign(n))},z=Qe!==void 0,yt=[`table-wrap`,z?`wui-table-scroll`:``,Ye?`wui-table-flush`:``,Ve].filter(Boolean).join(` `),bt={maxHeight:z?Qe:void 0,"--wui-table-pad":Xe!=null&&!Ye?`${Xe}px`:void 0,"--wui-table-header-bg":Ze??void 0},xt=Object.values(bt).some(e=>e!==void 0)||lt!==void 0?{...bt,...lt}:void 0,St=Math.max(1,g.length+ +!!w+ +!!E+ +!!L),Ct=g.some(e=>e.pin===`start`||e.pin===`end`),B=Ct||M||!!N||P,V=+!!L+ +!!E,wt=Ct?ve([...L?[`lead`]:[],...E?[`lead`]:[],...g.map(e=>e.pin===`start`||e.pin===`end`?e.pin:null),...w?[null]:[]]):[],H=(e,t=``)=>{let n=wt[e];return n?{className:`${t.trim()} ${_e(n)}`.trim(),style:{[ce]:ge(n.side,n.ordinal)}}:{className:t,style:void 0}},U=(e,t)=>wt[e]?{...t,...H(e).style}:t,Tt=g.length-1+ +!!w;ot&&!M&&_(`view-key`,"`viewKey` remembers resized widths: add `resizableColumns`."),P&&!z&&_(`virtual-height`,"`virtual` needs `maxHeight`: without a scroll box every row renders."),P&&(L||A)&&_(`virtual-shape`,"`virtual` takes rows of one height, so it is off with `renderExpanded` or `stackOnMobile`."),!P&&y?.length>500&&_(`rows-without-virtual`,`renders more than 500 rows without virtual: add virtual with maxHeight, or page the data.`);let W=P&&z&&!L&&!A&&!C&&y?.length>0,G=(e,t)=>!He||!!He(e,t),Et=E&&y?y.reduce((e,t,n)=>e+ +!!G(t,n),0):0,K=E&&y?y.reduce((e,t,n)=>e+(G(t,n)&&D?.has(b(t,n))?1:0),0):0,Dt=Et>0&&K===Et,Ot=K>0&&!Dt,kt=e=>{e&&(e.indeterminate=Ot)},At=f(null),jt=(e,t)=>{let n=At.current;At.current=e;let r=t&&n!==null?y.findIndex((e,t)=>b(e,t)===n):-1,i=y.findIndex((t,n)=>b(t,n)===e);if(r<0||i<0||r===i){Ue?.(e);return}let a=!D?.has(e),o=Math.min(r,i),s=y.slice(o,Math.max(r,i)+1).map((e,t)=>[e,o+t]).filter(([e,t])=>G(e,t)).map(([e,t])=>b(e,t)).filter(e=>(D?.has(e)||!1)!==a);if(Ge)Ge(s,a);else for(let e of s)Ue?.(e)},Mt=e=>{He?(y||[]).forEach((t,n)=>{let r=b(t,n);G(t,n)&&(D?.has(r)||!1)!==e&&Ue?.(r)}):We?.(e)},[Nt,Pt]=p(()=>/* @__PURE__ */ new Set),Ft=e=>Pt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),q=ne(()=>{let e=(y||[]).map((e,t)=>({row:e,i:t}));return N?me(e,({row:e})=>String(e[N]??``)).flatMap(e=>[{group:e,open:!Nt.has(e.key)},...Nt.has(e.key)?[]:e.items]):e},[y,N,Nt]),J=f(null),It=f(null);u(()=>{let e=J.current;if(!e)return;let t=e=>{let t=e.target.closest?.(`.u-name`);t&&!t.title&&(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(t.title=t.textContent.trim())},n=e=>{let t=e.target.closest?.(`tbody > tr[aria-rowindex]`)?.getAttribute(`aria-rowindex`);It.current=t?Number(t)-2:null},r=t=>{e.contains(t.relatedTarget)||(It.current=null)};e.addEventListener(`mouseover`,t),e.addEventListener(`focusin`,t),e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,r);let i=c(e);return()=>{e.removeEventListener(`mouseover`,t),e.removeEventListener(`focusin`,t),e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,r),i()}},[B]),u(()=>{if(!k||!J.current)return;let e=s(J.current);return ee(document),e},[k,B]);let Lt=f(!1);u(()=>{!Lt.current&&(Lt.current=!0,K===0)||J.current?.querySelector(`table`)?.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:{selected:K,total:y?.length??0,keys:y?y.flatMap((e,t)=>{let n=b(e,t);return G(e,t)&&D?.has(n)?[String(n)]:[]}):[]}}))},[E,K]);let[Rt,zt]=p({top:0,height:0}),[Y,Bt]=p(ue[O]??ue.comfortable);u(()=>{let e=J.current;if(!W||!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`:scope > table > thead`)?.getBoundingClientRect().height||0,r={top:Math.max(0,e.scrollTop-n),height:e.clientHeight};zt(e=>e.top===r.top&&e.height===r.height?e:r)},r=()=>{t||=requestAnimationFrame(n)};e.addEventListener(`scroll`,r,{passive:!0});let i=typeof ResizeObserver<`u`?new ResizeObserver(r):null;return i?.observe(e),n(),()=>{e.removeEventListener(`scroll`,r),i?.disconnect(),t&&cancelAnimationFrame(t)}},[W,B]),d(()=>{if(!W)return;let e=(J.current?.querySelector(`:scope > table > tbody > tr:not(.wui-virtual-spacer, .wui-group-row)`))?.getBoundingClientRect().height;e>0&&Math.abs(e-Y)>.5&&Bt(e)},[O,y?.length,P,W]);let X={start:0,end:q.length,before:0,after:0};if(W){X=Ce({scrollTop:Rt.top,viewport:Rt.height||Number.parseFloat(Qe)||0,rowHeight:Y,count:q.length});let e=It.current;e!==null&&e>=0&&e<q.length&&(e<X.start&&X.start-e<=De&&(X={...X,start:e,before:e*Y}),e>=X.end&&e-X.end<De&&(X={...X,end:e+1,after:(q.length-e-1)*Y}))}let Vt=f(null),Ht=f(null),Ut=f(null),Wt=!P&&!C&&y?.length>0&&y.length<=de;d(()=>{let e=Vt.current;if(!Wt||!e){Ht.current=null,Ut.current=null;return}let t=y.map((e,t)=>b(e,t));be(Ut.current,t)&&ye(e.rows,Ht.current),Ht.current=he(e.rows),Ut.current=t});let Gt=typeof F==`function`||typeof I==`function`,Kt=f(null),qt=f(null);u(()=>{if(!Gt){qt.current=null;return}let e=g[0]?.key,t=/* @__PURE__ */ new Map;(y||[]).forEach((n,r)=>{let i=e===void 0?void 0:n[e],a=typeof i==`string`||typeof i==`number`?String(i):``;t.set(b(n,r),{...Ae(n,F,I),label:a})});let n=xe(Se(qt.current,t));qt.current=t,n&&Kt.current&&(Kt.current.textContent=n)},[y,F,I,b]);let Z=Ie!==void 0&&(Le===void 0||Le>0)?Ie:Fe,Jt=({group:e,open:t},r)=>{let i=e.items[0].row[N],a=e.items.map(e=>e.row);return/* @__PURE__ */ m(`tr`,{className:`wui-group-row`,"data-group-key":e.key,"aria-rowindex":W?r+2:void 0,children:/* @__PURE__ */ m(`th`,{className:`wui-group-cell`,scope:`rowgroup`,colSpan:St,children:/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-group-toggle`,"aria-expanded":t,onClick:()=>Ft(e.key),children:[/* @__PURE__ */ m(n,{name:`chevron-down`,size:16}),/* @__PURE__ */ m(`span`,{className:`wui-group-label`,children:st?st(i,a):Me(i)}),/* @__PURE__ */ m(`span`,{className:`wui-group-count`,"aria-hidden":`true`,children:pe(e.items.length)}),/* @__PURE__ */ m(`span`,{className:`visually-hidden wui-group-rows`,children:`, ${se.rows(e.items.length)}`})]})})},`group:${e.key}`)},Yt=({row:e,i:t},r)=>{let i=b(e,t),a=L&&pt.has(i),o=it!=null&&String(it)===String(i),s=at!=null&&String(at)===String(i),c=String(i).replace(/[^a-z0-9]/gi,`_`),ee=H(0,`wui-expand-cell`),l=H(+!!L,`wui-select-cell`),u=Gt?Ae(e,F,I):null,d=G(e,t);return/* @__PURE__ */ h(te,{children:[/* @__PURE__ */ h(`tr`,{className:[E&&d&&D?.has(i)?`is-selected`:``,R?`wui-row-link`:``,o?`wui-row-active`:``,s?ie.hover:``].filter(Boolean).join(` `)||void 0,"aria-current":o?`true`:void 0,"aria-rowindex":W?r+2:void 0,"aria-busy":u?.state===`saving`?`true`:void 0,"data-wui-save-state":u?.state||void 0,"data-status":nt?.(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=>vt(e,t):void 0,onAuxClick:R&&j?t=>t.button===1&&vt(e,t):void 0,onKeyDown:R?t=>{t.key===`Enter`&&t.target===t.currentTarget&&vt(e,t)}:void 0,children:[L&&/* @__PURE__ */ m(`td`,{className:ee.className,style:ee.style,children:/* @__PURE__ */ m(`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:()=>ht(i),children:/* @__PURE__ */ m(n,{name:`chevron-down`,size:16})})}),E&&/* @__PURE__ */ m(`td`,{className:l.className,style:l.style,children:/* @__PURE__ */ m(`input`,{type:`checkbox`,className:`wui-check`,checked:d&&(D?.has(i)||!1),disabled:!d,onChange:e=>jt(i,e.nativeEvent.shiftKey),onMouseDown:e=>{e.shiftKey&&e.preventDefault()},"aria-label":`Select row`})}),g.map((t,n)=>/* @__PURE__ */ h(`td`,{className:H(V+n,(n===0?`wui-name-cell `:``)+(t.nowrap?`text-nowrap `:``)+v(t.align)+(t.cellClassName?` ${t.cellClassName}`:``)).className,style:U(V+n,t.cellStyle),"data-label":A&&typeof t.label==`string`?t.label:void 0,children:[t.render?t.render(e):Me(e[t.key]),n===0&&u?.state===`error`&&/* @__PURE__ */ m(`span`,{className:fe,children:u.message})]},t.key)),w&&/* @__PURE__ */ m(`td`,{children:/* @__PURE__ */ m(`div`,{className:`u-row-actions`,children:w(e)})})]}),a&&/* @__PURE__ */ m(`tr`,{className:`wui-row-expanded`,children:/* @__PURE__ */ m(`td`,{id:`${c}-expanded`,colSpan:St,children:Ke(e)})})]},i)},Xt=(e,t)=>e.group?Jt(e,t):Yt(e,t),Zt=(e,t)=>W?/* @__PURE__ */ m(`tr`,{className:`wui-virtual-spacer`,"aria-hidden":`true`,hidden:t===0,children:/* @__PURE__ */ m(`td`,{colSpan:St,style:{height:t}})},e):null,Q=H(0,`wui-expand-cell`),$=H(+!!L,`wui-select-cell`),Qt=()=>Array.from({length:Pe},(e,t)=>`skeleton-${t}`).map(e=>/* @__PURE__ */ h(`tr`,{children:[L&&/* @__PURE__ */ m(`td`,{className:Q.className,style:Q.style}),E&&/* @__PURE__ */ m(`td`,{className:$.className,style:$.style}),g.map((e,t)=>/* @__PURE__ */ m(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+v(e.align)).className,style:U(V+t,void 0),"data-label":A&&typeof e.label==`string`?e.label:void 0,children:/* @__PURE__ */ m(r,{width:je(e.align),height:12,radius:6})},e.key)),w&&/* @__PURE__ */ m(`td`,{children:/* @__PURE__ */ m(`div`,{className:`u-row-actions`,children:/* @__PURE__ */ m(r,{width:`32px`,height:12,radius:6})})})]},e));return/* @__PURE__ */ h(re,{children:[/* @__PURE__ */ h(B?`wui-data-table`:`div`,{ref:J,...B?{class:yt,resizable:M?``:void 0,"view-key":ot||void 0,"data-wui-row-drag":k?``:void 0}:{className:yt,"data-wui-row-drag":k?``:void 0},style:xt,tabIndex:0,...l,...ut,children:[/* @__PURE__ */ h(`table`,{className:ft,"aria-label":ze,"aria-rowcount":W?q.length+1:void 0,style:qe===`fixed`?{tableLayout:`fixed`}:void 0,children:[/* @__PURE__ */ m(`thead`,{children:/* @__PURE__ */ h(`tr`,{"aria-rowindex":W?1:void 0,children:[L&&/* @__PURE__ */ m(`th`,{className:Q.className,style:Q.style,children:/* @__PURE__ */ m(`span`,{className:`visually-hidden`,children:`Expand`})}),E&&/* @__PURE__ */ m(`th`,{className:$.className,style:$.style,children:/* @__PURE__ */ m(`input`,{ref:kt,type:`checkbox`,className:`wui-check`,checked:Dt,disabled:C,onChange:e=>Mt(e.target.checked),"aria-label":`Select all rows`})}),g.map((e,t)=>{let r=!!(e.sortable&&S),i=x&&x.key===e.key,a=e.align===`num`||e.align===`end`,o=r&&/* @__PURE__ */ m(`span`,{className:`sort-icon${a?` wui-sort-lead`:``}`,children:/* @__PURE__ */ m(n,{name:`chevrons-up-down`,size:14})}),s=M&&t!==Tt,c=e.width||e.minWidth?{width:e.width,minWidth:e.minWidth}:void 0;return/* @__PURE__ */ h(`th`,{className:H(V+t,(r?`sortable `:``)+(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+(e.grow?`wui-col-grow `:``)+(s?`wui-col-resizable `:``)+v(e.align)).className,style:U(V+t,c),"data-key":B?e.key:void 0,"aria-label":s&&typeof e.label==`string`?e.label:void 0,"data-pin":e.pin===`start`||e.pin===`end`?e.pin:void 0,tabIndex:r?0:void 0,"aria-sort":i?x.dir===`asc`?`ascending`:`descending`:r?`none`:void 0,onClick:r?()=>{C||S(e.key)}:void 0,onKeyDown:r?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),C||S(e.key))}:void 0,children:[a&&o,e.label,!a&&o,s&&/* @__PURE__ */ m(`span`,{className:`wui-col-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":oe,"aria-valuemax":ae,tabIndex:0,"aria-label":se.resize(typeof e.label==`string`?e.label:e.key)})]},e.key)}),w&&(Re?/* @__PURE__ */ m(`th`,{className:`wui-cell-end`,children:Re}):/* @__PURE__ */ m(`th`,{className:`wui-cell-end`,children:/* @__PURE__ */ m(`span`,{className:`visually-hidden`,children:`Actions`})}))]})}),/* @__PURE__ */ m(`tbody`,{ref:Vt,children:C?Qt():y?.length?/* @__PURE__ */ h(re,{children:[Zt(`before`,X.before),q.slice(X.start,X.end).map((e,t)=>Xt(e,X.start+t)),Zt(`after`,X.after)]}):null}),gt&&!C&&y?.length>0&&/* @__PURE__ */ m(`tfoot`,{children:/* @__PURE__ */ h(`tr`,{children:[L&&/* @__PURE__ */ m(`td`,{className:Q.className,style:Q.style}),E&&/* @__PURE__ */ m(`td`,{className:$.className,style:$.style}),g.map((e,t)=>/* @__PURE__ */ m(`td`,{className:H(V+t,(t===0?`wui-name-cell `:``)+(e.nowrap?`text-nowrap `:``)+v(e.align)).className,style:U(V+t,void 0),children:e.footer?e.footer(y):null},e.key)),w&&/* @__PURE__ */ m(`td`,{})]})})]}),!C&&!y?.length&&/* @__PURE__ */ m(`div`,{className:`tbl-empty-block`,children:typeof Z==`string`?/* @__PURE__ */ m(`div`,{className:`tbl-empty-plain`,children:Z}):Z})]}),Ne(T)&&/* @__PURE__ */ m(i,{page:T.page,totalPages:T.totalPages,total:T.total,pageSize:T.pageSize,onPageChange:C?ke:T.setPage,onPageSizeChange:C?ke:T.setPageSize,pageSizes:T.pageSizes,mode:T.mode,summary:T.summary}),Gt&&/* @__PURE__ */ m(`div`,{ref:Kt,className:`visually-hidden`,role:`status`,"aria-live":`polite`,"data-wui-table-status":``})]})}export{y as default};