@webority/ui-react 0.165.0 → 0.167.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 (134) hide show
  1. package/dist/canvas-kit/kit.js +217 -215
  2. package/dist/canvas-kit/manifest.json +247 -28
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/dist/components/AppAsyncBlock.js +1 -1
  5. package/dist/components/AppAvatar.js +1 -1
  6. package/dist/components/AppAvatarGroup.js +1 -1
  7. package/dist/components/AppBanner.js +1 -1
  8. package/dist/components/AppBreadcrumbs.js +1 -1
  9. package/dist/components/AppButton.js +1 -1
  10. package/dist/components/AppCalendar.js +1 -1
  11. package/dist/components/AppCard.js +1 -1
  12. package/dist/components/AppCarousel.js +1 -1
  13. package/dist/components/AppCell.js +1 -1
  14. package/dist/components/AppChart.js +1 -1
  15. package/dist/components/AppChartCard.js +1 -1
  16. package/dist/components/AppCheckbox.js +1 -1
  17. package/dist/components/AppChip.js +1 -1
  18. package/dist/components/AppChipGroup.js +1 -1
  19. package/dist/components/AppChoiceCard.js +1 -1
  20. package/dist/components/AppChoiceChip.js +1 -1
  21. package/dist/components/AppColorField.js +1 -1
  22. package/dist/components/AppColumnMenu.js +1 -1
  23. package/dist/components/AppCommandPalette.js +1 -1
  24. package/dist/components/AppCommentThread.js +1 -1
  25. package/dist/components/AppCompareTable.js +1 -1
  26. package/dist/components/AppConfirmDialog.js +1 -1
  27. package/dist/components/AppConfirmProvider.js +1 -1
  28. package/dist/components/AppContextMenu.js +1 -1
  29. package/dist/components/AppCopyButton.js +1 -1
  30. package/dist/components/AppDataTable.js +1 -1
  31. package/dist/components/AppDatePicker.js +1 -1
  32. package/dist/components/AppDateRangePicker.js +1 -1
  33. package/dist/components/AppDescriptions.js +1 -1
  34. package/dist/components/AppDrawer.js +1 -1
  35. package/dist/components/AppDropZone.js +1 -1
  36. package/dist/components/AppDropdown.js +1 -1
  37. package/dist/components/AppDueDate.js +1 -1
  38. package/dist/components/AppEntryGrid.js +1 -1
  39. package/dist/components/AppErrorBoundary.js +1 -1
  40. package/dist/components/AppErrorSummary.js +1 -1
  41. package/dist/components/AppFileAttachment.js +1 -1
  42. package/dist/components/AppFilePicker.js +1 -1
  43. package/dist/components/AppFilterBar.js +1 -1
  44. package/dist/components/AppFloatingDock.js +1 -1
  45. package/dist/components/AppForm.js +1 -1
  46. package/dist/components/AppFormulaSteps.js +1 -1
  47. package/dist/components/AppHoverCard.js +1 -1
  48. package/dist/components/AppImagePicker.js +1 -1
  49. package/dist/components/AppInfoTip.js +1 -1
  50. package/dist/components/AppInlineEdit.js +1 -1
  51. package/dist/components/AppInput.js +1 -1
  52. package/dist/components/AppInputGroup.js +1 -1
  53. package/dist/components/AppKanban.js +1 -1
  54. package/dist/components/AppMentionInput.js +1 -1
  55. package/dist/components/AppModal.js +1 -1
  56. package/dist/components/AppNavigationMenu.js +1 -1
  57. package/dist/components/AppNotificationCenter.js +1 -1
  58. package/dist/components/AppNumberInput.js +1 -1
  59. package/dist/components/AppOnboardingChecklist.js +1 -1
  60. package/dist/components/AppOrgTree.js +1 -1
  61. package/dist/components/AppOtpInput.js +1 -1
  62. package/dist/components/AppPageHeader.js +1 -1
  63. package/dist/components/AppPhoneNumberInput.js +1 -1
  64. package/dist/components/AppPricingCard.js +1 -1
  65. package/dist/components/AppQrCode.js +1 -1
  66. package/dist/components/AppRadio.js +1 -1
  67. package/dist/components/AppRadioGroup.js +1 -1
  68. package/dist/components/AppRating.js +1 -1
  69. package/dist/components/AppRecordPager.js +1 -1
  70. package/dist/components/AppRelativeTime.js +1 -1
  71. package/dist/components/AppRepeater.js +1 -1
  72. package/dist/components/AppRichText.js +1 -1
  73. package/dist/components/AppRouteError.js +1 -1
  74. package/dist/components/AppRowActions.js +1 -1
  75. package/dist/components/AppScoreScale.js +1 -1
  76. package/dist/components/AppSearch.js +1 -1
  77. package/dist/components/AppSectionLeadCapture.js +1 -1
  78. package/dist/components/AppSegmented.js +1 -1
  79. package/dist/components/AppSelect.js +1 -1
  80. package/dist/components/AppShell.js +1 -1
  81. package/dist/components/AppShortcutLegend.js +1 -1
  82. package/dist/components/AppShowMore.js +1 -1
  83. package/dist/components/AppSlider.js +1 -1
  84. package/dist/components/AppSortableList.js +1 -1
  85. package/dist/components/AppSparkline.js +1 -1
  86. package/dist/components/AppSpinner.js +1 -1
  87. package/dist/components/AppSplash.js +1 -1
  88. package/dist/components/AppSplitButton.js +1 -1
  89. package/dist/components/AppSplitView.js +1 -1
  90. package/dist/components/AppStatusBadge.js +1 -1
  91. package/dist/components/AppStepper.js +1 -1
  92. package/dist/components/AppSwitch.js +1 -1
  93. package/dist/components/AppTablePagination.js +1 -1
  94. package/dist/components/AppTableToolbar.js +1 -1
  95. package/dist/components/AppTabs.js +1 -1
  96. package/dist/components/AppTextarea.js +1 -1
  97. package/dist/components/AppThemeToggle.js +1 -1
  98. package/dist/components/AppTimePicker.js +1 -1
  99. package/dist/components/AppTimeline.js +1 -1
  100. package/dist/components/AppToast.js +1 -1
  101. package/dist/components/AppUpdateBar.js +1 -1
  102. package/dist/components/AppWhatsNew.js +1 -1
  103. package/dist/components/AppWizard.js +1 -1
  104. package/dist/components/AppWorkspaceSwitcher.js +1 -1
  105. package/dist/components/toast.js +1 -1
  106. package/dist/guidance.json +10 -5
  107. package/dist/lib/FileItemRow.js +1 -1
  108. package/dist/lib/emptyValue.js +1 -1
  109. package/dist/lib/fieldState.js +1 -1
  110. package/dist/lib/useWuiText.js +1 -0
  111. package/dist/types/components/AppColorField.d.ts +3 -3
  112. package/dist/types/components/AppDatePicker.d.ts +2 -1
  113. package/dist/types/components/AppDateRangePicker.d.ts +1 -1
  114. package/dist/types/components/AppDropdown.d.ts +6 -0
  115. package/dist/types/components/AppEntryGrid.d.ts +43 -1
  116. package/dist/types/components/AppFormulaSteps.d.ts +3 -3
  117. package/dist/types/components/AppInput.d.ts +4 -4
  118. package/dist/types/components/AppInputGroup.d.ts +1 -1
  119. package/dist/types/components/AppMentionInput.d.ts +2 -2
  120. package/dist/types/components/AppNumberInput.d.ts +9 -3
  121. package/dist/types/components/AppPhoneNumberInput.d.ts +1 -1
  122. package/dist/types/components/AppRowActions.d.ts +6 -0
  123. package/dist/types/components/AppSearch.d.ts +1 -1
  124. package/dist/types/components/AppSelect.d.ts +3 -2
  125. package/dist/types/components/AppTextarea.d.ts +2 -2
  126. package/dist/types/components/AppTimePicker.d.ts +1 -1
  127. package/dist/types/index.d.ts +2 -1
  128. package/dist/types/lib/emptyValue.d.ts +2 -2
  129. package/dist/types/lib/fieldState.d.ts +1 -0
  130. package/dist/types/lib/useWuiText.d.ts +3 -0
  131. package/dist/ui-react.js +1 -1
  132. package/package.json +9 -9
  133. package/dist/lib/unsavedText.js +0 -1
  134. package/dist/types/lib/unsavedText.d.ts +0 -5
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";function a(a){let{marker:o,props:s}=e(`AppPricingCard`,a),{name:c,price:l,unit:u,tagline:d,features:f=[],cta:p,featured:m=!1,current:h=!1,badge:g=`Most popular`,className:_=``,...v}=s;n(`AppPricingCard`,v);let y=[`plan-card`,m?`featured`:``,h?`current`:``,_].filter(Boolean).join(` `);return/* @__PURE__ */ i(`div`,{className:y,...o,...v,children:[m&&g&&/* @__PURE__ */ r(`span`,{className:`plan-badge`,children:g}),/* @__PURE__ */ r(`div`,{className:`plan-name`,children:c}),/* @__PURE__ */ i(`div`,{className:`plan-price`,children:[l,u&&/* @__PURE__ */ r(`span`,{className:`plan-price-unit`,children:u})]}),d&&/* @__PURE__ */ r(`div`,{className:`plan-tagline`,children:d}),f.length>0&&/* @__PURE__ */ r(`ul`,{className:`plan-features`,children:f.map((e,n)=>{let a=e.included!==!1;return/* @__PURE__ */ i(`li`,{className:a?void 0:`excluded`,children:[/* @__PURE__ */ r(`span`,{className:`plan-feature-icon`,children:/* @__PURE__ */ r(t,{name:a?`check`:`x`,size:16})}),e.text]},e.text?`feat-${n}-${e.text}`:`feat-${n}`)})}),p&&/* @__PURE__ */ r(`div`,{className:`plan-cta`,children:p})]})}export{a as default};
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./warnUnknownProps.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{PRICING_CARD_TEXT as o}from"@webority/ui-elements/text";function s(s){let{marker:c,props:l}=t(`AppPricingCard`,s),u=e(`pricingCard`,o),{name:d,price:f,unit:p,tagline:m,features:h=[],cta:g,featured:_=!1,current:v=!1,badge:y=u.badge,className:b=``,...x}=l;r(`AppPricingCard`,x);let S=[`plan-card`,_?`featured`:``,v?`current`:``,b].filter(Boolean).join(` `);return/* @__PURE__ */ a(`div`,{className:S,...c,...x,children:[_&&y&&/* @__PURE__ */ i(`span`,{className:`plan-badge`,children:y}),/* @__PURE__ */ i(`div`,{className:`plan-name`,children:d}),/* @__PURE__ */ a(`div`,{className:`plan-price`,children:[f,p&&/* @__PURE__ */ i(`span`,{className:`plan-price-unit`,children:p})]}),m&&/* @__PURE__ */ i(`div`,{className:`plan-tagline`,children:m}),h.length>0&&/* @__PURE__ */ i(`ul`,{className:`plan-features`,children:h.map((e,t)=>{let r=e.included!==!1;return/* @__PURE__ */ a(`li`,{className:r?void 0:`excluded`,children:[/* @__PURE__ */ i(`span`,{className:`plan-feature-icon`,children:/* @__PURE__ */ i(n,{name:r?`check`:`x`,size:16})}),e.text]},e.text?`feat-${t}-${e.text}`:`feat-${t}`)})}),g&&/* @__PURE__ */ i(`div`,{className:`plan-cta`,children:g})]})}export{s as default};
@@ -1 +1 @@
1
- import{encodeQr as e,qrSvgPath as t}from"../lib/qrCode.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./warnUnknownProps.js";import{useMemo as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=4;function c(c){let{marker:l,props:u}=n(`AppQrCode`,c),{value:d,size:f=240,title:p=`QR code`,className:m,style:h,...g}=u;if(r(`AppQrCode`,g),!Number.isFinite(f)||f<=0)throw RangeError(`<AppQrCode> received size=${String(f)}; size is a positive number of pixels.`);let _=i(()=>{if(!d)return null;let n=e(String(d));return{modules:n.size+8,path:t(n,s)}},[d]);if(!_)return null;let{modules:v,path:y}=_,b=Math.max(1,Math.floor(f/v))*v;return/* @__PURE__ */ o(`svg`,{viewBox:`0 0 ${v} ${v}`,width:b,height:b,role:`img`,"aria-label":p,shapeRendering:`crispEdges`,className:m||void 0,style:h,...l,...g,children:[/* @__PURE__ */ a(`rect`,{width:v,height:v,fill:`#ffffff`}),/* @__PURE__ */ a(`path`,{d:y,fill:`#000000`})]})}export{c as default};
1
+ import{encodeQr as e,qrSvgPath as t}from"../lib/qrCode.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./warnUnknownProps.js";import{useMemo as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{QR_CODE_TEXT as c}from"@webority/ui-elements/text";var l=4;function u(u){let{marker:d,props:f}=r(`AppQrCode`,u),p=n(`qrCode`,c),{value:m,size:h=240,title:g=p.title,className:_,style:v,...y}=f;if(i(`AppQrCode`,y),!Number.isFinite(h)||h<=0)throw RangeError(`<AppQrCode> received size=${String(h)}; size is a positive number of pixels.`);let b=a(()=>{if(!m)return null;let n=e(String(m));return{modules:n.size+8,path:t(n,l)}},[m]);if(!b)return null;let{modules:x,path:S}=b,C=Math.max(1,Math.floor(h/x))*x;return/* @__PURE__ */ s(`svg`,{viewBox:`0 0 ${x} ${x}`,width:C,height:C,role:`img`,"aria-label":g,shapeRendering:`crispEdges`,className:_||void 0,style:v,...d,...y,children:[/* @__PURE__ */ o(`rect`,{width:x,height:x,fill:`#ffffff`}),/* @__PURE__ */ o(`path`,{d:S,fill:`#000000`})]})}export{u as default};
@@ -1 +1 @@
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"./assertValidValue.js";import a from"./warnUnknownProps.js";import{forwardRef as o}from"react";import{jsx as s}from"react/jsx-runtime";var c=e=>/* @__PURE__ */ Error(`<AppRadio> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`),l=o(function(o,l){let{marker:u,props:d}=r(`AppRadio`,o),{label:f,id:p,name:m,error:h,helperText:g,help:_,helpLabel:v=`More information`,className:y=``,readOnly:b=!1,loading:x=!1,size:S=`md`,controlOnly:C=!1,...w}=d;if(a(`AppRadio`,w),i(`AppRadio`,`size`,S,t),C){if(f!=null&&f!==``)throw c(`label`);if(h!=null&&h!==``)throw c(`error`);if(g!=null&&g!==``)throw c(`helperText`);if(S!==`md`)throw c(`size`)}return/* @__PURE__ */ s(e,{rootProps:u,ref:l,label:n(f,_,v),id:p,name:m,error:h,hint:g,className:y,rest:w,inputType:`radio`,wrapperClass:`form-check`,readOnly:b,loading:x,size:S,controlOnly:C})});export{l as default};
1
+ import e from"../lib/CheckField.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import n from"../lib/labelWithHelp.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{forwardRef as s}from"react";import{jsx as c}from"react/jsx-runtime";import{RADIO_TEXT as l}from"@webority/ui-elements/text";var u=e=>/* @__PURE__ */ Error(`<AppRadio> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`),d=s(function(s,d){let{marker:f,props:p}=i(`AppRadio`,s),m=r(`radio`,l),{label:h,id:g,name:_,error:v,helperText:y,help:b,helpLabel:x=m.helpLabel,className:S=``,readOnly:C=!1,loading:w=!1,size:T=`md`,controlOnly:E=!1,...D}=p;if(o(`AppRadio`,D),a(`AppRadio`,`size`,T,t),E){if(h!=null&&h!==``)throw u(`label`);if(v!=null&&v!==``)throw u(`error`);if(y!=null&&y!==``)throw u(`helperText`);if(T!==`md`)throw u(`size`)}return/* @__PURE__ */ c(e,{rootProps:f,ref:d,label:n(h,b,x),id:g,name:_,error:v,hint:y,className:S,rest:D,inputType:`radio`,wrapperClass:`form-check`,readOnly:C,loading:w,size:T,controlOnly:E})});export{d as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t,FIELD_SIZES as n,blockWhenReadOnly as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppInfoTip.js";import s from"./AppRequiredMark.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{useId as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`default`,`card`];function m(m){let{marker:h,props:g}=a(`AppRadioGroup`,m),{label:_,options:v=[],name:y,value:b,defaultValue:x,onChange:S,variant:C=`default`,inline:w=!1,required:T=!1,optional:E=!1,optionalLabel:D=`(optional)`,disabled:O=!1,readOnly:k=!1,loading:A=!1,size:j=`md`,error:M,helperText:N,help:P,helpLabel:F=`More information`,id:I,className:L=``,fieldClassName:R=``,style:z,...B}=g,V=i(y),H=M??V;l(`AppRadioGroup`,B),c(`AppRadioGroup`,`variant`,C,p),c(`AppRadioGroup`,`size`,j,n);let U=j===`sm`?` form-check-sm`:j===`lg`?` form-check-lg`:``,W=u(),G=I||W,K=y||G,q=`${G}-error`,J=`${G}-hint`,Y=b!==void 0;return/* @__PURE__ */ f(`div`,{...h,className:`field${R?` ${R}`:``}`,children:[_!=null&&/* @__PURE__ */ f(`span`,{className:`label`,id:`${G}-label`,children:[_,E&&!T&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${D}`}),T&&/* @__PURE__ */ d(s,{}),P&&/* @__PURE__ */ d(o,{label:F,children:P})]}),/* @__PURE__ */ d(`div`,{className:[`wui-radio-group`,C===`card`?`wui-radio-group-card`:``,w?`wui-radio-group-inline`:``,L].filter(Boolean).join(` `),style:z,id:G,role:`radiogroup`,"aria-labelledby":_==null?void 0:`${G}-label`,"aria-required":T?`true`:void 0,"aria-readonly":k||void 0,"aria-busy":A||void 0,"aria-invalid":H?`true`:void 0,"aria-describedby":H?q:N?J:void 0,...B,children:v.map((e,n)=>{let i=`${G}-${n}`,a=e.description==null?void 0:`${i}-desc`;return/* @__PURE__ */ f(`div`,{className:`form-check${U}`,children:[/* @__PURE__ */ d(`input`,{type:`radio`,className:A?`form-check-input ${t}`:`form-check-input`,id:i,name:K,value:e.value,disabled:O||e.disabled||void 0,required:T||void 0,"aria-describedby":a,"aria-readonly":k||void 0,"aria-busy":A||void 0,onClick:r(k||A),...Y?{checked:b===e.value,onChange:()=>S?.(e.value)}:{defaultChecked:x===e.value,onChange:()=>S?.(e.value)}}),/* @__PURE__ */ d(`label`,{className:`form-check-label`,htmlFor:i,children:e.label}),a&&/* @__PURE__ */ d(`div`,{className:`wui-radio-option-desc`,id:a,children:e.description})]},e.value)})}),/* @__PURE__ */ d(e,{error:H,hint:N,errorId:q,hintId:J})]})}export{m as default};
1
+ import e from"../lib/FieldMessage.js";import{BOX_SIZES as t,FIELD_BUSY_CLASS as n,blockWhenReadOnly as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import a from"../lib/useWuiText.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppInfoTip.js";import c from"./AppRequiredMark.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{RADIO_GROUP_TEXT as m}from"@webority/ui-elements/text";var h=[`default`,`card`];function g(g){let{marker:_,props:v}=o(`AppRadioGroup`,g),y=a(`radioGroup`,m),{label:b,options:x=[],name:S,value:C,defaultValue:w,onChange:T,variant:E=`default`,inline:D=!1,required:O=!1,optional:k=!1,optionalLabel:A=y.optionalLabel,disabled:j=!1,readOnly:M=!1,loading:N=!1,size:P=`md`,error:F,helperText:I,help:L,helpLabel:R=y.helpLabel,id:z,className:B=``,fieldClassName:V=``,style:H,...U}=v,W=i(S),G=F??W;u(`AppRadioGroup`,U),l(`AppRadioGroup`,`variant`,E,h),l(`AppRadioGroup`,`size`,P,t);let K=P===`sm`?` form-check-sm`:P===`lg`?` form-check-lg`:``,q=d(),J=z||q,Y=S||J,X=`${J}-error`,Z=`${J}-hint`,Q=C!==void 0;return/* @__PURE__ */ p(`div`,{..._,className:`field${V?` ${V}`:``}`,children:[b!=null&&/* @__PURE__ */ p(`span`,{className:`label`,id:`${J}-label`,children:[b,k&&!O&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${A}`}),O&&/* @__PURE__ */ f(c,{}),L&&/* @__PURE__ */ f(s,{label:R,children:L})]}),/* @__PURE__ */ f(`div`,{className:[`wui-radio-group`,E===`card`?`wui-radio-group-card`:``,D?`wui-radio-group-inline`:``,B].filter(Boolean).join(` `),style:H,id:J,role:`radiogroup`,"aria-labelledby":b==null?void 0:`${J}-label`,"aria-required":O?`true`:void 0,"aria-readonly":M||void 0,"aria-busy":N||void 0,"aria-invalid":G?`true`:void 0,"aria-describedby":G?X:I?Z:void 0,...U,children:x.map((e,t)=>{let i=`${J}-${t}`,a=e.description==null?void 0:`${i}-desc`;return/* @__PURE__ */ p(`div`,{className:`form-check${K}`,children:[/* @__PURE__ */ f(`input`,{type:`radio`,className:N?`form-check-input ${n}`:`form-check-input`,id:i,name:Y,value:e.value,disabled:j||e.disabled||void 0,required:O||void 0,"aria-describedby":a,"aria-readonly":M||void 0,"aria-busy":N||void 0,onClick:r(M||N),...Q?{checked:C===e.value,onChange:()=>T?.(e.value)}:{defaultChecked:w===e.value,onChange:()=>T?.(e.value)}}),/* @__PURE__ */ f(`label`,{className:`form-check-label`,htmlFor:i,children:e.label}),a&&/* @__PURE__ */ f(`div`,{className:`wui-radio-option-desc`,id:a,children:e.description})]},e.value)})}),/* @__PURE__ */ f(e,{error:G,hint:I,errorId:X,hintId:Z})]})}export{g as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{blockWhenReadOnly as t}from"../lib/fieldState.js";import n from"../lib/fillLabel.js";import{useFieldError as r}from"../lib/formFields.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./AppInfoTip.js";import c from"./AppRequiredMark.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{useId as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=()=>import(`@webority/ui-elements/elements/rating`),g={sm:16,md:20,lg:28},_=e=>String(Math.round(e*100)/100),v=(e,t,n)=>e>=t?`full`:n&&e>=t-.5?`half`:`empty`;function y(o){i(`wui-rating`,h);let{marker:y,props:x}=a(`AppRating`,o),{value:S,defaultValue:C,onChange:w,max:T=5,readOnly:E=!1,half:D=!1,showValue:O=!1,size:k=`md`,label:A,help:j,helpLabel:ee=`More information`,ratingLabel:te=`Rating`,starLabel:ne=`{count} star`,starsLabel:re=`{count} stars`,valueText:ie=`{value} out of {max}`,name:M,required:N=!1,disabled:P=!1,loading:F=!1,error:I,helperText:L,id:R,className:z=``,fieldClassName:B=``,...V}=x,H=r(M),U=I??H;u(`AppRating`,V),l(`AppRating`,`size`,k,Object.keys(g));let W=d(),[G,K]=f(C),q=g[k]??g.md,J=Array.from({length:T},(e,t)=>t+1),Y=(...e)=>[`wui-rating`,`wui-rating-${k}`,...e,z].filter(Boolean).join(` `);if(E){let e=S===void 0?G:S,t=Number.isFinite(Number(e))?Math.min(Math.max(Number(e),0),T):0,r=D?Math.round(t*2)/2:Math.round(t),i=`${typeof A==`string`&&A?`${A}: `:``}${n(ie,{value:_(t),max:T})}`;return/* @__PURE__ */ m(`span`,{className:Y(`wui-rating-display`,F&&`wui-field-busy`),id:R,role:`img`,"aria-label":i,"aria-busy":F||void 0,...y,...V,children:[/* @__PURE__ */ p(`span`,{className:`wui-rating-stars`,"aria-hidden":`true`,children:J.map(e=>/* @__PURE__ */ p(`span`,{className:`wui-rating-star wui-rating-star-${v(r,e,D)}`,children:/* @__PURE__ */ p(b,{px:q})},e))}),O&&/* @__PURE__ */ p(`span`,{className:`wui-rating-value`,"aria-hidden":`true`,children:_(t)})]})}let X=R||W,ae=M||X,Z=`${X}-error`,Q=`${X}-hint`,$=Math.round(Number(S===void 0?G:S))||0,oe=e=>{F||(K(e),w?.(e))};return/* @__PURE__ */ m(`div`,{...y,className:`field${B?` ${B}`:``}`,children:[A!=null&&/* @__PURE__ */ m(`span`,{className:`label`,id:`${X}-label`,children:[A,N&&/* @__PURE__ */ p(c,{}),j&&/* @__PURE__ */ p(s,{label:ee,children:j})]}),/* @__PURE__ */ p(`wui-rating`,{class:Y(`wui-rating-input`,F&&`wui-field-busy`),id:X,role:`radiogroup`,"aria-busy":F?`true`:void 0,"aria-labelledby":A==null?void 0:`${X}-label`,"aria-label":A==null?te:void 0,"aria-required":N?`true`:void 0,"aria-invalid":U?`true`:void 0,"aria-describedby":U?Z:L?Q:void 0,disabled:P?``:void 0,...V,children:J.map(e=>/* @__PURE__ */ m(`label`,{className:`wui-rating-star wui-rating-star-${$>=e?`full`:`empty`}`,"data-value":e,children:[/* @__PURE__ */ p(`input`,{type:`radio`,className:`visually-hidden`,name:ae,value:e,"aria-label":n(e===1?ne:re,{count:e}),checked:$===e,onChange:()=>oe(e),onClick:t(E||F),disabled:P||void 0,required:N||void 0}),/* @__PURE__ */ p(b,{px:q})]},e))}),/* @__PURE__ */ p(e,{error:U,hint:L,errorId:Z,hintId:Q})]})}function b({px:e}){return/* @__PURE__ */ m(`span`,{className:`wui-rating-glyphs`,"aria-hidden":`true`,children:[/* @__PURE__ */ p(o,{name:`star`,size:e}),/* @__PURE__ */ p(`span`,{className:`wui-rating-fill`,children:/* @__PURE__ */ p(o,{name:`star`,variant:`bold`,size:e})})]})}export{y as default};
1
+ import e from"../lib/FieldMessage.js";import{blockWhenReadOnly as t}from"../lib/fieldState.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useElementEntry.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./AppInfoTip.js";import ee from"./AppRequiredMark.js";import te from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{useId as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{RATING_TEXT as p,fillText as m}from"@webority/ui-elements/text";var ne=()=>import(`@webority/ui-elements/elements/rating`),h={sm:16,md:20,lg:28},g=e=>String(Math.round(e*100)/100),_=(e,t,n)=>e>=t?`full`:n&&e>=t-.5?`half`:`empty`;function v(o){r(`wui-rating`,ne);let{marker:v,props:b}=a(`AppRating`,o),x=i(`rating`,p),{value:S,defaultValue:C,onChange:w,max:T=5,readOnly:E=!1,half:D=!1,showValue:re=!1,size:O=`md`,label:k,help:A,helpLabel:ie=x.helpLabel,ratingLabel:ae=x.ratingLabel,starLabel:oe=x.starLabel,starsLabel:j=x.starsLabel,valueText:M=x.valueText,name:N,required:P=!1,disabled:F=!1,loading:I=!1,error:L,helperText:R,id:z,className:B=``,fieldClassName:V=``,...H}=b,U=n(N),W=L??U;c(`AppRating`,H),te(`AppRating`,`size`,O,Object.keys(h));let G=l(),[K,se]=u(C),q=h[O]??h.md,J=Array.from({length:T},(e,t)=>t+1),Y=(...e)=>[`wui-rating`,`wui-rating-${O}`,...e,B].filter(Boolean).join(` `);if(E){let e=S===void 0?K:S,t=Number.isFinite(Number(e))?Math.min(Math.max(Number(e),0),T):0,n=D?Math.round(t*2)/2:Math.round(t),r=`${typeof k==`string`&&k?`${k}: `:``}${m(M,{value:g(t),max:T})}`;return/* @__PURE__ */ f(`span`,{className:Y(`wui-rating-display`,I&&`wui-field-busy`),id:z,role:`img`,"aria-label":r,"aria-busy":I||void 0,...v,...H,children:[/* @__PURE__ */ d(`span`,{className:`wui-rating-stars`,"aria-hidden":`true`,children:J.map(e=>/* @__PURE__ */ d(`span`,{className:`wui-rating-star wui-rating-star-${_(n,e,D)}`,children:/* @__PURE__ */ d(y,{px:q})},e))}),re&&/* @__PURE__ */ d(`span`,{className:`wui-rating-value`,"aria-hidden":`true`,children:g(t)})]})}let X=z||G,ce=N||X,Z=`${X}-error`,Q=`${X}-hint`,$=Math.round(Number(S===void 0?K:S))||0,le=e=>{I||(se(e),w?.(e))};return/* @__PURE__ */ f(`div`,{...v,className:`field${V?` ${V}`:``}`,children:[k!=null&&/* @__PURE__ */ f(`span`,{className:`label`,id:`${X}-label`,children:[k,P&&/* @__PURE__ */ d(ee,{}),A&&/* @__PURE__ */ d(s,{label:ie,children:A})]}),/* @__PURE__ */ d(`wui-rating`,{class:Y(`wui-rating-input`,I&&`wui-field-busy`),id:X,role:`radiogroup`,"aria-busy":I?`true`:void 0,"aria-labelledby":k==null?void 0:`${X}-label`,"aria-label":k==null?ae:void 0,"aria-required":P?`true`:void 0,"aria-invalid":W?`true`:void 0,"aria-describedby":W?Z:R?Q:void 0,disabled:F?``:void 0,...H,children:J.map(e=>/* @__PURE__ */ f(`label`,{className:`wui-rating-star wui-rating-star-${$>=e?`full`:`empty`}`,"data-value":e,children:[/* @__PURE__ */ d(`input`,{type:`radio`,className:`visually-hidden`,name:ce,value:e,"aria-label":m(e===1?oe:j,{count:e}),checked:$===e,onChange:()=>le(e),onClick:t(E||I),disabled:F||void 0,required:P||void 0}),/* @__PURE__ */ d(y,{px:q})]},e))}),/* @__PURE__ */ d(e,{error:W,hint:R,errorId:Z,hintId:Q})]})}function y({px:e}){return/* @__PURE__ */ f(`span`,{className:`wui-rating-glyphs`,"aria-hidden":`true`,children:[/* @__PURE__ */ d(o,{name:`star`,size:e}),/* @__PURE__ */ d(`span`,{className:`wui-rating-fill`,children:/* @__PURE__ */ d(o,{name:`star`,variant:`bold`,size:e})})]})}export{v as default};
@@ -1 +1 @@
1
- import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppActionIcon.js";import r from"./warnUnknownProps.js";import{formatNumber as i}from"@webority/ui-elements/helpers";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=e=>i(e,{decimals:0}),c=()=>import(`@webority/ui-elements/elements/record-pager`);function l(i){e(`wui-record-pager`,c);let{marker:l,props:u}=t(`AppRecordPager`,i),{index:d,total:f,prevHref:p,onPrev:m,nextHref:h,onNext:g,prevLabel:_=`Previous`,nextLabel:v=`Next`,keys:y=!1,className:b=``,...x}=u;r(`AppRecordPager`,x);let S=Number(d),C=Number(f),w=Number.isInteger(S)&&Number.isInteger(C)&&S>=1&&S<=C,T=w&&S>1&&!!(p||m),E=w&&S<C&&!!(h||g);return/* @__PURE__ */ o(`wui-record-pager`,{class:[`wui-record-pager`,b].filter(Boolean).join(` `),keys:y?``:void 0,...l,...x,children:[/* @__PURE__ */ a(`span`,{className:`wui-record-pager-position`,"aria-live":`polite`,children:w?`${s(S)} of ${s(C)}`:``}),/* @__PURE__ */ a(n,{icon:`chevron-left`,label:_,size:18,className:`wui-record-pager-prev`,href:p||void 0,onClick:m,disabled:!T,shortcut:y?`K`:void 0}),/* @__PURE__ */ a(n,{icon:`chevron-right`,label:v,size:18,className:`wui-record-pager-next`,href:h||void 0,onClick:g,disabled:!E,shortcut:y?`J`:void 0})]})}export{l as default};
1
+ import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppActionIcon.js";import i from"./warnUnknownProps.js";import{formatNumber as a}from"@webority/ui-elements/helpers";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{RECORD_PAGER_TEXT as c,fillText as l}from"@webority/ui-elements/text";var u=e=>a(e,{decimals:0}),d=()=>import(`@webority/ui-elements/elements/record-pager`);function f(a){e(`wui-record-pager`,d);let{marker:f,props:p}=n(`AppRecordPager`,a),m=t(`recordPager`,c),{index:h,total:g,prevHref:_,onPrev:v,nextHref:y,onNext:b,prevLabel:x=m.prevLabel,nextLabel:S=m.nextLabel,keys:C=!1,className:w=``,...T}=p;i(`AppRecordPager`,T);let E=Number(h),D=Number(g),O=Number.isInteger(E)&&Number.isInteger(D)&&E>=1&&E<=D,k=O&&E>1&&!!(_||v),A=O&&E<D&&!!(y||b);return/* @__PURE__ */ s(`wui-record-pager`,{class:[`wui-record-pager`,w].filter(Boolean).join(` `),keys:C?``:void 0,...f,...T,children:[/* @__PURE__ */ o(`span`,{className:`wui-record-pager-position`,"aria-live":`polite`,children:O?l(m.positionText,{position:u(E),total:u(D)}):``}),/* @__PURE__ */ o(r,{icon:`chevron-left`,label:x,size:18,className:`wui-record-pager-prev`,href:_||void 0,onClick:v,disabled:!k,shortcut:C?`K`:void 0}),/* @__PURE__ */ o(r,{icon:`chevron-right`,label:S,size:18,className:`wui-record-pager-next`,href:y||void 0,onClick:b,disabled:!A,shortcut:C?`J`:void 0})]})}export{f as default};
@@ -1 +1 @@
1
- import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import r from"./withTooltip.js";import{EMPTY_VALUE as i,formatDate as a,relativeTimeTitle as o,toInstant as s}from"@webority/ui-elements/helpers";import{jsx as c}from"react/jsx-runtime";var l=()=>import(`@webority/ui-elements/elements/relative-time`);function u(u){e(`wui-relative-time`,l);let{marker:d,props:f}=t(`AppRelativeTime`,u),{value:p,tooltipPlacement:m=`auto`,className:h=``,...g}=f;n(`AppRelativeTime`,g);let _=s(p),v=Number.isFinite(_),y=v?typeof p==`string`?p.trim():new Date(_).toISOString():void 0;return r(/* @__PURE__ */ c(`wui-relative-time`,{class:[`wui-relative-time`,h].filter(Boolean).join(` `),...d,...g,children:/* @__PURE__ */ c(`time`,{dateTime:y,children:v?a(_):i})}),v?o(_):void 0,m)}export{u as default};
1
+ import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import r from"./withTooltip.js";import{emptyValueLabel as i,formatDate as a,relativeTimeTitle as o,toInstant as s}from"@webority/ui-elements/helpers";import{jsx as c}from"react/jsx-runtime";var l=()=>import(`@webority/ui-elements/elements/relative-time`);function u(u){e(`wui-relative-time`,l);let{marker:d,props:f}=t(`AppRelativeTime`,u),{value:p,tooltipPlacement:m=`auto`,className:h=``,...g}=f;n(`AppRelativeTime`,g);let _=s(p),v=Number.isFinite(_),y=v?typeof p==`string`?p.trim():new Date(_).toISOString():void 0;return r(/* @__PURE__ */ c(`wui-relative-time`,{class:[`wui-relative-time`,h].filter(Boolean).join(` `),...d,...g,children:/* @__PURE__ */ c(`time`,{dateTime:y,children:v?a(_):i()})}),v?o(_):void 0,m)}export{u as default};
@@ -1 +1 @@
1
- import{FILL_VARIANTS as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppActionIcon.js";import r from"./AppButton.js";import i from"./AppLink.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l(e,t){return`id`in e&&(typeof e.id==`string`||typeof e.id==`number`)?e.id:t}function u(u){let{marker:d,props:f}=t(`AppRepeater`,u),{rows:p=[],renderRow:m,rowLabel:h,onAdd:g,onRemove:_,addLabel:v=`Add another`,addVariant:y=`soft`,removeLabel:b=`Remove row`,emptyText:x,min:S=0,max:C,numbered:w=!0,className:T=``,...E}=f;o(`AppRepeater`,E),a(`AppRepeater`,`addVariant`,y,e);let D=typeof C==`number`&&p.length>=C,O=!!_&&p.length>S;return/* @__PURE__ */ c(`div`,{className:`repeater${T?` ${T}`:``}`,...d,...E,children:[p.length===0&&x&&/* @__PURE__ */ s(`div`,{className:`repeater-empty`,children:x}),p.map((e,t)=>{let r=h?h(e,t):null;return/* @__PURE__ */ c(`div`,{className:`repeater-row`,children:[(!!r||O)&&/* @__PURE__ */ s(`span`,{className:`repeater-row-label`,children:r}),w&&/* @__PURE__ */ s(`span`,{className:`repeater-index`,children:t+1}),/* @__PURE__ */ s(`div`,{className:`repeater-body`,children:m(e,t)}),O&&/* @__PURE__ */ s(n,{icon:`trash-2`,label:`${b} ${t+1}`,tone:`danger`,className:`repeater-remove`,onClick:()=>_?.(t)})]},l(e,t))}),y===`link`?/* @__PURE__ */ s(i,{animation:`static`,size:`sm`,linkComponent:`button`,type:`button`,leftIcon:`plus`,className:`repeater-add`,disabled:D,onClick:g,children:v}):/* @__PURE__ */ s(r,{variant:y,size:`sm`,leftIcon:`plus`,className:`repeater-add`,disabled:D,onClick:g,children:v})]})}export{u as default};
1
+ import e from"../lib/useWuiText.js";import{FILL_VARIANTS as t}from"../lib/vocabulary.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppActionIcon.js";import i from"./AppButton.js";import a from"./AppLink.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{REPEATER_TEXT as u}from"@webority/ui-elements/text";function d(e,t){return`id`in e&&(typeof e.id==`string`||typeof e.id==`number`)?e.id:t}function f(f){let{marker:p,props:m}=n(`AppRepeater`,f),h=e(`repeater`,u),{rows:g=[],renderRow:_,rowLabel:v,onAdd:y,onRemove:b,addLabel:x=h.addLabel,addVariant:S=`soft`,removeLabel:C=h.removeLabel,emptyText:w,min:T=0,max:E,numbered:D=!0,className:O=``,...k}=m;s(`AppRepeater`,k),o(`AppRepeater`,`addVariant`,S,t);let A=typeof E==`number`&&g.length>=E,j=!!b&&g.length>T;return/* @__PURE__ */ l(`div`,{className:`repeater${O?` ${O}`:``}`,...p,...k,children:[g.length===0&&w&&/* @__PURE__ */ c(`div`,{className:`repeater-empty`,children:w}),g.map((e,t)=>{let n=v?v(e,t):null;return/* @__PURE__ */ l(`div`,{className:`repeater-row`,children:[(!!n||j)&&/* @__PURE__ */ c(`span`,{className:`repeater-row-label`,children:n}),D&&/* @__PURE__ */ c(`span`,{className:`repeater-index`,children:t+1}),/* @__PURE__ */ c(`div`,{className:`repeater-body`,children:_(e,t)}),j&&/* @__PURE__ */ c(r,{icon:`trash-2`,label:`${C} ${t+1}`,tone:`danger`,className:`repeater-remove`,onClick:()=>b?.(t)})]},d(e,t))}),S===`link`?/* @__PURE__ */ c(a,{animation:`static`,size:`sm`,linkComponent:`button`,type:`button`,leftIcon:`plus`,className:`repeater-add`,disabled:A,onClick:y,children:x}):/* @__PURE__ */ c(i,{variant:S,size:`sm`,leftIcon:`plus`,className:`repeater-add`,disabled:A,onClick:y,children:x})]})}export{f as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./assertValidValue.js";import s from"./useWuiControl.js";import c from"./warnUnknownProps.js";import{isElementDefined as l,whenElementDefined as u}from"@webority/ui-elements/helpers";import{forwardRef as d,useEffect as f,useId as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`html`,`markdown`],v=[`input`,`change`],y=`The editor couldn't load. Reload the page and try again.`,b=d(function(d,b){let{marker:x,props:S}=r(`AppRichText`,d),{value:C,onChange:w,format:T,placeholder:E,name:D,label:O,error:k,helperText:A,required:j=!1,disabled:M=!1,readOnly:N=!1,loading:P=!1,defaultValue:F,id:I,ariaLabel:L,className:R=``,fieldClassName:z=``,help:B,helpLabel:V=`More information`,...H}=S,U=n(D),W=k??U;c(`AppRichText`,H),o(`AppRichText`,`format`,T,_);let G=p(),K=I||G,[q,J]=m(!1),[Y,X]=m(()=>l(`wui-rich-text`)),{setRef:Z}=s({ready:Y,ref:b,value:C,defaultValue:F,onChange:w,events:v});return f(()=>{if(Y)return;let t=!0;return import(`@webority/ui-elements/rich-text`).then(()=>u(`wui-rich-text`)).then(()=>{t&&X(!0)},n=>{let r=typeof n==`object`&&n&&`message`in n?n.message:void 0;e(`[AppRichText] the editor failed to load:`,r),t&&J(!0)}),()=>{t=!1}},[Y]),/* @__PURE__ */ g(`div`,{...x,className:`field${z?` ${z}`:``}`,children:[O&&/* @__PURE__ */ g(`label`,{className:`label`,htmlFor:K,children:[O,j&&/* @__PURE__ */ h(a,{}),B&&/* @__PURE__ */ h(i,{label:V,children:B})]}),q?/* @__PURE__ */ h(`div`,{className:`field-error`,role:`status`,children:y}):/* @__PURE__ */ h(`wui-rich-text`,{ref:Z,id:K,role:`group`,name:D,format:T||void 0,placeholder:E,"aria-label":L||(typeof O==`string`?O:void 0),"aria-describedby":W?`${K}-error`:A?`${K}-hint`:void 0,"aria-invalid":W?`true`:void 0,required:j?``:void 0,disabled:M?``:void 0,readonly:N?``:void 0,loading:P?``:void 0,className:R||void 0,...H},T||`html`),/* @__PURE__ */ h(t,{error:W,hint:A,errorId:`${K}-error`,hintId:`${K}-hint`})]})});export{b as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{isElementDefined as u,whenElementDefined as d}from"@webority/ui-elements/helpers";import{forwardRef as f,useEffect as p,useId as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{RICH_TEXT_TEXT as v}from"@webority/ui-elements/text";var y=[`html`,`markdown`],b=[`input`,`change`],x=f(function(f,x){let{marker:S,props:C}=i(`AppRichText`,f),w=r(`richText`,v),{value:T,onChange:E,format:D,placeholder:O,name:k,label:A,error:j,helperText:M,required:N=!1,disabled:P=!1,readOnly:F=!1,loading:I=!1,defaultValue:L,id:R,ariaLabel:z,className:B=``,fieldClassName:V=``,help:H,helpLabel:U=w.helpLabel,...W}=C,G=n(k),K=j??G;l(`AppRichText`,W),s(`AppRichText`,`format`,D,y);let q=m(),J=R||q,[Y,X]=h(!1),[Z,Q]=h(()=>u(`wui-rich-text`)),{setRef:$}=c({ready:Z,ref:x,value:T,defaultValue:L,onChange:E,events:b});return p(()=>{if(Z)return;let t=!0;return import(`@webority/ui-elements/rich-text`).then(()=>d(`wui-rich-text`)).then(()=>{t&&Q(!0)},n=>{let r=typeof n==`object`&&n&&`message`in n?n.message:void 0;e(`[AppRichText] the editor failed to load:`,r),t&&X(!0)}),()=>{t=!1}},[Z]),/* @__PURE__ */ _(`div`,{...S,className:`field${V?` ${V}`:``}`,children:[A&&/* @__PURE__ */ _(`label`,{className:`label`,htmlFor:J,children:[A,N&&/* @__PURE__ */ g(o,{}),H&&/* @__PURE__ */ g(a,{label:U,children:H})]}),Y?/* @__PURE__ */ g(`div`,{className:`field-error`,role:`status`,children:w.loadFailedText}):/* @__PURE__ */ g(`wui-rich-text`,{ref:$,id:J,role:`group`,name:k,format:D||void 0,placeholder:O,"aria-label":z||(typeof A==`string`?A:void 0),"aria-describedby":K?`${J}-error`:M?`${J}-hint`:void 0,"aria-invalid":K?`true`:void 0,required:N?``:void 0,disabled:P?``:void 0,readonly:F?``:void 0,loading:I?``:void 0,className:B||void 0,...W},D||`html`),/* @__PURE__ */ g(t,{error:K,hint:M,errorId:`${J}-error`,hintId:`${J}-hint`})]})});export{x as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppButton.js";import n from"./AppResult.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`error`,`stale-build`,`not-found`],l=()=>window.location.reload();function u(u){let{marker:d,props:f}=e(`AppRouteError`,u),{kind:p=`error`,homeHref:m=`/`,onRetry:h=l,brand:g,fullPage:_=!0,homeLabel:v=`Go to the home page`,reloadLabel:y=`Reload`,retryLabel:b=`Try again`,staleTitle:x=`A new version is ready`,staleText:S=`This app was updated while you had it open. Reload to get the new version.`,notFoundTitle:C=`We could not find that page`,notFoundText:w=`Check the address, or go to the home page.`,errorTitle:T=`This page did not load`,errorText:E=`Something went wrong on our side. Try again in a moment.`,children:D,className:O=``,...k}=f;i(`AppRouteError`,k),r(`AppRouteError`,`kind`,p,c);let A=e=>/* @__PURE__ */ o(t,{variant:e,leftIcon:`home`,href:m,children:v}),j;return j=p===`stale-build`?/* @__PURE__ */ o(n,{status:`info`,icon:`refresh-cw`,title:x,subtitle:S,actions:/* @__PURE__ */ o(t,{leftIcon:`refresh-cw`,onClick:h,children:y}),children:D}):p===`not-found`?/* @__PURE__ */ o(n,{status:`404`,title:C,subtitle:w,actions:A(`solid`),children:D}):/* @__PURE__ */ o(n,{status:`500`,title:T,subtitle:E,actions:/* @__PURE__ */ s(a,{children:[/* @__PURE__ */ o(t,{leftIcon:`refresh-cw`,onClick:h,children:b}),A(`outline`)]}),children:D}),/* @__PURE__ */ s(`div`,{className:[_?`d-flex flex-column align-items-center justify-content-center min-vh-100 px-3`:`d-flex flex-column align-items-center py-5 px-3`,O].filter(Boolean).join(` `),...d,...k,children:[g&&/* @__PURE__ */ o(`div`,{className:`mb-4`,children:g}),/* @__PURE__ */ o(`div`,{className:`col-12 col-md-8 col-lg-6`,children:j})]})}export{u as default};
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppResult.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import{ROUTE_ERROR_TEXT as l}from"@webority/ui-elements/text";var u=[`error`,`stale-build`,`not-found`],d=()=>window.location.reload();function f(f){let{marker:p,props:m}=t(`AppRouteError`,f),h=e(`routeError`,l),{kind:g=`error`,homeHref:_=`/`,onRetry:v=d,brand:y,fullPage:b=!0,homeLabel:x=h.homeLabel,reloadLabel:S=h.reloadLabel,retryLabel:C=h.retryLabel,staleTitle:w=h.staleTitle,staleText:T=h.staleText,notFoundTitle:E=h.notFoundTitle,notFoundText:D=h.notFoundText,errorTitle:O=h.errorTitle,errorText:k=h.errorText,children:A,className:j=``,...M}=m;a(`AppRouteError`,M),i(`AppRouteError`,`kind`,g,u);let N=e=>/* @__PURE__ */ s(n,{variant:e,leftIcon:`home`,href:_,children:x}),P;return P=g===`stale-build`?/* @__PURE__ */ s(r,{status:`info`,icon:`refresh-cw`,title:w,subtitle:T,actions:/* @__PURE__ */ s(n,{leftIcon:`refresh-cw`,onClick:v,children:S}),children:A}):g===`not-found`?/* @__PURE__ */ s(r,{status:`404`,title:E,subtitle:D,actions:N(`solid`),children:A}):/* @__PURE__ */ s(r,{status:`500`,title:O,subtitle:k,actions:/* @__PURE__ */ c(o,{children:[/* @__PURE__ */ s(n,{leftIcon:`refresh-cw`,onClick:v,children:C}),N(`outline`)]}),children:A}),/* @__PURE__ */ c(`div`,{className:[b?`d-flex flex-column align-items-center justify-content-center min-vh-100 px-3`:`d-flex flex-column align-items-center py-5 px-3`,j].filter(Boolean).join(` `),...p,...M,children:[y&&/* @__PURE__ */ s(`div`,{className:`mb-4`,children:y}),/* @__PURE__ */ s(`div`,{className:`col-12 col-md-8 col-lg-6`,children:P})]})}export{f as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppActionIcon.js";import r from"./AppButton.js";import i from"./AppDropdown.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],u=[`danger`],d=e=>!!e,f=e=>!e.menuOnly&&(!!e.icon||e.showLabel===!0);function p(e){if(e.label.trim()===``)throw RangeError(`<AppRowActions> an action needs a label.`);if(e.to&&e.href)throw RangeError(`<AppRowActions> action "${e.key}" takes to or href, not both.`);if(!e.disabled&&!e.onClick&&!e.href&&!e.to)throw RangeError(`<AppRowActions> action "${e.key}" needs onClick, href or to unless it is disabled.`);if(e.disabledReason&&!e.disabled)throw RangeError(`<AppRowActions> action "${e.key}" has disabledReason without disabled.`);if(e.menuOnly&&e.showLabel)throw RangeError(`<AppRowActions> action "${e.key}" takes menuOnly or showLabel, not both.`);a(`AppRowActions`,`items[].tone`,e.tone,u),a(`AppRowActions`,`items[].iconVariant`,e.iconVariant,l)}function m(t,n){if(!n.to)return{href:n.href};let r=e(t,{to:n.to});return r.Tag===`a`?{href:r.linkProps.href}:{as:r.Tag,to:r.linkProps.to}}function h(e,t){let i=m(t,e);if(e.showLabel||!e.icon)return/* @__PURE__ */ s(r,{size:`sm`,variant:`outline`,tone:e.tone,leftIcon:e.icon,iconVariant:e.iconVariant,tooltip:e.disabled?e.disabledReason:void 0,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...i,children:e.label},e.key);let a=e.disabled&&e.disabledReason?`${e.label}: ${e.disabledReason}`:e.label;return/* @__PURE__ */ s(n,{icon:e.icon,iconVariant:e.iconVariant,label:a,tone:e.tone,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...i},e.key)}function g(e){let{marker:n,props:r}=t(`AppRowActions`,e),{items:a,menuLabel:l=`More actions`,linkComponent:u,className:m=``,...g}=r;o(`AppRowActions`,g);let _=a.filter(d);for(let e of _)p(e);let v=_.length>0&&_.every(f),y=_.map(e=>({key:e.key,label:e.label,icon:e.icon,to:e.to,href:e.href,onClick:e.onClick,tone:e.tone,disabled:e.disabled,disabledReason:e.disabledReason,hiddenFrom:f(e)?`sm`:void 0}));return/* @__PURE__ */ c(`div`,{className:[`u-row-actions`,m].filter(Boolean).join(` `),...n,...g,children:[_.filter(f).map(e=>h(e,u)),_.length>0?/* @__PURE__ */ s(i,{className:[`wui-row-actions-menu`,v?`wui-hidden-from-sm`:``].filter(Boolean).join(` `),icon:`more-horizontal`,label:l,align:`end`,toggleClassName:`u-action`,linkComponent:u,items:y}):null]})}export{g as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppActionIcon.js";import i from"./AppButton.js";import a from"./AppDropdown.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{ROW_ACTIONS_TEXT as u}from"@webority/ui-elements/text";var d=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],f=[`danger`],p=[`_blank`,`_self`],m=/^data-[a-z0-9]+(?:-[a-z0-9]+)*$/,h=e=>!!e,g=e=>!e.menuOnly&&(!!e.icon||e.showLabel===!0);function _(e){if(e.label.trim()===``)throw RangeError(`<AppRowActions> an action needs a label.`);if(e.to&&e.href)throw RangeError(`<AppRowActions> action "${e.key}" takes to or href, not both.`);if(!e.disabled&&!e.onClick&&!e.href&&!e.to)throw RangeError(`<AppRowActions> action "${e.key}" needs onClick, href or to unless it is disabled.`);if(e.disabledReason&&!e.disabled)throw RangeError(`<AppRowActions> action "${e.key}" has disabledReason without disabled.`);if(e.menuOnly&&e.showLabel)throw RangeError(`<AppRowActions> action "${e.key}" takes menuOnly or showLabel, not both.`);if((e.target||e.rel)&&!e.href&&!e.to)throw RangeError(`<AppRowActions> action "${e.key}" takes target and rel only with href or to.`);for(let t of Object.keys(e.data??{}))if(!m.test(t))throw RangeError(`<AppRowActions> action "${e.key}" has a data key "${t}" that is not data-<name> in lowercase.`);o(`AppRowActions`,`items[].tone`,e.tone,f),o(`AppRowActions`,`items[].target`,e.target,p),o(`AppRowActions`,`items[].iconVariant`,e.iconVariant,d)}function v(t,n){if(!n.to)return{href:n.href};let r=e(t,{to:n.to});return r.Tag===`a`?{href:r.linkProps.href}:{as:r.Tag,to:r.linkProps.to}}function y(e,t){let n=v(t,e),a={target:e.target,rel:e.rel,...e.data};if(e.showLabel||!e.icon)return/* @__PURE__ */ c(i,{size:`sm`,variant:`outline`,tone:e.tone,leftIcon:e.icon,iconVariant:e.iconVariant,tooltip:e.disabled?e.disabledReason:void 0,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...n,...a,children:e.label},e.key);let o=e.disabled&&e.disabledReason?`${e.label}: ${e.disabledReason}`:e.label;return/* @__PURE__ */ c(r,{icon:e.icon,iconVariant:e.iconVariant,label:o,tone:e.tone,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...n,...a},e.key)}function b(e){let{marker:r,props:i}=n(`AppRowActions`,e),o=t(`rowActions`,u),{items:d,menuLabel:f=o.menuLabel,linkComponent:p,className:m=``,...v}=i;s(`AppRowActions`,v);let b=d.filter(h);for(let e of b)_(e);let x=b.length>0&&b.every(g),S=b.map(e=>({key:e.key,label:e.label,icon:e.icon,to:e.to,href:e.href,target:e.target,rel:e.rel,data:e.data,onClick:e.onClick,tone:e.tone,disabled:e.disabled,disabledReason:e.disabledReason,hiddenFrom:g(e)?`sm`:void 0}));return/* @__PURE__ */ l(`div`,{className:[`u-row-actions`,m].filter(Boolean).join(` `),...r,...v,children:[b.filter(g).map(e=>y(e,p)),b.length>0?/* @__PURE__ */ c(a,{className:[`wui-row-actions-menu`,x?`wui-hidden-from-sm`:``].filter(Boolean).join(` `),icon:`more-horizontal`,label:f,align:`end`,toggleClassName:`u-action`,linkComponent:p,items:S}):null]})}export{b as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import{wuiMarkerAttributes as n}from"../lib/wuiMarker.js";import{useId as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function o(o){let{value:s=null,onChange:c,min:l=0,max:u=10,label:d,lowLabel:f,highLabel:p,name:m,disabled:h=!1,error:g,helperText:_,id:v,className:y=``,fieldClassName:b=``,scoreLabel:x=`Score`}=o,S=t(m),C=g??S,w=r(),T=v||w,E=m||T,D=`${T}-error`,O=`${T}-hint`,k=Array.from({length:Math.max(0,u-l+1)},(e,t)=>l+t),A=f!=null||p!=null;return/* @__PURE__ */ a(`div`,{...n(`AppScoreScale`,o),className:`field${b?` ${b}`:``}`,children:[d!=null&&/* @__PURE__ */ i(`span`,{className:`label`,id:`${T}-label`,children:d}),/* @__PURE__ */ a(`div`,{className:`wui-score-scale${y?` ${y}`:``}`,id:T,role:`radiogroup`,"aria-labelledby":d==null?void 0:`${T}-label`,"aria-label":d==null?x:void 0,"aria-invalid":C?`true`:void 0,"aria-describedby":C?D:_?O:void 0,children:[k.map(e=>/* @__PURE__ */ a(`label`,{className:`wui-score-scale__item${s===e?` wui-score-scale__item--selected`:``}`,children:[/* @__PURE__ */ i(`input`,{type:`radio`,className:`visually-hidden`,name:E,value:e,checked:s===e,disabled:h,onChange:()=>c?.(e)}),e]},e)),A&&/* @__PURE__ */ a(`span`,{className:`wui-score-scale__ends`,children:[/* @__PURE__ */ i(`span`,{children:f}),/* @__PURE__ */ i(`span`,{children:p})]})]}),/* @__PURE__ */ i(e,{error:C,hint:_,errorId:D,hintId:O})]})}export{o as default};
1
+ import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useWuiText.js";import{wuiMarkerAttributes as r}from"../lib/wuiMarker.js";import{useId as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{SCORE_SCALE_TEXT as s}from"@webority/ui-elements/text";function c(c){let l=n(`scoreScale`,s),{value:u=null,onChange:d,min:f=0,max:p=10,label:m,lowLabel:h,highLabel:g,name:_,disabled:v=!1,error:y,helperText:b,id:x,className:S=``,fieldClassName:C=``,scoreLabel:w=l.scoreLabel}=c,T=t(_),E=y??T,D=i(),O=x||D,k=_||O,A=`${O}-error`,j=`${O}-hint`,M=Array.from({length:Math.max(0,p-f+1)},(e,t)=>f+t),N=h!=null||g!=null;return/* @__PURE__ */ o(`div`,{...r(`AppScoreScale`,c),className:`field${C?` ${C}`:``}`,children:[m!=null&&/* @__PURE__ */ a(`span`,{className:`label`,id:`${O}-label`,children:m}),/* @__PURE__ */ o(`div`,{className:`wui-score-scale${S?` ${S}`:``}`,id:O,role:`radiogroup`,"aria-labelledby":m==null?void 0:`${O}-label`,"aria-label":m==null?w:void 0,"aria-invalid":E?`true`:void 0,"aria-describedby":E?A:b?j:void 0,children:[M.map(e=>/* @__PURE__ */ o(`label`,{className:`wui-score-scale__item${u===e?` wui-score-scale__item--selected`:``}`,children:[/* @__PURE__ */ a(`input`,{type:`radio`,className:`visually-hidden`,name:k,value:e,checked:u===e,disabled:v,onChange:()=>d?.(e)}),e]},e)),N&&/* @__PURE__ */ o(`span`,{className:`wui-score-scale__ends`,children:[/* @__PURE__ */ a(`span`,{children:h}),/* @__PURE__ */ a(`span`,{children:g})]})]}),/* @__PURE__ */ a(e,{error:E,hint:b,errorId:A,hintId:j})]})}export{c as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{isTypingTarget as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{flushSync as l}from"react-dom";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{Form as f}from"react-bootstrap";var p=[`sm`,`md`,`lg`];function m(m){let{marker:h,props:g}=e(`AppSearch`,m),{value:_,defaultValue:v,onChange:y,placeholder:b=`Search…`,ariaLabel:x,clearLabel:S=`Clear search`,searchLabel:C=`Search`,iconSize:w,size:T,loading:E=!1,collapsible:D=!1,disabled:O=!1,className:k=``,form:A,onKeyDown:j,...M}=g;r(`AppSearch`,M);let{readOnly:N,...P}=M;n(`AppSearch`,`size`,T,p);let F=w??18,[I,L]=c(v??``),R=_===void 0?I:_,[z,B]=c(!!R),V=s(null),H=s(null),U=!D||z||!!R,W=a(()=>{B(!0),requestAnimationFrame(()=>V.current?.focus())},[]),G=()=>{L(``),l(()=>y?.(``)),V.current?.form?.requestSubmit()};o(()=>{if(!D)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||i(e.target instanceof Node?e.target:null)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===H.current&&(e.preventDefault(),W())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[D,W]);let K=[`search-wrap`,R?`has-value`:``,T===`sm`?`search-sm`:T===`lg`?`search-lg`:``,E?`is-loading`:``,D?`wui-search-collapsible`:``,D&&!U?`is-collapsed`:``,k].filter(Boolean).join(` `),q=w==null?void 0:{"--wui-search-icon-size":`${w}px`};return/* @__PURE__ */ d(`div`,{...h,className:K,style:q,ref:H,onBlur:e=>{D&&!e.currentTarget.contains(e.relatedTarget)&&!R&&B(!1)},children:[D&&/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":x||b||C,"aria-expanded":U?`true`:`false`,onClick:W,children:/* @__PURE__ */ u(t,{name:`search`,size:F})}),E&&/* @__PURE__ */ u(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ u(t,{name:`search`,size:F,className:`search-icon`}),/* @__PURE__ */ u(f.Control,{ref:V,type:`search`,className:`input search-input`,placeholder:b,value:R,onChange:e=>{L(e.target.value),y?.(e.target.value)},onKeyDown:e=>{j?.(e),D&&e.key===`Escape`&&!R&&B(!1)},"aria-label":x,form:A,disabled:O,...N===void 0?null:{readOnly:N},...P}),!O&&/* @__PURE__ */ u(`button`,{type:`button`,className:`search-clear`,"aria-label":S,onClick:G,hidden:!R,children:/* @__PURE__ */ u(t,{name:`x`,size:16})})]})}export{m as default};
1
+ import{FIELD_SIZES as e}from"../lib/fieldState.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{isTypingTarget as o}from"@webority/ui-elements/helpers";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{flushSync as d}from"react-dom";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{SEARCH_TEXT as m}from"@webority/ui-elements/text";import{Form as h}from"react-bootstrap";function g(g){let{marker:_,props:v}=n(`AppSearch`,g),y=t(`search`,m),{value:b,defaultValue:x,onChange:S,placeholder:C=y.placeholder,ariaLabel:w,clearLabel:T=y.clearLabel,searchLabel:E=y.searchLabel,iconSize:D,size:O,loading:k=!1,collapsible:A=!1,disabled:j=!1,className:M=``,form:N,onKeyDown:P,...F}=v;a(`AppSearch`,F);let{readOnly:I,...L}=F;i(`AppSearch`,`size`,O,e);let R=D??18,[z,B]=u(x??``),V=b===void 0?z:b,[H,U]=u(!!V),W=l(null),G=l(null),K=!A||H||!!V,q=s(()=>{U(!0),requestAnimationFrame(()=>W.current?.focus())},[]),J=()=>{B(``),d(()=>S?.(``)),W.current?.form?.requestSubmit()};c(()=>{if(!A)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||o(e.target instanceof Node?e.target:null)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===G.current&&(e.preventDefault(),q())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A,q]);let Y=[`search-wrap`,V?`has-value`:``,O===`sm`?`wui-search-sm`:O===`lg`?`wui-search-lg`:O===`xl`?`wui-search-xl`:``,k?`is-loading`:``,A?`wui-search-collapsible`:``,A&&!K?`is-collapsed`:``,M].filter(Boolean).join(` `),X=D==null?void 0:{"--wui-search-icon-size":`${D}px`};return/* @__PURE__ */ p(`div`,{..._,className:Y,style:X,ref:G,onBlur:e=>{A&&!e.currentTarget.contains(e.relatedTarget)&&!V&&U(!1)},children:[A&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":w||C||E,"aria-expanded":K?`true`:`false`,onClick:q,children:/* @__PURE__ */ f(r,{name:`search`,size:R})}),k&&/* @__PURE__ */ f(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ f(r,{name:`search`,size:R,className:`search-icon`}),/* @__PURE__ */ f(h.Control,{ref:W,type:`search`,className:`input search-input`,placeholder:C,value:V,onChange:e=>{B(e.target.value),S?.(e.target.value)},onKeyDown:e=>{P?.(e),A&&e.key===`Escape`&&!V&&U(!1)},"aria-label":w,form:N,disabled:j,...I===void 0?null:{readOnly:I},...L}),!j&&/* @__PURE__ */ f(`button`,{type:`button`,className:`search-clear`,"aria-label":T,onClick:J,hidden:!V,children:/* @__PURE__ */ f(r,{name:`x`,size:16})})]})}export{g as default};
@@ -1 +1 @@
1
- import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_VARIANTS as r,sectionHeading as i}from"../lib/sectionShell.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAlert.js";import s from"./AppButton.js";import c from"./AppForm.js";import l from"./AppInput.js";import ee from"./AppPhoneNumberInput.js";import u from"./AppTextarea.js";import d from"./assertValidValue.js";import te from"./warnUnknownProps.js";import{useId as ne,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h=[`name`,`email`,`phone`,`company`,`message`],g={name:`name`,email:`email`,company:`organization`},_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function v(e,t,n){let r={};for(let{name:i,required:a=!1}of e){let e=(t[i]??``).trim();a&&e===``?r[i]=n.required:i===`email`&&e!==``&&!_.test(e)&&(r[i]=n.invalidEmail)}return r}function y(_){let{marker:y,props:b}=a(`AppSectionLeadCapture`,_),{title:x,description:S,fields:C,onSubmit:w,submitLabel:T=`Send`,nameLabel:E=`Name`,emailLabel:D=`Email`,phoneLabel:O=`Phone number`,companyLabel:k=`Company`,messageLabel:A=`Message`,requiredText:j=`This field is required.`,invalidEmailText:M=`Enter an email address such as name@example.com.`,submitErrorText:N=`We could not send your message. Please try again.`,successTitle:P,successText:F,consent:I,as:L=`h2`,eyebrow:R,subtitle:z,align:B=`center`,variant:V=`default`,className:H=``,...U}=b;te(`AppSectionLeadCapture`,U),d(`AppSectionLeadCapture`,`as`,L,n),d(`AppSectionLeadCapture`,`align`,B,t),d(`AppSectionLeadCapture`,`variant`,V,r);for(let e of C)d(`AppSectionLeadCapture`,`fields.name`,e.name,h);let W=ne(),[G,K]=f(()=>Object.fromEntries(C.map(e=>[e.name,``]))),[q,J]=f({}),[Y,X]=f(null),[Z,Q]=f(!1),[re,ie]=f(!1),$=(e,t)=>K(n=>({...n,[e]:t})),ae={name:E,email:D,phone:O,company:k,message:A},oe={required:j,invalidEmail:M};async function se(){if(Z)return!1;let e=v(C,G,oe);if(J(e),X(null),Object.keys(e).length>0)return!1;let t=Object.fromEntries(Object.entries(G).map(([e,t])=>[e,(t??``).trim()]));Q(!0);try{return await w(t),ie(!0),!0}catch(e){let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;return X(typeof t==`string`&&t!==``?t:N),!1}finally{Q(!1)}}function ce({name:e,label:t=ae[e],required:n=!1}){let r=`${W}-${e}`,i=q[e];return e===`phone`?/* @__PURE__ */ p(ee,{id:r,name:e,label:t,required:n,value:G[e],onChange:t=>$(e,t),error:i},e):e===`message`?/* @__PURE__ */ p(u,{id:r,name:e,label:t,required:n,value:G[e],onChange:t=>$(e,t.target.value),error:i},e):/* @__PURE__ */ p(l,{id:r,name:e,type:e===`email`?`email`:`text`,autoComplete:g[e],label:t,required:n,value:G[e],onChange:t=>$(e,t.target.value),error:i},e)}return/* @__PURE__ */ m(e,{component:`AppSectionLeadCapture`,kind:`lead-capture`,title:x,as:i(L,`h2`),eyebrow:R,subtitle:z,align:B,variant:V,className:H,rest:{...y,...U},children:[S!=null&&S!==``&&/* @__PURE__ */ p(`p`,{className:`wui-section-lead-text`,children:S}),re?/* @__PURE__ */ p(`div`,{className:`wui-section-lead-success`,children:/* @__PURE__ */ p(o,{tone:`success`,title:P,children:F})}):/* @__PURE__ */ m(c,{className:`wui-section-lead-form`,noValidate:!0,onSubmit:se,children:[/* @__PURE__ */ p(`div`,{className:`wui-section-lead-fields`,children:C.map(ce)}),Y!=null&&/* @__PURE__ */ p(o,{tone:`danger`,children:Y}),/* @__PURE__ */ p(s,{type:`submit`,loading:Z,children:T}),I!=null&&I!==``&&/* @__PURE__ */ p(`p`,{className:`wui-section-lead-consent`,children:I})]})]})}export{y as default};
1
+ import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_VARIANTS as r,sectionHeading as i}from"../lib/sectionShell.js";import a from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import o from"./AppAlert.js";import s from"./AppButton.js";import c from"./AppForm.js";import l from"./AppInput.js";import te from"./AppPhoneNumberInput.js";import ne from"./AppTextarea.js";import u from"./assertValidValue.js";import d from"./warnUnknownProps.js";import{useId as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{SECTION_LEAD_CAPTURE_TEXT as g}from"@webority/ui-elements/text";var _=[`name`,`email`,`phone`,`company`,`message`],v={name:`name`,email:`email`,company:`organization`},y=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function re(e,t,n){let r={};for(let{name:i,required:a=!1}of e){let e=(t[i]??``).trim();a&&e===``?r[i]=n.required:i===`email`&&e!==``&&!y.test(e)&&(r[i]=n.invalidEmail)}return r}function b(y){let{marker:b,props:ie}=ee(`AppSectionLeadCapture`,y),x=a(`sectionLeadCapture`,g),{title:ae,description:S,fields:C,onSubmit:w,submitLabel:T=x.submitLabel,nameLabel:E=x.nameLabel,emailLabel:D=x.emailLabel,phoneLabel:O=x.phoneLabel,companyLabel:k=x.companyLabel,messageLabel:A=x.messageLabel,requiredText:j=x.requiredText,invalidEmailText:M=x.invalidEmailText,submitErrorText:N=x.submitErrorText,successTitle:P,successText:F,consent:I,as:L=`h2`,eyebrow:oe,subtitle:R,align:z=`center`,variant:B=`default`,className:V=``,...H}=ie;d(`AppSectionLeadCapture`,H),u(`AppSectionLeadCapture`,`as`,L,n),u(`AppSectionLeadCapture`,`align`,z,t),u(`AppSectionLeadCapture`,`variant`,B,r);for(let e of C)u(`AppSectionLeadCapture`,`fields.name`,e.name,_);let U=f(),[W,G]=p(()=>Object.fromEntries(C.map(e=>[e.name,``]))),[K,q]=p({}),[J,Y]=p(null),[X,Z]=p(!1),[se,ce]=p(!1),Q=(e,t)=>G(n=>({...n,[e]:t})),le={name:E,email:D,phone:O,company:k,message:A},$={required:j,invalidEmail:M};async function ue(){if(X)return!1;let e=re(C,W,$);if(q(e),Y(null),Object.keys(e).length>0)return!1;let t=Object.fromEntries(Object.entries(W).map(([e,t])=>[e,(t??``).trim()]));Z(!0);try{return await w(t),ce(!0),!0}catch(e){let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;return Y(typeof t==`string`&&t!==``?t:N),!1}finally{Z(!1)}}function de({name:e,label:t=le[e],required:n=!1}){let r=`${U}-${e}`,i=K[e];return e===`phone`?/* @__PURE__ */ m(te,{id:r,name:e,label:t,required:n,value:W[e],onChange:t=>Q(e,t),error:i},e):e===`message`?/* @__PURE__ */ m(ne,{id:r,name:e,label:t,required:n,value:W[e],onChange:t=>Q(e,t.target.value),error:i},e):/* @__PURE__ */ m(l,{id:r,name:e,type:e===`email`?`email`:`text`,autoComplete:v[e],label:t,required:n,value:W[e],onChange:t=>Q(e,t.target.value),error:i},e)}return/* @__PURE__ */ h(e,{component:`AppSectionLeadCapture`,kind:`lead-capture`,title:ae,as:i(L,`h2`),eyebrow:oe,subtitle:R,align:z,variant:B,className:V,rest:{...b,...H},children:[S!=null&&S!==``&&/* @__PURE__ */ m(`p`,{className:`wui-section-lead-text`,children:S}),se?/* @__PURE__ */ m(`div`,{className:`wui-section-lead-success`,children:/* @__PURE__ */ m(o,{tone:`success`,title:P,children:F})}):/* @__PURE__ */ h(c,{className:`wui-section-lead-form`,noValidate:!0,onSubmit:ue,children:[/* @__PURE__ */ m(`div`,{className:`wui-section-lead-fields`,children:C.map(de)}),J!=null&&/* @__PURE__ */ m(o,{tone:`danger`,children:J}),/* @__PURE__ */ m(s,{type:`submit`,loading:X,children:T}),I!=null&&I!==``&&/* @__PURE__ */ m(`p`,{className:`wui-section-lead-consent`,children:I})]})]})}export{b as default};
@@ -1 +1 @@
1
- import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppInfoTip.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{useCallback as s,useEffect as c,useId as l,useLayoutEffect as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var h={sm:`segmented-sm`,md:``,lg:`segmented-lg`};function g(g){let{marker:_,props:v}=n(`AppSegmented`,g),{options:y=[],value:b,defaultValue:x,onChange:S,label:C,name:w,size:T=`md`,fullWidth:E=!1,bordered:D=!0,disabled:O=!1,readOnly:k=!1,loading:A=!1,labelVisible:j=!1,help:M,helpLabel:N=`More information`,className:P=``,...F}=v;o(`AppSegmented`,F),a(`AppSegmented`,`size`,T,Object.keys(h));let I=l(),L=w||I,R=d(null),z=d(null),[B,V]=f(x),H=b===void 0?B:b,U=[`segmented`,h[T]??``,E?`segmented-full`:``,D?``:`wui-segmented-borderless`,O?`is-disabled`:``,A?e:``,P].filter(Boolean).join(` `),W=d(null),G=s(e=>{let t=R.current,n=z.current;if(!t||!n)return;let r=t.querySelector(`.segmented-option:has(.segmented-input:checked)`);if(!r||!t.offsetWidth){n.style.opacity=`0`,W.current=null;return}let i=r.offsetLeft,a=r.offsetWidth,o=W.current;if(o&&o.thumb===n&&o.left===i&&o.width===a)return;let s=e||!o||o.thumb!==n;s&&t.classList.remove(`is-animated`),n.style.width=`${a}px`,n.style.transform=`translateX(${i}px)`,n.style.opacity=`1`,W.current={thumb:n,left:i,width:a},s&&requestAnimationFrame(()=>R.current?.classList.add(`is-animated`))},[]);u(()=>{G(!1)});let K=s(e=>{if(R.current=e,!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>G(!0));return t.observe(e),()=>{t.disconnect(),R.current=null}},[G]);c(()=>{let e=requestAnimationFrame(()=>R.current?.classList.add(`is-animated`));return()=>cancelAnimationFrame(e)},[]);let q=j&&C,J=/* @__PURE__ */ m(`div`,{ref:K,className:U,role:`radiogroup`,"aria-label":C,"aria-disabled":O||void 0,"aria-busy":A||void 0,...q?void 0:_,...F,children:[/* @__PURE__ */ p(`span`,{className:`segmented-thumb`,ref:z,"aria-hidden":`true`}),y.map(e=>/* @__PURE__ */ m(`label`,{className:`segmented-option`,children:[/* @__PURE__ */ p(`input`,{type:`radio`,className:`segmented-input`,name:L,value:e.value,checked:e.value===H,disabled:O||A||e.disabled,"aria-readonly":k||void 0,onClick:t(k||A),onChange:()=>{V(e.value),S?.(e.value)}}),e.icon&&/* @__PURE__ */ p(r,{name:e.icon,size:13}),e.note?/* @__PURE__ */ m(`span`,{className:`segmented-option-text`,children:[/* @__PURE__ */ p(`span`,{className:`segmented-option-label`,children:e.label}),/* @__PURE__ */ p(`span`,{className:`segmented-option-note`,children:e.note})]}):e.label,e.count!=null&&/* @__PURE__ */ p(`span`,{className:`wui-segmented-option-count`,children:e.count})]},e.value))]},`group`);return q?/* @__PURE__ */ m(`div`,{className:`field`,..._,children:[/* @__PURE__ */ p(`span`,{className:`label`,"aria-hidden":`true`,children:C}),M&&/* @__PURE__ */ p(i,{label:N,children:M}),J]},`field`):J}export{g as default};
1
+ import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./AppInfoTip.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{useCallback as c,useEffect as l,useId as u,useLayoutEffect as d,useRef as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{SEGMENTED_TEXT as g}from"@webority/ui-elements/text";var _={sm:`segmented-sm`,md:``,lg:`segmented-lg`};function v(v){let{marker:y,props:b}=r(`AppSegmented`,v),x=n(`segmented`,g),{options:S=[],value:C,defaultValue:w,onChange:T,label:E,name:D,size:O=`md`,fullWidth:k=!1,bordered:A=!0,disabled:j=!1,readOnly:M=!1,loading:N=!1,labelVisible:P=!1,help:F,helpLabel:I=x.helpLabel,className:L=``,...R}=b;s(`AppSegmented`,R),o(`AppSegmented`,`size`,O,Object.keys(_));let z=u(),B=D||z,V=f(null),H=f(null),[U,W]=p(w),G=C===void 0?U:C,K=[`segmented`,_[O]??``,k?`segmented-full`:``,A?``:`wui-segmented-borderless`,j?`is-disabled`:``,N?e:``,L].filter(Boolean).join(` `),q=f(null),J=c(e=>{let t=V.current,n=H.current;if(!t||!n)return;let r=t.querySelector(`.segmented-option:has(.segmented-input:checked)`);if(!r||!t.offsetWidth){n.style.opacity=`0`,q.current=null;return}let i=r.offsetLeft,a=r.offsetWidth,o=q.current;if(o&&o.thumb===n&&o.left===i&&o.width===a)return;let s=e||!o||o.thumb!==n;s&&t.classList.remove(`is-animated`),n.style.width=`${a}px`,n.style.transform=`translateX(${i}px)`,n.style.opacity=`1`,q.current={thumb:n,left:i,width:a},s&&requestAnimationFrame(()=>V.current?.classList.add(`is-animated`))},[]);d(()=>{J(!1)});let Y=c(e=>{if(V.current=e,!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>J(!0));return t.observe(e),()=>{t.disconnect(),V.current=null}},[J]);l(()=>{let e=requestAnimationFrame(()=>V.current?.classList.add(`is-animated`));return()=>cancelAnimationFrame(e)},[]);let X=P&&E,Z=/* @__PURE__ */ h(`div`,{ref:Y,className:K,role:`radiogroup`,"aria-label":E,"aria-disabled":j||void 0,"aria-busy":N||void 0,...X?void 0:y,...R,children:[/* @__PURE__ */ m(`span`,{className:`segmented-thumb`,ref:H,"aria-hidden":`true`}),S.map(e=>/* @__PURE__ */ h(`label`,{className:`segmented-option`,children:[/* @__PURE__ */ m(`input`,{type:`radio`,className:`segmented-input`,name:B,value:e.value,checked:e.value===G,disabled:j||N||e.disabled,"aria-readonly":M||void 0,onClick:t(M||N),onChange:()=>{W(e.value),T?.(e.value)}}),e.icon&&/* @__PURE__ */ m(i,{name:e.icon,size:13}),e.note?/* @__PURE__ */ h(`span`,{className:`segmented-option-text`,children:[/* @__PURE__ */ m(`span`,{className:`segmented-option-label`,children:e.label}),/* @__PURE__ */ m(`span`,{className:`segmented-option-note`,children:e.note})]}):e.label,e.count!=null&&/* @__PURE__ */ m(`span`,{className:`wui-segmented-option-count`,children:e.count})]},e.value))]},`group`);return X?/* @__PURE__ */ h(`div`,{className:`field`,...y,children:[/* @__PURE__ */ m(`span`,{className:`label`,"aria-hidden":`true`,children:E}),F&&/* @__PURE__ */ m(a,{label:I,children:F}),Z]},`field`):Z}export{v as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import{useFieldError as r}from"../lib/formFields.js";import ee from"../lib/useElementEntry.js";import{splitMarkerProps as te}from"../lib/wuiMarker.js";import ne from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import o from"./textOf.js";import re from"./useNodeLabels.js";import ie,{optionsEqual as ae}from"./useWuiControl.js";import oe from"./warnUnknownProps.js";import{forwardRef as s,useEffect as c,useId as se,useLayoutEffect as l,useMemo as ce,useRef as u}from"react";import{Fragment as le,jsx as d,jsxs as f}from"react/jsx-runtime";var ue=[`single`,`multiple`,`search`,`tag`,`country`],de=[`comfortable`,`compact`],p=[`sm`,`md`,`lg`],fe=[`off`,`border`,`above`],pe=[],m=[],me=()=>import(`@webority/ui-elements/elements/select`),he=e=>e===`multiple`||e===`tag`,h=e=>e!=null&&e!==``,g=e=>{throw Error(`<AppSelect> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)},ge=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},_e=(e,t)=>{let n=Array.isArray(t)?t:m,r=Array.isArray(e.value)?e.value:m;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},ve=(e,t)=>({...e,label:t}),ye=e=>Array.isArray(e)?e.join(`,`):e,be=s(function(s,be){let _=ee(`wui-select`,me),{marker:v,props:xe}=te(`AppSelect`,s),{mode:y=`single`,density:b=`comfortable`,size:x,value:Se,defaultValue:S,onChange:Ce,options:C=pe,loadOptions:w,remote:T=!1,onSearch:we,validate:E,placeholder:Te,searchPlaceholder:Ee,emptyText:De,searchable:D,clearable:Oe=!1,openOnHover:ke=!1,icon:Ae,valuePrefix:O,prefix:k,suffix:A,floatingLabel:j=`off`,disabled:je,readOnly:Me=!1,loading:Ne=!1,open:Pe,label:M,required:N=!1,optional:P=!1,optionalLabel:F=`(optional)`,error:Fe,helperText:I,help:L,helpLabel:Ie=`More information`,id:Le,name:R,minChars:z,debounce:B,allowCustom:Re=!1,addLabel:ze,searchingText:Be,hintText:Ve,valueLabel:He,valueAvatar:Ue,valueInitials:We,maxTags:Ge,allowDuplicates:Ke=!1,separators:qe,pattern:Je,invalidMessage:Ye,createLabel:Xe,collapseChips:Ze=!1,selectedText:Qe,clearAllLabel:$e,countries:et,suggested:tt,suggestedLabel:nt,allCountriesLabel:rt,recentsKey:it,recentsLimit:at,recentsLabel:ot,className:st=``,fieldClassName:V=``,controlOnly:ct=!1,"aria-label":lt,"aria-labelledby":ut,"aria-describedby":dt,...ft}=xe,pt=r(R),H=Fe??pt;oe(`AppSelect`,ft),a(`AppSelect`,`mode`,y,ue),a(`AppSelect`,`density`,b,de),a(`AppSelect`,`size`,x,p);let U=he(y);a(`AppSelect`,`floatingLabel`,j,U?[`off`]:fe);let mt=u(!1);U&&(k!=null||A!=null)&&!mt.current&&(mt.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${y}"; they are ignored.`));let ht=se(),W=u(!1);c(()=>{y===`country`&&n()},[y]);let{setRef:gt,innerRef:G}=ie({ready:_,ref:be,value:Se??(S===void 0?U?m:``:void 0),defaultValue:S,writeValue:U?_e:ge,on:{change:e=>{let t=e.currentTarget.value,n={isCustom:!!e.detail?.isCustom};switch(s.mode){case`multiple`:Array.isArray(t)&&s.onChange?.(t);break;case`tag`:Array.isArray(t)&&s.onChange?.(t,n);break;case`search`:typeof t==`string`&&s.onChange?.(t,n);break;default:typeof t==`string`&&s.onChange?.(t)}},search:e=>{T&&typeof w!=`function`&&we?.(e.detail.query,{seq:e.detail.seq})}}}),_t=ce(()=>typeof w==`function`?(e,t)=>new Promise(n=>n(w(e,t))).then(e=>(W.current=!0,e),e=>{throw W.current=!0,e}):null,[w]),{portal:vt,toElementOptions:K}=re(C),q=u({el:null,options:null,map:null});l(()=>{let e=G.current;if(!e||!_||q.current.el===e&&q.current.options===C&&q.current.map===K||(q.current={el:e,options:C,map:K},w&&W.current))return;let t=K(C,ve);ae(t,e.options)||(e.options=t)}),l(()=>{let e=G.current;if(!e||!_)return;e.loadOptions!==_t&&(e.loadOptions=_t);let t=typeof E==`function`?E:null;e.validate!==t&&(e.validate=t)}),l(()=>{G.current?.toggleAttribute(`loading`,!!Ne)});let J=Le||ht,Y=!U&&j!==`off`&&M,yt=H&&J?`${J}-error`:void 0,bt=I&&J?`${J}-hint`:void 0,xt=yt||bt||dt;c(()=>{let e=G.current;e&&(O==null||O===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,O))},[O,G]);let X=!U&&!Y&&(k!=null||A!=null),St=y===`multiple`||y===`tag`||y===`country`;if(ct&&(h(M)&&g(`label`),h(H)&&g(`error`),h(I)&&g(`helperText`),h(V)&&g(`fieldClassName`),St))throw Error(`<AppSelect> controlOnly draws no field, so it takes no mode="${y}"; that mode always draws its field.`);let Z=ct||!St&&!M&&!H&&!I&&!V,Ct=o(M).trim(),wt=Ct&&(y===`single`||y===`multiple`||y===`search`)?`Search ${Ct}…`:void 0,Tt=/* @__PURE__ */ d(`wui-select`,{"aria-label":lt||o(M)||void 0,"aria-labelledby":ut||void 0,"aria-describedby":xt||void 0,"aria-invalid":H?`true`:void 0,ref:gt,id:J,name:R,mode:y,density:b===`compact`?`compact`:void 0,placeholder:Y?` `:Te||void 0,"search-placeholder":Ee||wt,"empty-text":De||void 0,searchable:D===void 0?void 0:D?`true`:`false`,clearable:Oe?``:void 0,"open-on-hover":ke?``:void 0,size:x!==`md`&&p.includes(x??``)?x:void 0,icon:Ae||void 0,disabled:je?``:void 0,readonly:Me?``:void 0,open:Pe?``:void 0,required:N?``:void 0,"min-chars":z==null?void 0:String(z),debounce:B==null?void 0:String(B),remote:T?``:void 0,"allow-custom":Re?``:void 0,"add-label":ze||void 0,"searching-text":Be||void 0,"hint-text":Ve||void 0,"value-label":He||void 0,"value-avatar":Ue||void 0,"value-initials":We||void 0,"max-tags":Ge==null?void 0:String(Ge),"allow-duplicates":Ke?``:void 0,separators:qe||void 0,pattern:Je||void 0,"invalid-message":Ye||void 0,"create-label":Xe||void 0,"collapse-chips":Ze?``:void 0,"selected-text":Qe||void 0,"clear-all-label":$e||void 0,countries:ye(et)||void 0,suggested:ye(tt)||void 0,"suggested-label":nt||void 0,"all-countries-label":rt||void 0,"recents-key":it||void 0,"recents-limit":at==null?void 0:String(at),"recents-label":ot||void 0,className:st||void 0,...Z&&!X?v:null,...ft}),Q=/* @__PURE__ */ f(le,{children:[Tt,vt]}),$=X?/* @__PURE__ */ f(`div`,{...Z?v:null,className:`input-affixed`,children:[k!=null&&/* @__PURE__ */ d(`span`,{className:`affix affix-pre`,children:k}),Q,A!=null&&/* @__PURE__ */ d(`span`,{className:`affix affix-suf`,children:A})]}):Q;if(Z)return $;let Et=[`field`,V].filter(Boolean).join(` `);return/* @__PURE__ */ f(`div`,{...v,className:Et,children:[M&&!Y&&/* @__PURE__ */ f(`label`,{className:`label`,htmlFor:J,children:[M,P&&!N&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ d(i,{}),L&&/* @__PURE__ */ d(ne,{label:Ie,children:L})]}),Y?/* @__PURE__ */ f(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[Q,/* @__PURE__ */ f(`label`,{className:`float-label`,htmlFor:J,children:[M,P&&!N&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ d(i,{})]})]}):$,/* @__PURE__ */ d(t,{error:H,hint:I,errorId:yt,hintId:bt})]})});export{be as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_SIZES as n}from"../lib/fieldState.js";import{loadFlagStyles as r}from"../lib/flagStyles.js";import{useFieldError as ee}from"../lib/formFields.js";import te from"../lib/useElementEntry.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import ie from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import ae from"./textOf.js";import oe from"./useNodeLabels.js";import se,{optionsEqual as ce}from"./useWuiControl.js";import le from"./warnUnknownProps.js";import{forwardRef as o,useEffect as s,useId as ue,useLayoutEffect as c,useMemo as de,useRef as l}from"react";import{Fragment as fe,jsx as u,jsxs as d}from"react/jsx-runtime";import{SELECT_TEXT as pe,fillText as me}from"@webority/ui-elements/text";var he=[`single`,`multiple`,`search`,`tag`,`country`],ge=[`comfortable`,`compact`],_e=[`off`,`border`,`above`],ve=[],f=[],ye=()=>import(`@webority/ui-elements/elements/select`),be=e=>e===`multiple`||e===`tag`,p=e=>e!=null&&e!==``,m=e=>{throw Error(`<AppSelect> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)},xe=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},Se=(e,t)=>{let n=Array.isArray(t)?t:f,r=Array.isArray(e.value)?e.value:f;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},Ce=(e,t)=>({...e,label:t}),we=e=>Array.isArray(e)?e.join(`,`):e,h=o(function(o,h){let g=te(`wui-select`,ye),{marker:_,props:Te}=re(`AppSelect`,o),v=ne(`select`,pe),{mode:y=`single`,density:b=`comfortable`,size:x,value:Ee,defaultValue:S,onChange:De,options:C=ve,loadOptions:w,remote:T=!1,onSearch:Oe,validate:E,placeholder:ke,searchPlaceholder:Ae,emptyText:je,searchable:D,clearable:Me=!1,openOnHover:Ne=!1,icon:Pe,valuePrefix:O,prefix:k,suffix:A,floatingLabel:j=`off`,disabled:Fe,readOnly:Ie=!1,loading:Le=!1,open:Re,label:M,required:N=!1,optional:P=!1,optionalLabel:F=v.optionalLabel,error:ze,helperText:I,help:L,helpLabel:Be=v.helpLabel,id:Ve,name:R,minChars:z,debounce:B,allowCustom:He=!1,addLabel:Ue,searchingText:We,hintText:Ge,valueLabel:Ke,valueAvatar:qe,valueInitials:Je,maxTags:V,allowDuplicates:Ye=!1,separators:Xe,pattern:Ze,invalidMessage:Qe,createLabel:$e,collapseChips:et=!1,selectedText:tt,clearAllLabel:nt,countries:rt,suggested:it,suggestedLabel:at,allCountriesLabel:ot,recentsKey:st,recentsLimit:H,recentsLabel:ct,className:lt=``,fieldClassName:U=``,controlOnly:ut=!1,"aria-label":dt,"aria-labelledby":ft,"aria-describedby":pt,"aria-invalid":mt,...ht}=Te,gt=ee(R),W=ze??gt;le(`AppSelect`,ht),a(`AppSelect`,`mode`,y,he),a(`AppSelect`,`density`,b,ge),a(`AppSelect`,`size`,x,n);let G=be(y);a(`AppSelect`,`floatingLabel`,j,G?[`off`]:_e);let _t=l(!1);G&&(k!=null||A!=null)&&!_t.current&&(_t.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${y}"; they are ignored.`));let vt=ue(),K=l(!1);s(()=>{y===`country`&&r()},[y]);let{setRef:yt,innerRef:q}=se({ready:g,ref:h,value:Ee??(S===void 0?G?f:``:void 0),defaultValue:S,writeValue:G?Se:xe,on:{change:e=>{let t=e.currentTarget.value,n={isCustom:!!e.detail?.isCustom};switch(o.mode){case`multiple`:Array.isArray(t)&&o.onChange?.(t);break;case`tag`:Array.isArray(t)&&o.onChange?.(t,n);break;case`search`:typeof t==`string`&&o.onChange?.(t,n);break;default:typeof t==`string`&&o.onChange?.(t)}},search:e=>{T&&typeof w!=`function`&&Oe?.(e.detail.query,{seq:e.detail.seq})}}}),bt=de(()=>typeof w==`function`?(e,t)=>new Promise(n=>n(w(e,t))).then(e=>(K.current=!0,e),e=>{throw K.current=!0,e}):null,[w]),{portal:xt,toElementOptions:J}=oe(C),Y=l({el:null,options:null,map:null});c(()=>{let e=q.current;if(!e||!g||Y.current.el===e&&Y.current.options===C&&Y.current.map===J||(Y.current={el:e,options:C,map:J},w&&K.current))return;let t=J(C,Ce);ce(t,e.options)||(e.options=t)}),c(()=>{let e=q.current;if(!e||!g)return;e.loadOptions!==bt&&(e.loadOptions=bt);let t=typeof E==`function`?E:null;e.validate!==t&&(e.validate=t)}),c(()=>{q.current?.toggleAttribute(`loading`,!!Le)});let X=Ve||vt,Z=!G&&j!==`off`&&M,St=W&&X?`${X}-error`:void 0,Ct=I&&X?`${X}-hint`:void 0,wt=St||Ct||pt;s(()=>{let e=q.current;e&&(O==null||O===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,O))},[O,q]);let Tt=!G&&!Z&&(k!=null||A!=null),Et=y===`multiple`||y===`tag`||y===`country`;if(ut&&(p(M)&&m(`label`),p(W)&&m(`error`),p(I)&&m(`helperText`),p(U)&&m(`fieldClassName`),Et))throw Error(`<AppSelect> controlOnly draws no field, so it takes no mode="${y}"; that mode always draws its field.`);let Q=ut||!Et&&!M&&!W&&!I&&!U,Dt=ae(M).trim(),Ot=Dt&&(y===`single`||y===`multiple`||y===`search`)?me(v.defaultSearchPlaceholder,{labelText:Dt}):void 0,kt=/* @__PURE__ */ u(`wui-select`,{"aria-label":dt||ae(M)||void 0,"aria-labelledby":ft||void 0,"aria-describedby":wt||void 0,"aria-invalid":mt??(W?`true`:void 0),ref:yt,id:X,name:R,mode:y,density:b===`compact`?`compact`:void 0,placeholder:Z?` `:ke||void 0,"search-placeholder":Ae||Ot,"empty-text":je||void 0,searchable:D===void 0?void 0:D?`true`:`false`,clearable:Me?``:void 0,"open-on-hover":Ne?``:void 0,size:x!==`md`&&n.includes(x??``)?x:void 0,icon:Pe||void 0,disabled:Fe?``:void 0,readonly:Ie?``:void 0,open:Re?``:void 0,required:N?``:void 0,"min-chars":z==null?void 0:String(z),debounce:B==null?void 0:String(B),remote:T?``:void 0,"allow-custom":He?``:void 0,"add-label":Ue||void 0,"searching-text":We||void 0,"hint-text":Ge||void 0,"value-label":Ke||void 0,"value-avatar":qe||void 0,"value-initials":Je||void 0,"max-tags":V==null?void 0:String(V),"allow-duplicates":Ye?``:void 0,separators:Xe||void 0,pattern:Ze||void 0,"invalid-message":Qe||void 0,"create-label":$e||void 0,"collapse-chips":et?``:void 0,"selected-text":tt||void 0,"clear-all-label":nt||void 0,countries:we(rt)||void 0,suggested:we(it)||void 0,"suggested-label":at||void 0,"all-countries-label":ot||void 0,"recents-key":st||void 0,"recents-limit":H==null?void 0:String(H),"recents-label":ct||void 0,className:lt||void 0,...Q&&!Tt?_:null,...ht}),$=/* @__PURE__ */ d(fe,{children:[kt,xt]}),At=Tt?/* @__PURE__ */ d(`div`,{...Q?_:null,className:`input-affixed`,children:[k!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-pre`,children:k}),$,A!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-suf`,children:A})]}):$;if(Q)return At;let jt=[`field`,U].filter(Boolean).join(` `);return/* @__PURE__ */ d(`div`,{..._,className:jt,children:[M&&!Z&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:X,children:[M,P&&!N&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ u(i,{}),L&&/* @__PURE__ */ u(ie,{label:Be,children:L})]}),Z?/* @__PURE__ */ d(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[$,/* @__PURE__ */ d(`label`,{className:`float-label`,htmlFor:X,children:[M,P&&!N&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ u(i,{})]})]}):At,/* @__PURE__ */ u(t,{error:W,hint:I,errorId:St,hintId:Ct})]})});export{h as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x,setPopoverOpen as S}from"@webority/ui-elements/helpers";import{useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";var j=()=>import(`@webority/ui-elements/elements/overflow`),M=()=>import(`@webority/ui-elements/elements/dropdown`),N=99,P=4,F=5,I=/^[a-z0-9-]+$/,L=`wui-sidebar-footer`,R=[],z=[`prefix`,`exact`],B=[`comfortable`,`compact`],V=[`neutral`,`primary`],ee=[`default`,`brand`],te=[`side`,`top`],ne=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],re=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),H=e=>e>N?`${N}+`:String(e),U=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ie=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:U.format(/* @__PURE__ */ new Date)<=e},ae=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},oe=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ k(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ k(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function W(e){let{marker:t,props:n}=f(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b,brandHref:w,brandLabel:j,sidebarStart:M,sidebarStartCompact:N,sidebarFooter:P,sidebarFooterItems:F=R,topbarStart:I,topbarEnd:L,footer:z,launcher:re,children:H,collapsed:U,onCollapsedChange:ie,noSidebar:W=!1,nav:G=`side`,density:K=`comfortable`,itemHeight:ce,iconVariant:q=`twotone`,topbarTone:le=`neutral`,tone:J=`default`,navLabel:ve=`Main navigation`,linkComponent:Y,currentPath:be,rememberCollapsed:xe=!1,collapsedCookie:Se=`wui-shell-collapsed`,foldedCookie:Ce=i,tabBarLabel:we=`Quick navigation`,moreLabel:Te=`More`,skipLabel:Ee=`Skip to content`,openNavLabel:De=`Open navigation`,expandNavLabel:Oe=`Expand navigation`,collapseNavLabel:ke=`Collapse navigation`,newLabel:Ae=`New`,togglePagesLabel:je=`Show or hide {name} pages`,accountMenuLabel:Me=`Account menu for {name}`,roleLabel:Ne=`Role:`,rolesLabel:Pe=`Roles:`,unreadLabel:Fe=`Unread`,markAllReadLabel:Ie=`Mark all read`,viewAllLabel:Le=`View all`,loadingNotificationsText:Re=`Loading…`,noUnreadText:ze=`No unread notifications`,unreadNotificationsText:Be=`{count} unread notifications`,unreadBellLabel:Ve=`{label}, {count} unread`,searchResultsLabel:He=`Search results`,noResultsText:Ue=`No results`,noResultsForText:We=`No results for “{value}”`,resultsCountText:Ge=`{count} results`,resultCountText:Ke=`{count} result`,userMenu:qe,notifications:Je,search:Ye,className:Xe=``,style:Ze,...Qe}=n;if(v(`AppShell`,Qe),_(`AppShell`,`density`,K,B),_(`AppShell`,`topbarTone`,le,V),_(`AppShell`,`tone`,J,ee),_(`AppShell`,`nav`,G,te),_(`AppShell`,`iconVariant`,q,ne),j!==void 0&&!w)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(w){if(!j&&!b)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||d||p||m))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let $e=(ce??0)>0?{...Ze,"--wui-nav-item-height":`${ce}px`}:Ze,[et,tt]=D(()=>xe&&U===void 0&&typeof document<`u`?o(Se)??!1:!1),[X,Z]=D(!1),nt=E(null),[rt,it]=D(!1),[at,ot]=D(!1),st=E(null),Q=U??et,ct=e=>w?/* @__PURE__ */ k(fe,{href:w,label:j||b,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,lt=()=>{let e=!Q;U===void 0&&tt(e),xe&&c(e,Se),ie?.(e)},ut=r.some(e=>e.collapsible),[dt,ft]=D(()=>ut&&typeof document<`u`?a(Ce):/* @__PURE__ */ new Set),pt=e=>{let t=new Set(dt);t.has(e)?t.delete(e):t.add(e),ft(t),s(t,Ce)},mt=T(()=>se(r,F,be),[r,F,be]),$=mt.groups,ht=mt.footer,gt=W?null:ue($,ht.some(e=>e.active));C(()=>{let e=()=>it(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),C(()=>{y()},[]),C(()=>{x(st.current)},[]),C(()=>{let e=st.current;if(!e)return;let t=()=>ot($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),C(()=>{let e=nt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Z(!1))},r=e=>Z(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),C(()=>{let e=nt.current;e?.hasAttribute(`popover`)&&S(e,X)},[X]);let _t=[`app-shell`,Q?`collapsed`:``,W?`no-sidebar`:``,G===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Xe].filter(Boolean).join(` `);return/* @__PURE__ */ A(`div`,{className:_t,"data-density":K===`compact`?`compact`:void 0,"data-shell-tone":J===`brand`?`brand`:void 0,"data-wui-folded-cookie":ut?Ce:void 0,style:$e,...t,...Qe,children:[/* @__PURE__ */ k(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ee}),/* @__PURE__ */ A(`aside`,{className:`app-sidebar`,ref:nt,children:[(l||u||d||p||m)&&/* @__PURE__ */ k(`div`,{className:ae({logoLight:u,logoDark:d,markLight:p,markDark:m}),children:ct(/* @__PURE__ */ A(O,{children:[oe({logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b}),l]}))}),M&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start`,children:M}),N&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start-compact`,children:N}),/* @__PURE__ */ k(`nav`,{className:`app-sidebar-scroll`,"aria-label":ve,ref:st,tabIndex:at?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label):/* @__PURE__ */ k(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ A(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!dt.has(e.key??``)||!!me(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ A(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>pt(e.key??``),children:[/* @__PURE__ */ k(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ k(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ A(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(P||ht.length>0)&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-foot`,children:[ht.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-sidebar-foot-links`,children:ht.map(e=>/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label))}),P]}),!W&&/* @__PURE__ */ k(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:lt,"aria-label":Q?Oe:ke,"aria-expanded":!Q,children:/* @__PURE__ */ k(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ A(`div`,{className:`app-main`,children:[/* @__PURE__ */ A(`header`,{className:`app-topbar${rt?` wui-scrolled`:``}`,"data-tone":le===`primary`?`primary`:void 0,children:[/* @__PURE__ */ A(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":De,"aria-expanded":X,children:/* @__PURE__ */ k(h,{name:`menu`,size:18})}),G===`top`&&l&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-brand`,children:ct(l)}),G===`top`&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ k(g,{items:de($),ariaLabel:ve,linkComponent:Y})}),I,Ye&&/* @__PURE__ */ k(ye,{config:Ye,searchResultsLabel:He,noResultsText:Ue,noResultsForText:We,resultsCountText:Ge,resultCountText:Ke,moreLabel:Te})]}),/* @__PURE__ */ A(`div`,{className:`app-topbar-end`,children:[L,Je&&/* @__PURE__ */ k(_e,{config:Je,unreadLabel:Fe,markAllReadLabel:Ie,viewAllLabel:Le,loadingNotificationsText:Re,noUnreadText:ze,unreadNotificationsText:Be,unreadBellLabel:Ve}),qe&&/* @__PURE__ */ k(ge,{config:qe,linkComponent:Y,accountMenuLabel:Me,roleLabel:Ne,rolesLabel:Pe})]})]}),/* @__PURE__ */ k(`main`,{className:`app-content`,id:`main-content`,children:H}),z&&/* @__PURE__ */ k(`footer`,{className:`app-footer`,children:z})]}),re&&/* @__PURE__ */ k(`div`,{className:`wui-shell-launcher`,children:re}),gt&&/* @__PURE__ */ A(`nav`,{className:`wui-tabbar`,"aria-label":we,children:[gt.tabs.map(e=>/* @__PURE__ */ k(pe,{tab:e,linkComponent:Y,iconVariant:q},e.key??e.href)),gt.hasMore&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-tabbar-item${gt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ k(h,{name:`more`,size:24})}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:Te})]})]})]})}function se(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&le(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>K(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:L,items:t}].map(e=>({...e,items:ce(a(e.items,!0))})).filter(e=>e.items.some(e=>!K(e))),s=[],c=e=>{for(let t of e)K(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,G(e)),_(`AppShell`,`match`,e.match,z),_(`AppShell`,`iconVariant`,e.iconVariant,ne),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==L),footer:o.find(e=>e.key===L)?.items??[]}}function G(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!re.has(e)))}var K=e=>e.header!=null;function ce(e){return e.filter((t,n)=>{if(!K(t))return!0;let r=e.findIndex((e,t)=>t>n&&K(e));return e.slice(n+1,r<0?void 0:r).length>0})}var q=/* @__PURE__ */ new Set;function le(t){if(t.key!=null&&I.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||q.has(n)||(q.add(n),e(n))}function ue(e,t){let n=[],r=e=>{for(let t of e)K(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?P:F;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function de(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>K(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(K(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function fe({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function pe({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ k(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function me(e){for(let t of e){if(t.active)return t;let e=t.children?.length?me(t.children):void 0;if(e)return e}}function he({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?me(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=D(m);C(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ k(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=ie(e.newUntil)&&/* @__PURE__ */ k(`span`,{className:`wui-nav-new`,children:s}),w=/* @__PURE__ */ A(O,{children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ k(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ k(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ k(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ k(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ k(he,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ k(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:i,children:w});return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ k(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}let E=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ k(l,{link:n(r,{to:e.href}),className:E,"aria-current":T,"data-label":y,onClick:i,children:w})}function J(e){u(`wui-dropdown`,M);let[t,n]=D(!1),r=E(null);return C(()=>{r.current?.toggleAttribute(`open`,t)},[t]),C(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ge({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=w(),{open:c,setOpen:u,ref:d}=J(),{name:f,role:g,roles:v=[],noTriggerRole:y=!1,outlined:b=!1,photo:x,profileHref:S,profileLabel:C=`My profile`,onLogout:T,logoutAction:E,logoutLabel:D=`Sign out`,head:j,section:M,logoutVariant:N=`item`,items:P=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,N,[`item`,`button`]),!f)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let F=v.map(e=>(e??``).trim()).filter(Boolean),I=()=>u(!1),L=(e,t,i,a)=>/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),R=/* @__PURE__ */ k(h,{name:`log-out`,size:18}),z=/* @__PURE__ */ A(O,{children:[R,D]});return/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:s,className:b?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":c,"aria-label":t(i,{name:f}),children:[/* @__PURE__ */ k(p,{name:f,src:x,tone:`auto`}),/* @__PURE__ */ A(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-name`,children:f}),g&&!y&&/* @__PURE__ */ k(`span`,{className:`wui-usermenu-role`,children:g})]}),/* @__PURE__ */ k(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ k(p,{name:f,src:x,size:`lg`,tone:`auto`}),/* @__PURE__ */ A(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-name`,children:f}),g&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-role`,children:g}),F.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-roles-label`,children:F.length===1?a:o}),` ${F.join(`, `)}`]}),j?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-extra`,children:j}):null]})]}),M?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-section`,children:M}):null,S&&L(S,/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(h,{name:`user`,size:18}),C]}),void 0,I),P.map(e=>{if(e.divider)return/* @__PURE__ */ k(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),I()};return e.href?L(e.href,t,e.key,n):/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),N===`button`?(E||T)&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-foot`,children:E?/* @__PURE__ */ k(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:R,children:D})}):/* @__PURE__ */ k(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:R,onClick:()=>{I(),T?.()},children:D})}):E?/* @__PURE__ */ k(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(`button`,{type:`submit`,className:`dropdown-item danger`,children:z})}):T&&/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{I(),T()},children:z})]})]})}function _e({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=w(),{open:u,ref:d}=J(e.onOpen),{unread:f=0,items:p,loading:m=!1,onMarkAllRead:g,viewAllHref:_,label:v=`Notifications`,emptyText:y=`You are all caught up.`}=e,[b,x]=D(``),S=E(f);C(()=>{S.current!==f&&(S.current=f,x(f===0?o:t(s,{count:H(f)})))},[f,o,s]);let T=null;return p?.length?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-items`,children:p.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ A(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ k(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ k(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ k(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ k(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):m?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:a}):p&&(T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:y})),/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":u,"aria-label":f===0?v:t(c,{label:v,count:H(f)}),children:[/* @__PURE__ */ k(h,{name:`notification`,size:20}),/* @__PURE__ */ k(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:f===0,children:H(f)})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:b}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ A(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-title`,children:v}),g&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-bell-markall`,onClick:g,children:r})]}),/* @__PURE__ */ k(`div`,{className:`wui-bell-list`,"aria-busy":m||void 0,children:T}),_&&/* @__PURE__ */ k(`a`,{className:`wui-bell-foot`,href:_,children:i})]})]})}var ve=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ye({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,j);let c=w(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:m,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,x]=D(!1),[S,O]=D(!1),[M,N]=D({results:null,index:-1}),P=M.results===f?M.index:-1,F=e=>N({results:f,index:e}),I=E(null),L=E(null),R=E([]),z=T(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),B=f!=null&&!S,V=z.length;C(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ve(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),x(!0),L.current?.focus())},t=e=>{I.current?.contains(e.target instanceof Node?e.target:null)||(O(!0),x(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ee=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!B||V===0)return;e.preventDefault(),F((P+(e.key===`ArrowDown`?1:-1)+V)%V)}else b(e.nativeEvent)?B&&P>=0&&R.current[P]?(e.preventDefault(),R.current[P].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(B?(e.preventDefault(),O(!0)):y&&(e.preventDefault(),x(!1)))},te=-1;return R.current=[],/* @__PURE__ */ k(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ k(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ A(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:I,"data-overflow-label":v,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;x(e),e&&L.current?.focus()},children:/* @__PURE__ */ k(h,{name:`search`,size:20})}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ A(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ k(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ k(`input`,{ref:L,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":B,"aria-controls":`${c}-list`,"aria-activedescendant":B&&P>=0?`${c}-opt-${P}`:void 0,autoComplete:`off`,value:l,onChange:e=>{O(!1),d?.(e.target.value)},onKeyDown:ee,onFocus:_})]}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!B,children:B&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[V===0&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{te+=1;let t=te;return/* @__PURE__ */ A(`a`,{className:`wui-topsearch-hit${t===P?` is-active`:``}`,role:`option`,"aria-selected":t===P,id:`${c}-opt-${t}`,href:e.href,ref:e=>{R.current[t]=e},onClick:t=>m?.(e,t),children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:B?V===0?r:t(V===1?o:a,{count:V}):``})]})})})}export{W as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x,setPopoverOpen as S}from"@webority/ui-elements/helpers";import{useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";import{SHELL_TEXT as j,fillText as M}from"@webority/ui-elements/text";var N=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,B=[],V=[`prefix`,`exact`],H=[`comfortable`,`compact`],U=[`neutral`,`primary`],W=[`default`,`brand`],ee=[`side`,`top`],G=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],te=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),K=e=>e>F?`${F}+`:String(e),ne=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),q=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:ne.format(/* @__PURE__ */ new Date)<=e},re=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},ie=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ k(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ k(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function ae(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,j),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:b,markDark:w,brandName:M,brandHref:N,brandLabel:P,sidebarStart:F,sidebarStartCompact:I,sidebarFooter:L,sidebarFooterItems:R=B,topbarStart:z,topbarEnd:V,footer:te,launcher:K,children:ne,collapsed:q,onCollapsedChange:ae,noSidebar:J=!1,nav:Y=`side`,density:se=`comfortable`,itemHeight:ce,iconVariant:X=`twotone`,topbarTone:he=`neutral`,tone:ve=`default`,navLabel:be=c.navLabel,linkComponent:Z,currentPath:xe,rememberCollapsed:Se=!1,collapsedCookie:Ce=`wui-shell-collapsed`,foldedCookie:we=r,tabBarLabel:Te=c.tabBarLabel,moreLabel:Ee=c.moreLabel,skipLabel:De=c.skipLabel,openNavLabel:Oe=c.openNavLabel,expandNavLabel:ke=c.expandNavLabel,collapseNavLabel:Ae=c.collapseNavLabel,newLabel:je=c.newLabel,togglePagesLabel:Me=c.togglePagesLabel,accountMenuLabel:Ne=c.accountMenuLabel,roleLabel:Pe=c.roleLabel,rolesLabel:Fe=c.rolesLabel,unreadLabel:Ie=c.unreadLabel,markAllReadLabel:Le=c.markAllReadLabel,viewAllLabel:Re=c.viewAllLabel,loadingNotificationsText:ze=c.loadingNotificationsText,noUnreadText:Be=c.noUnreadText,unreadNotificationsText:Ve=c.unreadNotificationsText,unreadBellLabel:He=c.unreadBellLabel,searchResultsLabel:Ue=c.searchResultsLabel,noResultsText:We=c.noResultsText,noResultsForText:Ge=c.noResultsForText,resultsCountText:Ke=c.resultsCountText,resultCountText:qe=c.resultCountText,userMenu:Je,notifications:Ye,search:Xe,className:Ze=``,style:Qe,...$e}=n;if(v(`AppShell`,$e),_(`AppShell`,`density`,se,H),_(`AppShell`,`topbarTone`,he,U),_(`AppShell`,`tone`,ve,W),_(`AppShell`,`nav`,Y,ee),_(`AppShell`,`iconVariant`,X,G),P!==void 0&&!N)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(N){if(!P&&!M)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||b||w))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let et=(ce??0)>0?{...Qe,"--wui-nav-item-height":`${ce}px`}:Qe,[tt,nt]=D(()=>Se&&q===void 0&&typeof document<`u`?a(Ce)??!1:!1),[rt,Q]=D(!1),it=E(null),[at,ot]=D(!1),[st,ct]=D(!1),lt=E(null),ut=q??tt,dt=e=>N?/* @__PURE__ */ k(de,{href:N,label:P||M,linkComponent:Z,onNavigate:()=>Q(!1),children:e}):e,ft=()=>{let e=!ut;q===void 0&&nt(e),Se&&s(e,Ce),ae?.(e)},pt=l.some(e=>e.collapsible),[mt,ht]=D(()=>pt&&typeof document<`u`?i(we):/* @__PURE__ */ new Set),gt=e=>{let t=new Set(mt);t.has(e)?t.delete(e):t.add(e),ht(t),o(t,we)},_t=T(()=>oe(l,R,xe),[l,R,xe]),$=_t.groups,vt=_t.footer,yt=J?null:le($,vt.some(e=>e.active));C(()=>{let e=()=>ot(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),C(()=>{y()},[]),C(()=>{x(lt.current)},[]),C(()=>{let e=lt.current;if(!e)return;let t=()=>ct($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),C(()=>{let e=it.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),C(()=>{let e=it.current;e?.hasAttribute(`popover`)&&S(e,rt)},[rt]);let bt=[`app-shell`,ut?`collapsed`:``,J?`no-sidebar`:``,Y===`top`?`wui-shell-top`:``,rt?`mobile-open`:``,Ze].filter(Boolean).join(` `);return/* @__PURE__ */ A(`div`,{className:bt,"data-density":se===`compact`?`compact`:void 0,"data-shell-tone":ve===`brand`?`brand`:void 0,"data-wui-folded-cookie":pt?we:void 0,style:et,...t,...$e,children:[/* @__PURE__ */ k(`a`,{className:`wui-skip-link`,href:`#main-content`,children:De}),/* @__PURE__ */ A(`aside`,{className:`app-sidebar`,ref:it,children:[(d||p||m||b||w)&&/* @__PURE__ */ k(`div`,{className:re({logoLight:p,logoDark:m,markLight:b,markDark:w}),children:dt(/* @__PURE__ */ A(O,{children:[ie({logoLight:p,logoDark:m,markLight:b,markDark:w,brandName:M}),d]}))}),F&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start`,children:F}),I&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start-compact`,children:I}),/* @__PURE__ */ k(`nav`,{className:`app-sidebar-scroll`,"aria-label":be,ref:lt,tabIndex:st?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ k(me,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label):/* @__PURE__ */ k(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ A(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!mt.has(e.key??``)||!!pe(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ A(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>gt(e.key??``),children:[/* @__PURE__ */ k(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ k(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ A(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(L||vt.length>0)&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-foot`,children:[vt.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-sidebar-foot-links`,children:vt.map(e=>/* @__PURE__ */ k(me,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label))}),L]}),!J&&/* @__PURE__ */ k(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ft,"aria-label":ut?ke:Ae,"aria-expanded":!ut,children:/* @__PURE__ */ k(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ A(`div`,{className:`app-main`,children:[/* @__PURE__ */ A(`header`,{className:`app-topbar${at?` wui-scrolled`:``}`,"data-tone":he===`primary`?`primary`:void 0,children:[/* @__PURE__ */ A(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":Oe,"aria-expanded":rt,children:/* @__PURE__ */ k(h,{name:`menu`,size:18})}),Y===`top`&&d&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-brand`,children:dt(d)}),Y===`top`&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ k(g,{items:ue($),ariaLabel:be,linkComponent:Z})}),z,Xe&&/* @__PURE__ */ k(ye,{config:Xe,searchResultsLabel:Ue,noResultsText:We,noResultsForText:Ge,resultsCountText:Ke,resultCountText:qe,moreLabel:Ee})]}),/* @__PURE__ */ A(`div`,{className:`app-topbar-end`,children:[V,Ye&&/* @__PURE__ */ k(_e,{config:Ye,unreadLabel:Ie,markAllReadLabel:Le,viewAllLabel:Re,loadingNotificationsText:ze,noUnreadText:Be,unreadNotificationsText:Ve,unreadBellLabel:He}),Je&&/* @__PURE__ */ k(ge,{config:Je,linkComponent:Z,accountMenuLabel:Ne,roleLabel:Pe,rolesLabel:Fe})]})]}),/* @__PURE__ */ k(`main`,{className:`app-content`,id:`main-content`,children:ne}),te&&/* @__PURE__ */ k(`footer`,{className:`app-footer`,children:te})]}),K&&/* @__PURE__ */ k(`div`,{className:`wui-shell-launcher`,children:K}),yt&&/* @__PURE__ */ A(`nav`,{className:`wui-tabbar`,"aria-label":Te,children:[yt.tabs.map(e=>/* @__PURE__ */ k(fe,{tab:e,linkComponent:Z,iconVariant:X},e.key??e.href)),yt.hasMore&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-tabbar-item${yt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ k(h,{name:`more`,size:24})}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:Ee})]})]})]})}function oe(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&X(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>Y(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:z,items:t}].map(e=>({...e,items:se(a(e.items,!0))})).filter(e=>e.items.some(e=>!Y(e))),s=[],c=e=>{for(let t of e)Y(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,J(e)),_(`AppShell`,`match`,e.match,V),_(`AppShell`,`iconVariant`,e.iconVariant,G),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==z),footer:o.find(e=>e.key===z)?.items??[]}}function J(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!te.has(e)))}var Y=e=>e.header!=null;function se(e){return e.filter((t,n)=>{if(!Y(t))return!0;let r=e.findIndex((e,t)=>t>n&&Y(e));return e.slice(n+1,r<0?void 0:r).length>0})}var ce=/* @__PURE__ */ new Set;function X(t){if(t.key!=null&&R.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||ce.has(n)||(ce.add(n),e(n))}function le(e,t){let n=[],r=e=>{for(let t of e)Y(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?I:L;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function ue(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>Y(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(Y(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function de({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ k(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function fe({tab:e,linkComponent:n,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:i,"aria-current":o,children:a})}function pe(e){for(let t of e){if(t.active)return t;let e=t.children?.length?pe(t.children):void 0;if(e)return e}}function me({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s}){let l=i>0,u=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,d=Array.isArray(e.children)&&e.children.length>0,f=d?pe(e.children??[]):void 0,p=!!f,m=f?f.key??f.href??f.label:null,[g,_]=D(p);C(()=>{m!=null&&_(!0)},[m]);let v=typeof e.label==`string`?e.label:void 0,y=!l&&e.icon&&/* @__PURE__ */ k(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),b=e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),x=q(e.newUntil)&&/* @__PURE__ */ k(`span`,{className:`wui-nav-new`,children:o}),S=/* @__PURE__ */ A(O,{children:[y,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),x,b,e.trailingIcon&&/* @__PURE__ */ k(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ k(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(d){let d=/* @__PURE__ */ k(`div`,{className:`app-nav-sub${g?` expanded`:``}`,inert:!g,"aria-hidden":!g||void 0,children:/* @__PURE__ */ k(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ k(me,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":w,onClick:r,children:S});return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`div`,{className:`app-nav-item has-children wui-nav-split${l?` app-nav-subitem`:``}${p||e.active?` active`:``}${u}`,"data-label":v,children:[i,/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":g,"aria-label":M(s,{name:v??``}),onClick:()=>_(e=>!e),children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),d]})}return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-item${l?` app-nav-subitem`:``} has-children${p?` active`:``}${u}`,"aria-expanded":g,"data-label":v,onClick:()=>_(e=>!e),children:[y,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),x,b,/* @__PURE__ */ k(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),d]})}let T=`app-nav-item${l?` app-nav-subitem`:``}${e.active?` active`:``}${u}`;return/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:T,"aria-current":w,"data-label":v,onClick:r,children:S})}function he(e){l(`wui-dropdown`,P);let[t,n]=D(!1),r=E(null);return C(()=>{r.current?.toggleAttribute(`open`,t)},[t]),C(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ge({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,j),s=w(),{open:l,setOpen:d,ref:f}=he(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:T=o.profileLabel,onLogout:E,logoutAction:D,logoutLabel:N=o.logoutLabel,head:P,section:F,logoutVariant:I=`item`,items:L=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,I,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let R=y.map(e=>(e??``).trim()).filter(Boolean),z=()=>d(!1),B=(e,r,i,a)=>/* @__PURE__ */ k(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),V=/* @__PURE__ */ k(h,{name:`log-out`,size:18}),H=/* @__PURE__ */ A(O,{children:[V,N]});return/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":M(r,{name:g}),children:[/* @__PURE__ */ k(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ A(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ k(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ k(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ k(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ A(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-role`,children:v}),R.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-roles-label`,children:R.length===1?i:a}),` ${R.join(`, `)}`]}),P?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-extra`,children:P}):null]})]}),F?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-section`,children:F}):null,C&&B(C,/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(h,{name:`user`,size:18}),T]}),void 0,z),L.map(e=>{if(e.divider)return/* @__PURE__ */ k(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),z()};return e.href?B(e.href,t,e.key,n):/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),I===`button`?(D||E)&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ k(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,children:N})}):/* @__PURE__ */ k(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,onClick:()=>{z(),E?.()},children:N})}):D?/* @__PURE__ */ k(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(`button`,{type:`submit`,className:`dropdown-item danger`,children:H})}):E&&/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{z(),E()},children:H})]})]})}function _e({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,j),l=w(),{open:d,ref:f}=he(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=D(``),T=E(p);C(()=>{T.current!==p&&(T.current=p,S(p===0?a:M(o,{count:K(p)})))},[p,a,o]);let N=null;return m?.length?N=/* @__PURE__ */ k(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ A(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ k(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ k(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ k(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ k(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?N=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:i}):m&&(N=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:M(s,{label:y,count:K(p)}),children:[/* @__PURE__ */ k(h,{name:`notification`,size:20}),/* @__PURE__ */ k(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:K(p)})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ A(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ k(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:N}),v&&/* @__PURE__ */ k(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var ve=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ye({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,N);let s=u(`shell`,j),c=w(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder}=e,[x,S]=D(!1),[O,P]=D(!1),[F,I]=D({results:null,index:-1}),L=F.results===p?F.index:-1,R=e=>I({results:p,index:e}),z=E(null),B=E(null),V=E([]),H=T(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),U=p!=null&&!O,W=H.length;C(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ve(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),S(!0),B.current?.focus())},t=e=>{z.current?.contains(e.target instanceof Node?e.target:null)||(P(!0),S(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ee=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!U||W===0)return;e.preventDefault(),R((L+(e.key===`ArrowDown`?1:-1)+W)%W)}else b(e.nativeEvent)?U&&L>=0&&V.current[L]?(e.preventDefault(),V.current[L].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(U?(e.preventDefault(),P(!0)):x&&(e.preventDefault(),S(!1)))},G=-1;return V.current=[],/* @__PURE__ */ k(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ k(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ A(`div`,{className:`wui-topsearch${x?` is-open`:``}${m?` is-loading`:``}`,ref:z,"data-overflow-label":y,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":x,"aria-controls":`${c}-panel`,onClick:()=>{let e=!x;S(e),e&&B.current?.focus()},children:/* @__PURE__ */ k(h,{name:`search`,size:20})}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ A(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ k(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ k(`input`,{ref:B,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y,"aria-label":y,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":U,"aria-controls":`${c}-list`,"aria-activedescendant":U&&L>=0?`${c}-opt-${L}`:void 0,autoComplete:`off`,value:d,onChange:e=>{P(!1),f?.(e.target.value)},onKeyDown:ee,onFocus:v})]}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!U,children:U&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[W===0&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:M(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{G+=1;let t=G;return/* @__PURE__ */ A(`a`,{className:`wui-topsearch-hit${t===L?` is-active`:``}`,role:`option`,"aria-selected":t===L,id:`${c}-opt-${t}`,href:e.href,ref:e=>{V.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:U?W===0?n:M(W===1?a:i,{count:W}):``})]})})})}export{ae as default};
@@ -1 +1 @@
1
- import{shortcutChip as e}from"../lib/shortcutChip.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./warnUnknownProps.js";import{SHORTCUT_EVENT as a,SHORTCUT_TEXT as o,shortcutKey as s}from"@webority/ui-elements/helpers";import{useEffect as c,useId as l,useRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=`wui-shortcuts-open-change`,m=()=>import(`@webority/ui-elements/elements/shortcuts`);function h(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=r.group?.trim(),i=e?n.get(e):void 0;e?i?i.rows.push(r):n.set(e,{title:e,rows:[r]}):t.push(r)}return[{title:null,rows:t},...n.values()].filter(e=>e.rows.length>0)}function g(e){return/* @__PURE__ */ d(`dl`,{className:`wui-shortcut-keys`,children:e.map(e=>/* @__PURE__ */ f(`div`,{"data-shortcut":s(e.key),children:[/* @__PURE__ */ d(`dt`,{children:/* @__PURE__ */ d(`kbd`,{className:`wui-kbd`,children:s(e.key)})}),/* @__PURE__ */ d(`dd`,{children:e.label})]},s(e.key)))})}function _(_){t(`wui-shortcuts`,m);let{marker:v,props:y}=n(`AppShortcutLegend`,{..._}),{shortcuts:b=[],items:x,search:S,open:C,onOpenChange:w,trigger:T=!0,className:E=``,...D}=y;i(`AppShortcutLegend`,D);let O=l(),k=u(null),A=b.filter(e=>s(e.key)!==`?`),j=h(A),M={key:`?`,label:o.help},N=j.at(-1);N?N.rows.push(M):j.push({title:null,rows:[M]});let P=j.find(e=>!e.title),F=j.filter(e=>e.title),I=u(A);I.current=A,c(()=>{let e=k.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:shortcut arrived without a detail`);let t=e.detail,n=I.current.find(e=>s(e.key)===t.key&&typeof e.onPress==`function`);n?.onPress&&(e.preventDefault(),n.onPress(t.itemKey))};return e.addEventListener(a,t),()=>e.removeEventListener(a,t)},[]);let L=u(w);return L.current=w,c(()=>{let e=k.current;if(!e)return;let t=t=>{if(!(t instanceof CustomEvent)||t.target!==e)return;let n=t.detail;L.current?.(n.open)};return e.addEventListener(p,t),()=>e.removeEventListener(p,t)},[]),/* @__PURE__ */ f(`wui-shortcuts`,{ref:k,class:[`wui-shortcut-legend`,E].filter(Boolean).join(` `),items:x||void 0,search:S||void 0,open:C,"no-trigger":T?void 0:``,...v,...D,children:[T&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-shortcut-toggle`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-controls":O,"aria-keyshortcuts":`?`,children:[e(`?`),` ${o.title}`]}),/* @__PURE__ */ f(`div`,{className:`wui-shortcut-sheet`,id:O,role:`dialog`,"aria-label":o.title,hidden:!0,children:[/* @__PURE__ */ f(`div`,{className:`wui-shortcut-sheet-head`,children:[/* @__PURE__ */ d(`span`,{className:`wui-shortcut-sheet-title`,children:o.title}),/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-shortcut-close`,"aria-label":o.close,children:/* @__PURE__ */ d(r,{name:`x`,size:16})})]}),P&&g(P.rows),F.map(e=>/* @__PURE__ */ f(`section`,{className:`wui-shortcut-group`,children:[/* @__PURE__ */ d(`h3`,{className:`wui-shortcut-group-title`,children:e.title}),g(e.rows)]},e.title))]})]})}export{_ as default};
1
+ import{shortcutChip as e}from"../lib/shortcutChip.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./warnUnknownProps.js";import{SHORTCUT_EVENT as o,shortcutKey as s}from"@webority/ui-elements/helpers";import{useEffect as c,useId as l,useRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{SHORTCUT_KEYS_TEXT as p}from"@webority/ui-elements/text";var m=`wui-shortcuts-open-change`,h=()=>import(`@webority/ui-elements/elements/shortcuts`);function g(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=r.group?.trim(),i=e?n.get(e):void 0;e?i?i.rows.push(r):n.set(e,{title:e,rows:[r]}):t.push(r)}return[{title:null,rows:t},...n.values()].filter(e=>e.rows.length>0)}function _(e){return/* @__PURE__ */ d(`dl`,{className:`wui-shortcut-keys`,children:e.map(e=>/* @__PURE__ */ f(`div`,{"data-shortcut":s(e.key),children:[/* @__PURE__ */ d(`dt`,{children:/* @__PURE__ */ d(`kbd`,{className:`wui-kbd`,children:s(e.key)})}),/* @__PURE__ */ d(`dd`,{children:e.label})]},s(e.key)))})}function v(v){t(`wui-shortcuts`,h);let{marker:y,props:b}=r(`AppShortcutLegend`,{...v}),x=n(`shortcutKeys`,p),{shortcuts:S=[],items:C,search:w,open:T,onOpenChange:E,trigger:D=!0,className:O=``,...k}=b;a(`AppShortcutLegend`,k);let A=l(),j=u(null),M=S.filter(e=>s(e.key)!==`?`),N=g(M),P={key:`?`,label:x.helpLabel},F=N.at(-1);F?F.rows.push(P):N.push({title:null,rows:[P]});let I=N.find(e=>!e.title),L=N.filter(e=>e.title),R=u(M);R.current=M,c(()=>{let e=j.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:shortcut arrived without a detail`);let t=e.detail,n=R.current.find(e=>s(e.key)===t.key&&typeof e.onPress==`function`);n?.onPress&&(e.preventDefault(),n.onPress(t.itemKey))};return e.addEventListener(o,t),()=>e.removeEventListener(o,t)},[]);let z=u(E);return z.current=E,c(()=>{let e=j.current;if(!e)return;let t=t=>{if(!(t instanceof CustomEvent)||t.target!==e)return;let n=t.detail;z.current?.(n.open)};return e.addEventListener(m,t),()=>e.removeEventListener(m,t)},[]),/* @__PURE__ */ f(`wui-shortcuts`,{ref:j,class:[`wui-shortcut-legend`,O].filter(Boolean).join(` `),items:C||void 0,search:w||void 0,open:T,"no-trigger":D?void 0:``,...y,...k,children:[D&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-shortcut-toggle`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-controls":A,"aria-keyshortcuts":`?`,children:[e(`?`),` ${x.sheetTitle}`]}),/* @__PURE__ */ f(`div`,{className:`wui-shortcut-sheet`,id:A,role:`dialog`,"aria-label":x.sheetTitle,hidden:!0,children:[/* @__PURE__ */ f(`div`,{className:`wui-shortcut-sheet-head`,children:[/* @__PURE__ */ d(`span`,{className:`wui-shortcut-sheet-title`,children:x.sheetTitle}),/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-shortcut-close`,"aria-label":x.closeLabel,children:/* @__PURE__ */ d(i,{name:`x`,size:16})})]}),I&&_(I.rows),L.map(e=>/* @__PURE__ */ f(`section`,{className:`wui-shortcut-group`,children:[/* @__PURE__ */ d(`h3`,{className:`wui-shortcut-group-title`,children:e.title}),_(e.rows)]},e.title))]})]})}export{v as default};
@@ -1 +1 @@
1
- import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{isElementDefined as r}from"@webority/ui-elements/helpers";import{useId as i,useLayoutEffect as a,useRef as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=()=>import(`@webority/ui-elements/elements/show-more`);function u(u){e(`wui-show-more`,l);let{marker:d,props:f}=t(`AppShowMore`,{...u}),{children:p,lines:m=3,moreLabel:h=`Show more`,lessLabel:g=`Show less`,defaultExpanded:_=!1,id:v,className:y=``,...b}=f;n(`AppShowMore`,b);let x=i(),S=v||`show-more-${x.replace(/:/g,``)}`,C=`${S}-body`,w=o(null),T=o(_);return a(()=>{if(T.current){if(!w.current)throw Error(`<AppShowMore> element was not mounted before layout`);r(`wui-show-more`)?w.current.toggle(!0):w.current.setAttribute(`expanded`,``)}},[]),/* @__PURE__ */ c(`wui-show-more`,{ref:w,class:[`wui-show-more`,y].filter(Boolean).join(` `),id:S,lines:m===3?void 0:String(m),"more-label":h===`Show more`?void 0:h,"less-label":g===`Show less`?void 0:g,...d,...b,children:[/* @__PURE__ */ s(`div`,{className:`wui-show-more-body`,id:C,children:p}),/* @__PURE__ */ s(`button`,{type:`button`,className:`btn btn-link btn-sm wui-show-more-toggle`,"aria-expanded":T.current?`true`:`false`,"aria-controls":C,hidden:!0,children:T.current?g:h})]})}export{u as default};
1
+ import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./warnUnknownProps.js";import{isElementDefined as i}from"@webority/ui-elements/helpers";import{useId as a,useLayoutEffect as o,useRef as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{SHOW_MORE_TEXT as u}from"@webority/ui-elements/text";var d=()=>import(`@webority/ui-elements/elements/show-more`);function f(f){e(`wui-show-more`,d);let{marker:p,props:m}=n(`AppShowMore`,{...f}),h=t(`showMore`,u),{children:g,lines:_=3,moreLabel:v=h.moreLabel,lessLabel:y=h.lessLabel,defaultExpanded:b=!1,id:x,className:S=``,...C}=m;r(`AppShowMore`,C);let w=a(),T=x||`show-more-${w.replace(/:/g,``)}`,E=`${T}-body`,D=s(null),O=s(b);return o(()=>{if(O.current){if(!D.current)throw Error(`<AppShowMore> element was not mounted before layout`);i(`wui-show-more`)?D.current.toggle(!0):D.current.setAttribute(`expanded`,``)}},[]),/* @__PURE__ */ l(`wui-show-more`,{ref:D,class:[`wui-show-more`,S].filter(Boolean).join(` `),id:T,lines:_===3?void 0:String(_),"more-label":v===h.moreLabel?void 0:v,"less-label":y===h.lessLabel?void 0:y,...p,...C,children:[/* @__PURE__ */ c(`div`,{className:`wui-show-more-body`,id:E,children:g}),/* @__PURE__ */ c(`button`,{type:`button`,className:`btn btn-link btn-sm wui-show-more-toggle`,"aria-expanded":O.current?`true`:`false`,"aria-controls":E,hidden:!0,children:O.current?y:v})]})}export{f as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import te,{readRange as o,writeNumberValue as s}from"./useWuiControl.js";import ne from"./warnUnknownProps.js";import{forwardRef as c,useEffect as re,useId as ie,useRef as ae}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var oe=[`sm`,`md`,`lg`],d=[`none`,`indian`],f=()=>import(`@webority/ui-elements/elements/slider`),p=(e,t)=>s(e,typeof t==`number`||typeof t==`string`?t:void 0),m=c(function(s,c){let{marker:m,props:h}=ee(`AppSlider`,s),{value:g,start:_,end:v,range:se=!1,onChange:ce,label:y,required:b=!1,optional:le=!1,helperText:x,error:ue,name:S,startName:C,endName:w,min:T=0,max:E=100,step:D=1,disabled:O,readOnly:k=!1,loading:A=!1,defaultValue:j,defaultStart:M,defaultEnd:N,size:P,showValue:F,unit:I,grouping:L=`none`,id:R,ariaLabel:z,className:B=``,fieldClassName:V=``,help:H,helpLabel:U=`More information`,optionalLabel:de=`(optional)`,...W}=h,fe=t(S),pe=t(C),me=t(w),G=ue??fe??pe??me;ne(`AppSlider`,W),a(`AppSlider`,`size`,P,oe),a(`AppSlider`,`grouping`,L,d);let he=n(`wui-slider`,f),ge=ie(),K=R||ge,q=se,{setRef:_e,innerRef:J}=te({ready:he,ref:e=>{typeof c==`function`?c(e):c&&(c.current=e)},value:q?void 0:g,onChange:q?e=>{s.range&&s.onChange?.(e)}:e=>{s.range||s.onChange?.(e)},readValue:q?o:void 0,writeValue:q?void 0:p}),Y=ae(!1);re(()=>{if(!q)return;let e=J.current;if(!e)return;let t=_===void 0?Y.current?void 0:M:_,n=v===void 0?Y.current?void 0:N:v;Y.current=!0,t!==void 0&&t>e.end?(n!==void 0&&e.end!==n&&(e.end=n),t!==void 0&&e.start!==t&&(e.start=t)):(t!==void 0&&e.start!==t&&(e.start=t),n!==void 0&&e.end!==n&&(e.end=n))},[_,v,M,N,q,J]);let X=!y&&!G&&!x,Z=G?`${K}-error`:void 0,Q=x?`${K}-hint`:void 0,$=/* @__PURE__ */ l(`wui-slider`,{ref:_e,id:K,name:S||void 0,"start-name":C||void 0,"end-name":w||void 0,min:T,max:E,step:D,size:P||void 0,value:(g??j)!=null&&!q?String(g??j):void 0,"aria-label":z||(typeof y==`string`?y:void 0),"aria-describedby":Z||Q,"aria-invalid":G?`true`:void 0,disabled:O?``:void 0,readonly:k?``:void 0,loading:A?``:void 0,required:b?``:void 0,range:q?``:void 0,"show-value":F?``:void 0,unit:I||void 0,grouping:L===`indian`?L:void 0,className:B||void 0,...X?m:null,...W});return X?$:/* @__PURE__ */ u(`div`,{...m,className:`field${V?` ${V}`:``}`,children:[y&&/* @__PURE__ */ u(`label`,{className:`label`,htmlFor:K,children:[y,le&&!b&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${de}`}),b&&/* @__PURE__ */ l(i,{}),H&&/* @__PURE__ */ l(r,{label:U,children:H})]}),$,/* @__PURE__ */ l(e,{error:G,hint:x,errorId:Z,hintId:Q})]})});export{m as default};
1
+ import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import i from"./assertValidValue.js";import a,{readRange as o,writeNumberValue as s}from"./useWuiControl.js";import re from"./warnUnknownProps.js";import{forwardRef as c,useEffect as ie,useId as l,useRef as ae}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{SLIDER_TEXT as oe}from"@webority/ui-elements/text";var se=[`sm`,`md`,`lg`],f=[`none`,`indian`],p=()=>import(`@webority/ui-elements/elements/slider`),ce=(e,t)=>s(e,typeof t==`number`||typeof t==`string`?t:void 0),m=c(function(s,c){let{marker:m,props:h}=r(`AppSlider`,s),g=ee(`slider`,oe),{value:_,start:v,end:y,range:le=!1,onChange:ue,label:b,required:x=!1,optional:de=!1,helperText:S,error:fe,name:C,startName:w,endName:T,min:E=0,max:D=100,step:O=1,disabled:k,readOnly:A=!1,loading:j=!1,defaultValue:M,defaultStart:N,defaultEnd:P,size:F,showValue:I,unit:L,grouping:R=`none`,id:z,ariaLabel:pe,className:B=``,fieldClassName:V=``,help:H,helpLabel:me=g.helpLabel,optionalLabel:he=g.optionalLabel,...U}=h,ge=t(C),_e=t(w),ve=t(T),W=fe??ge??_e??ve;re(`AppSlider`,U),i(`AppSlider`,`size`,F,se),i(`AppSlider`,`grouping`,R,f);let ye=n(`wui-slider`,p),be=l(),G=z||be,K=le,{setRef:q,innerRef:J}=a({ready:ye,ref:e=>{typeof c==`function`?c(e):c&&(c.current=e)},value:K?void 0:_,onChange:K?e=>{s.range&&s.onChange?.(e)}:e=>{s.range||s.onChange?.(e)},readValue:K?o:void 0,writeValue:K?void 0:ce}),Y=ae(!1);ie(()=>{if(!K)return;let e=J.current;if(!e)return;let t=v===void 0?Y.current?void 0:N:v,n=y===void 0?Y.current?void 0:P:y;Y.current=!0,t!==void 0&&t>e.end?(n!==void 0&&e.end!==n&&(e.end=n),t!==void 0&&e.start!==t&&(e.start=t)):(t!==void 0&&e.start!==t&&(e.start=t),n!==void 0&&e.end!==n&&(e.end=n))},[v,y,N,P,K,J]);let X=!b&&!W&&!S,Z=W?`${G}-error`:void 0,Q=S?`${G}-hint`:void 0,$=/* @__PURE__ */ u(`wui-slider`,{ref:q,id:G,name:C||void 0,"start-name":w||void 0,"end-name":T||void 0,min:E,max:D,step:O,size:F||void 0,value:(_??M)!=null&&!K?String(_??M):void 0,"aria-label":pe||(typeof b==`string`?b:void 0),"aria-describedby":Z||Q,"aria-invalid":W?`true`:void 0,disabled:k?``:void 0,readonly:A?``:void 0,loading:j?``:void 0,required:x?``:void 0,range:K?``:void 0,"show-value":I?``:void 0,unit:L||void 0,grouping:R===`indian`?R:void 0,className:B||void 0,...X?m:null,...U});return X?$:/* @__PURE__ */ d(`div`,{...m,className:`field${V?` ${V}`:``}`,children:[b&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:G,children:[b,de&&!x&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${he}`}),x&&/* @__PURE__ */ u(ne,{}),H&&/* @__PURE__ */ u(te,{label:me,children:H})]}),$,/* @__PURE__ */ u(e,{error:W,hint:S,errorId:Z,hintId:Q})]})});export{m as default};
@@ -1 +1 @@
1
- import e from"../lib/fillLabel.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{forwardRef as s,useEffect as c,useRef as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`vertical`,`horizontal`],p=[`always`,`hover`],m=()=>import(`@webority/ui-elements/elements/sortable`),h=e=>`order`in e,g=(e,t)=>{if(!h(e))throw TypeError(`<AppSortableList> wrote its order before <wui-sortable> upgraded.`);e.controlled=!0;let n=e.order;(n.length!==t.length||t.some((e,t)=>e!==n[t]))&&(e.order=t)},_=s(function(s,h){let _=t(`wui-sortable`,m),{marker:v,props:y}=n(`AppSortableList`,s),{items:b=[],onReorder:x,ariaLabel:S,handle:C=!1,group:w,name:T,disabled:E=!1,orientation:D=`vertical`,handleDisplay:O=`always`,bordered:k=!0,className:A=``,reorderLabel:j=`Reorder {name}`,...M}=y;o(`AppSortableList`,M),i(`AppSortableList`,`orientation`,D,f),i(`AppSortableList`,`handleDisplay`,O,p);let N=O===`hover`,P=b.map(e=>e.id),F=l(P);c(()=>{F.current=P});let{setRef:I,innerRef:L}=a({ready:_,ref:h,value:P,writeValue:g,on:{"wui-sortable:change":e=>{if(e.target!==e.currentTarget)return;let t=e.detail;x?.(t.ids,t),requestAnimationFrame(()=>{let e=L.current;e&&g(e,F.current)})}}});return/* @__PURE__ */ u(`wui-sortable`,{ref:I,role:`list`,"aria-label":S,name:T||void 0,group:w||void 0,orientation:D===`horizontal`?`horizontal`:void 0,"handle-display":N?`hover`:void 0,handle:C||N?``:void 0,disabled:E?``:void 0,borderless:k?void 0:``,className:`wui-sortable${A?` ${A}`:``}`,...v,...M,children:b.map(t=>/* @__PURE__ */ d(`div`,{role:`listitem`,className:`wui-sortable-item`,"data-id":t.id,"data-label":t.label,"data-disabled":t.disabled?``:void 0,children:[/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-sortable-handle`,"aria-label":e(j,{name:t.label}),disabled:E||t.disabled?!0:void 0,children:/* @__PURE__ */ u(r,{name:`menu`,size:18})}),/* @__PURE__ */ u(`div`,{className:`wui-sortable-body`,children:t.content??t.label})]},t.id))})});export{_ as default};
1
+ import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{forwardRef as s,useEffect as c,useRef as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{SORTABLE_LIST_TEXT as f,fillText as p}from"@webority/ui-elements/text";var m=[`vertical`,`horizontal`],h=[`always`,`hover`],g=()=>import(`@webority/ui-elements/elements/sortable`),_=e=>`order`in e,v=(e,t)=>{if(!_(e))throw TypeError(`<AppSortableList> wrote its order before <wui-sortable> upgraded.`);e.controlled=!0;let n=e.order;(n.length!==t.length||t.some((e,t)=>e!==n[t]))&&(e.order=t)},y=s(function(s,_){let y=e(`wui-sortable`,g),{marker:b,props:x}=n(`AppSortableList`,s),S=t(`sortableList`,f),{items:C=[],onReorder:w,ariaLabel:T,handle:E=!1,group:D,name:O,disabled:k=!1,orientation:A=`vertical`,handleDisplay:j=`always`,bordered:M=!0,className:N=``,reorderLabel:P=S.reorderLabel,...F}=x;o(`AppSortableList`,F),i(`AppSortableList`,`orientation`,A,m),i(`AppSortableList`,`handleDisplay`,j,h);let I=j===`hover`,L=C.map(e=>e.id),R=l(L);c(()=>{R.current=L});let{setRef:z,innerRef:B}=a({ready:y,ref:_,value:L,writeValue:v,on:{"wui-sortable:change":e=>{if(e.target!==e.currentTarget)return;let t=e.detail;w?.(t.ids,t),requestAnimationFrame(()=>{let e=B.current;e&&v(e,R.current)})}}});return/* @__PURE__ */ u(`wui-sortable`,{ref:z,role:`list`,"aria-label":T,name:O||void 0,group:D||void 0,orientation:A===`horizontal`?`horizontal`:void 0,"handle-display":I?`hover`:void 0,handle:E||I?``:void 0,disabled:k?``:void 0,borderless:M?void 0:``,className:`wui-sortable${N?` ${N}`:``}`,...b,...F,children:C.map(e=>/* @__PURE__ */ d(`div`,{role:`listitem`,className:`wui-sortable-item`,"data-id":e.id,"data-label":e.label,"data-disabled":e.disabled?``:void 0,children:[/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-sortable-handle`,"aria-label":p(P,{name:e.label}),disabled:k||e.disabled?!0:void 0,children:/* @__PURE__ */ u(r,{name:`menu`,size:18})}),/* @__PURE__ */ u(`div`,{className:`wui-sortable-body`,children:e.content??e.label})]},e.id))})});export{y as default};