@webority/ui-react 0.178.4 → 0.180.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 (114) hide show
  1. package/dist/canvas-kit/kit.js +143 -143
  2. package/dist/canvas-kit/manifest.json +2583 -111
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/dist/components/AppAccordion.js +1 -1
  5. package/dist/components/AppAgenda.js +1 -0
  6. package/dist/components/AppAsyncBlock.js +1 -1
  7. package/dist/components/AppButton.js +1 -1
  8. package/dist/components/AppCalendar.js +1 -1
  9. package/dist/components/AppCalendarViews.js +1 -0
  10. package/dist/components/AppChangeList.js +1 -0
  11. package/dist/components/AppChart.js +1 -1
  12. package/dist/components/AppColorField.js +1 -1
  13. package/dist/components/AppCommandPalette.js +1 -1
  14. package/dist/components/AppDashboardCell.js +1 -1
  15. package/dist/components/AppDashboardGrid.js +1 -1
  16. package/dist/components/AppDashboardHeader.js +1 -0
  17. package/dist/components/AppDataTable.js +1 -1
  18. package/dist/components/AppDatePicker.js +1 -1
  19. package/dist/components/AppDateRangePicker.js +1 -1
  20. package/dist/components/AppDateTimePicker.js +1 -1
  21. package/dist/components/AppDescriptions.js +1 -1
  22. package/dist/components/AppDropdown.js +1 -1
  23. package/dist/components/AppEntryGrid.js +1 -1
  24. package/dist/components/AppFileViewer.js +1 -1
  25. package/dist/components/AppForm.js +1 -1
  26. package/dist/components/AppFormActions.js +1 -1
  27. package/dist/components/AppFormRow.js +1 -1
  28. package/dist/components/AppGantt.js +1 -1
  29. package/dist/components/AppInput.js +1 -1
  30. package/dist/components/AppKanban.js +1 -1
  31. package/dist/components/AppKpiTile.js +1 -1
  32. package/dist/components/AppListCard.js +1 -0
  33. package/dist/components/AppMentionInput.js +1 -1
  34. package/dist/components/AppMiniCalendar.js +1 -0
  35. package/dist/components/AppNavigationMenu.js +1 -1
  36. package/dist/components/AppNotificationCenter.js +1 -1
  37. package/dist/components/AppNumberInput.js +1 -1
  38. package/dist/components/AppOfflineBanner.js +1 -0
  39. package/dist/components/AppOtpInput.js +1 -1
  40. package/dist/components/AppPageHeader.js +1 -1
  41. package/dist/components/AppPhoneNumberInput.js +1 -1
  42. package/dist/components/AppQueueBundle.js +1 -0
  43. package/dist/components/AppResultBlock.js +1 -0
  44. package/dist/components/AppRouteError.js +1 -1
  45. package/dist/components/AppSearch.js +1 -1
  46. package/dist/components/AppSegmented.js +1 -1
  47. package/dist/components/AppSelect.js +1 -1
  48. package/dist/components/AppSettingRow.js +1 -0
  49. package/dist/components/AppSettingSection.js +1 -0
  50. package/dist/components/AppShell.js +1 -1
  51. package/dist/components/AppStepper.js +1 -1
  52. package/dist/components/AppTabs.js +1 -1
  53. package/dist/components/AppTextarea.js +1 -1
  54. package/dist/components/AppTimePicker.js +1 -1
  55. package/dist/components/AppWizard.js +1 -1
  56. package/dist/guidance.json +987 -9
  57. package/dist/lib/formStatusContext.js +1 -0
  58. package/dist/lib/useStickyLayer.js +1 -0
  59. package/dist/types/components/AppAccordion.d.ts +5 -3
  60. package/dist/types/components/AppAgenda.d.ts +69 -0
  61. package/dist/types/components/AppAsyncBlock.d.ts +5 -0
  62. package/dist/types/components/AppButton.d.ts +18 -2
  63. package/dist/types/components/AppCalendar.d.ts +14 -0
  64. package/dist/types/components/AppCalendarViews.d.ts +69 -0
  65. package/dist/types/components/AppChangeList.d.ts +30 -0
  66. package/dist/types/components/AppChart.d.ts +5 -0
  67. package/dist/types/components/AppColorField.d.ts +2 -0
  68. package/dist/types/components/AppCommandPalette.d.ts +12 -0
  69. package/dist/types/components/AppDashboardCell.d.ts +17 -1
  70. package/dist/types/components/AppDashboardGrid.d.ts +39 -5
  71. package/dist/types/components/AppDashboardHeader.d.ts +21 -0
  72. package/dist/types/components/AppDataTable.d.ts +28 -2
  73. package/dist/types/components/AppDatePicker.d.ts +2 -0
  74. package/dist/types/components/AppDateRangePicker.d.ts +2 -0
  75. package/dist/types/components/AppDescriptions.d.ts +2 -0
  76. package/dist/types/components/AppDropdown.d.ts +2 -2
  77. package/dist/types/components/AppEntryGrid.d.ts +15 -0
  78. package/dist/types/components/AppFileViewer.d.ts +7 -0
  79. package/dist/types/components/AppForm.d.ts +5 -0
  80. package/dist/types/components/AppFormActions.d.ts +28 -4
  81. package/dist/types/components/AppFormRow.d.ts +5 -0
  82. package/dist/types/components/AppGantt.d.ts +10 -2
  83. package/dist/types/components/AppInput.d.ts +5 -0
  84. package/dist/types/components/AppKanban.d.ts +4 -0
  85. package/dist/types/components/AppKpiTile.d.ts +14 -1
  86. package/dist/types/components/AppListCard.d.ts +32 -0
  87. package/dist/types/components/AppMentionInput.d.ts +2 -0
  88. package/dist/types/components/AppMiniCalendar.d.ts +78 -0
  89. package/dist/types/components/AppNavigationMenu.d.ts +10 -0
  90. package/dist/types/components/AppNotificationCenter.d.ts +20 -0
  91. package/dist/types/components/AppNumberInput.d.ts +7 -0
  92. package/dist/types/components/AppOfflineBanner.d.ts +28 -0
  93. package/dist/types/components/AppOtpInput.d.ts +2 -0
  94. package/dist/types/components/AppPhoneNumberInput.d.ts +7 -0
  95. package/dist/types/components/AppQueueBundle.d.ts +35 -0
  96. package/dist/types/components/AppResultBlock.d.ts +62 -0
  97. package/dist/types/components/AppRouteError.d.ts +76 -4
  98. package/dist/types/components/AppSearch.d.ts +3 -0
  99. package/dist/types/components/AppSegmented.d.ts +14 -0
  100. package/dist/types/components/AppSelect.d.ts +2 -0
  101. package/dist/types/components/AppSettingRow.d.ts +61 -0
  102. package/dist/types/components/AppSettingSection.d.ts +23 -0
  103. package/dist/types/components/AppShell.d.ts +10 -62
  104. package/dist/types/components/AppStepper.d.ts +6 -1
  105. package/dist/types/components/AppTabs.d.ts +5 -0
  106. package/dist/types/components/AppTextarea.d.ts +19 -0
  107. package/dist/types/components/AppTimePicker.d.ts +2 -0
  108. package/dist/types/components/AppWizard.d.ts +31 -2
  109. package/dist/types/index.d.ts +17 -2
  110. package/dist/types/lib/focusField.d.ts +1 -2
  111. package/dist/types/lib/formStatusContext.d.ts +15 -0
  112. package/dist/types/lib/useStickyLayer.d.ts +7 -0
  113. package/dist/ui-react.js +1 -1
  114. package/package.json +11 -11
@@ -1 +1 @@
1
- import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{createElement as r,useCallback as i,useEffect as a,useLayoutEffect as o,useRef as s,useState as c}from"react";import{createPortal as l}from"react-dom";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var p=`wui-file-viewer:load`,m=`wui-file-viewer:error`,h=`wui-file-viewer:prefs-change`,g=()=>import(`@webority/ui-elements/file-viewer`);function _({ref:_,...v}){let{marker:y,props:b}=t(`AppFileViewer`,v),{src:x,name:S,type:C,prefs:w,onPrefsChange:T,viewKey:E,download:D=!1,print:O=!0,workerSrc:k,assetBase:A,captions:j,actions:M,onLoad:N,onError:P,className:F=``,style:I,...L}=b;n(`AppFileViewer`,L);let R=e(`wui-file-viewer`,g),z=s(null),B=s(N),V=s(P),H=s(T),[U,W]=c(null),G=i(e=>{z.current=e,typeof _==`function`?_(e):_&&(_.current=e)},[_]);return o(()=>{if(!R||w===void 0)return;let e=z.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);e.prefs=w},[w,R]),a(()=>{B.current=N,V.current=P,H.current=T}),a(()=>{let e=z.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:load arrived without a CustomEvent`);B.current?.(e.detail)},n=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:error arrived without a CustomEvent`);V.current?.(e.detail)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:prefs-change arrived without a CustomEvent`);H.current?.(e.detail)};return e.addEventListener(p,t),e.addEventListener(m,n),e.addEventListener(h,r),()=>{e.removeEventListener(p,t),e.removeEventListener(m,n),e.removeEventListener(h,r)}},[]),a(()=>{if(!R)return;let e=z.current;e?.isConnected&&W(e.actionsContainer)},[R]),/* @__PURE__ */ f(u,{children:[r(`wui-file-viewer`,{ref:G,src:x,name:S||void 0,type:C||void 0,"view-key":E||void 0,download:D?``:void 0,print:O?void 0:`false`,"worker-src":k||void 0,"asset-base":A||void 0,captions:j||void 0,className:F||void 0,style:I,...y,...L}),U&&M!=null&&l(/* @__PURE__ */ d(`div`,{slot:`actions`,className:`wui-file-viewer-slot`,children:M}),U)]})}export{_ as default};
1
+ import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{createElement as r,useCallback as i,useEffect as a,useLayoutEffect as o,useRef as s,useState as c}from"react";import{createPortal as l}from"react-dom";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var p=`wui-file-viewer:load`,m=`wui-file-viewer:error`,h=`wui-file-viewer:prefs-change`,g=()=>import(`@webority/ui-elements/file-viewer`);function _({ref:_,...v}){let{marker:y,props:b}=t(`AppFileViewer`,v),{src:x,name:S,type:C,prefs:w,onPrefsChange:T,viewKey:E,download:D=!1,fill:O=!1,print:k=!0,workerSrc:A,assetBase:j,captions:M,actions:N,onLoad:P,onError:F,className:I=``,style:L,...R}=b;n(`AppFileViewer`,R);let z=e(`wui-file-viewer`,g),B=s(null),V=s(P),H=s(F),U=s(T),[W,G]=c(null),K=i(e=>{B.current=e,typeof _==`function`?_(e):_&&(_.current=e)},[_]);return o(()=>{if(!z||w===void 0)return;let e=B.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);e.prefs=w},[w,z]),a(()=>{V.current=P,H.current=F,U.current=T}),a(()=>{let e=B.current;if(!e)throw Error(`AppFileViewer: the viewer element is not mounted`);let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:load arrived without a CustomEvent`);V.current?.(e.detail)},n=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:error arrived without a CustomEvent`);H.current?.(e.detail)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-file-viewer:prefs-change arrived without a CustomEvent`);U.current?.(e.detail)};return e.addEventListener(p,t),e.addEventListener(m,n),e.addEventListener(h,r),()=>{e.removeEventListener(p,t),e.removeEventListener(m,n),e.removeEventListener(h,r)}},[]),a(()=>{if(!z)return;let e=B.current;e?.isConnected&&G(e.actionsContainer)},[z]),/* @__PURE__ */ f(u,{children:[r(`wui-file-viewer`,{ref:K,src:x,name:S||void 0,type:C||void 0,"view-key":E||void 0,download:D?``:void 0,fill:O?``:void 0,print:k?void 0:`false`,"worker-src":A||void 0,"asset-base":j||void 0,captions:M||void 0,className:I||void 0,style:L,...y,...R}),W&&N!=null&&l(/* @__PURE__ */ d(`div`,{slot:`actions`,className:`wui-file-viewer-slot`,children:N}),W)]})}export{_ as default};
@@ -1 +1 @@
1
- import{newIdempotencyKey as e}from"../web-core/dist/api/idempotencyKey.js";import t from"../lib/focusField.js";import{FormFieldsContext as n,toFieldName as r}from"../lib/formFields.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppConfirmDialog.js";import s from"./AppIcon.js";import c from"./warnUnknownProps.js";import{createContext as l,useCallback as u,useContext as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{UNSAVED_CHANGES_TEXT as v}from"@webority/ui-elements/text";var y=l(null);function b(){let e=d(y);if(e===null)throw Error(`useFormSubmit must be called inside an AppForm`);return e}var x=/* @__PURE__ */ new Set,S=/* @__PURE__ */ new Map;function C(l){let{marker:d,props:b}=a(`AppForm`,l),C=i(`unsavedChanges`,v),{onSubmit:w,onChange:T,className:ee,children:E,noValidate:D,action:O,method:k,encType:A,acceptCharset:j,fieldErrors:M,formErrors:te,unsavedChanges:N,unsavedChangesMessage:P,...F}=b;c(`AppForm`,F);let[I,L]=h(!1),[R,z]=h(e),B=m(!1),[V,H]=h(null),U=p(()=>new Map(Object.entries(M??{}).map(([e,t])=>[r(e),t])),[M]),W=JSON.stringify([...U].sort(([e],[t])=>e<t?-1:+(e>t))),[G,K]=h({key:W,names:x}),q=G.key===W?G.names:x,J=u(e=>{T?.(e);let t=e.target;if(!(t instanceof HTMLElement)||!(`name`in t)||typeof t.name!=`string`||t.name===``)return;let n=r(t.name);U.has(n)&&K(e=>{let t=e.key===W?e.names:x;return t.has(n)?e:{key:W,names:/* @__PURE__ */ new Set([...t,n])}})},[T,U,W]),[Y,X]=h(S),Z=u(e=>(X(t=>new Map(t).set(e,(t.get(e)??0)+1)),()=>{X(t=>{let n=new Map(t),r=(t.get(e)??0)-1;return r>0?n.set(e,r):n.delete(e),n})}),[]),Q=u(e=>q.has(e)?void 0:U.get(e),[q,U]),ne=p(()=>({errorOf:Q,claim:Z}),[Q,Z]),$=[.../* @__PURE__ */ new Set([...te??[],...[...U].filter(([e])=>!Y.has(e)).map(([,e])=>e)])],re=u(async t=>{if(t.preventDefault(),B.current)return;B.current=!0,L(!0);let n=t.currentTarget;try{let r=await w(t,{idempotencyKey:R});r!==!1&&z(e()),r!==!0&&H({form:n})}finally{B.current=!1,L(!1)}},[w,R]);f(()=>{if(V===null)return;let{form:e}=V;if(H(null),e.querySelector(`.wui-error-summary`)!==null)return;let n=[...e.querySelectorAll(`[name]`)].map(e=>e.getAttribute(`name`)).find(e=>e!==null&&U.has(r(e)));n!==void 0&&t(n)},[V,U]);let ie=p(()=>({submitting:I,idempotencyKey:R}),[I,R]);return/* @__PURE__ */ g(n,{value:ne,children:/* @__PURE__ */ _(y,{value:ie,children:[/* @__PURE__ */ _(`form`,{...d,...F,noValidate:D,action:O,method:k,encType:A,acceptCharset:j,className:ee,onChange:J,onSubmit:re,"aria-busy":I||void 0,children:[$.length>0?/* @__PURE__ */ _(`div`,{role:`alert`,className:`alert alert-danger alert-has-icon`,"data-wui-form-errors":``,children:[/* @__PURE__ */ g(`span`,{className:`alert-icon`,children:/* @__PURE__ */ g(s,{name:`x`,size:11})}),/* @__PURE__ */ g(`div`,{className:`alert-content`,children:$.length===1?$[0]:$.map(e=>/* @__PURE__ */ g(`div`,{children:e},e))})]}):null,E]}),N?.blocked?/* @__PURE__ */ g(o,{open:!0,title:C.title,description:P??C.message,confirmLabel:C.leaveLabel,onConfirm:N.discard,onClose:N.keep}):null]})})}export{y as FormSubmitContext,C as default,b as useFormSubmit};
1
+ import{newIdempotencyKey as e}from"../web-core/dist/api/idempotencyKey.js";import t from"../lib/focusField.js";import{FormFieldsContext as n,toFieldName as r}from"../lib/formFields.js";import{FormStatusContext as i}from"../lib/formStatusContext.js";import a from"../lib/useWuiText.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppConfirmDialog.js";import c from"./AppIcon.js";import l from"./assertValidValue.js";import{MODAL_ICONS as u}from"./ModalIcons.js";import d from"./warnUnknownProps.js";import{createContext as f,useCallback as p,useContext as m,useEffect as h,useMemo as g,useRef as ee,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{UNSAVED_CHANGES_TEXT as te}from"@webority/ui-elements/text";var b=f(null);function x(){let e=m(b);if(e===null)throw Error(`useFormSubmit must be called inside an AppForm`);return e}var S=/* @__PURE__ */ new Set,ne=/* @__PURE__ */ new Map,re=[`top`,`status`];function C(e,t,n){let r=t.id;return(r===``?void 0:[...e.querySelectorAll(`label[for]`)].find(e=>e.getAttribute(`for`)===r))?.textContent?.trim()||n}function ie(e,t){let n=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=[];for(let o of[...e.querySelectorAll(`[name]`)]){let s=o.getAttribute(`name`);if(s===null)continue;let c=r(s);if(!t.has(c)||n.has(c))continue;n.add(c);let l=o.closest(`section.form-section`),u=l?.querySelector(`:scope > .form-section-head > .form-section-title`)?.textContent?.trim(),d=l!==null&&u?l:o;i.has(d)||(i.add(d),a.push({label:u||C(e,o,s),fieldName:s}))}return n.size===0?null:{errorCount:n.size,links:a}}function w(f){let{marker:m,props:x}=o(`AppForm`,f),C=a(`unsavedChanges`,te),{onSubmit:w,onChange:T,className:ae,children:E,noValidate:D,action:O,method:k,encType:A,acceptCharset:j,fieldErrors:M,formErrors:oe,unsavedChanges:N,unsavedChangesMessage:se,errorSummary:P,...F}=x;d(`AppForm`,F),l(`AppForm`,`errorSummary`,P,re);let[I,L]=_(!1),[R,z]=_(e),B=ee(!1),[V,H]=_(null),[U,W]=_(null),G=g(()=>new Map(Object.entries(M??{}).map(([e,t])=>[r(e),t])),[M]),K=JSON.stringify([...G].sort(([e],[t])=>e<t?-1:+(e>t))),[q,ce]=_({key:K,names:S}),J=q.key===K?q.names:S,le=p(e=>{T?.(e);let t=e.target;if(!(t instanceof HTMLElement)||!(`name`in t)||typeof t.name!=`string`||t.name===``)return;let n=r(t.name);G.has(n)&&ce(e=>{let t=e.key===K?e.names:S;return t.has(n)?e:{key:K,names:/* @__PURE__ */ new Set([...t,n])}})},[T,G,K]),[ue,Y]=_(ne),X=p(e=>(Y(t=>new Map(t).set(e,(t.get(e)??0)+1)),()=>{Y(t=>{let n=new Map(t),r=(t.get(e)??0)-1;return r>0?n.set(e,r):n.delete(e),n})}),[]),Z=p(e=>J.has(e)?void 0:G.get(e),[J,G]),Q=g(()=>({errorOf:Z,claim:X}),[Z,X]),$=[.../* @__PURE__ */ new Set([...oe??[],...[...G].filter(([e])=>!ue.has(e)).map(([,e])=>e)])],de=p(async t=>{if(t.preventDefault(),B.current)return;B.current=!0,L(!0);let n=t.currentTarget;try{let r=await w(t,{idempotencyKey:R});r!==!1&&z(e()),r!==!0&&H({form:n})}finally{B.current=!1,L(!1)}},[w,R]);h(()=>{if(V===null)return;let{form:e}=V;if(H(null),P===`status`&&W(ie(e,G)),e.querySelector(`.wui-error-summary`)!==null)return;let n=[...e.querySelectorAll(`[name]`)].map(e=>e.getAttribute(`name`)).find(e=>e!==null&&G.has(r(e)));n!==void 0&&t(n)},[V,G,P]),h(()=>{G.size===0&&W(null)},[G]);let fe=g(()=>({submitting:I,idempotencyKey:R}),[I,R]);return/* @__PURE__ */ v(n,{value:Q,children:/* @__PURE__ */ y(b,{value:fe,children:[/* @__PURE__ */ v(i,{value:P===`status`?U:null,children:/* @__PURE__ */ y(`form`,{...m,...F,noValidate:D,action:O,method:k,encType:A,acceptCharset:j,className:ae,onChange:le,onSubmit:de,"aria-busy":I||void 0,children:[$.length>0?/* @__PURE__ */ y(`div`,{role:`alert`,className:`alert alert-danger alert-has-icon`,"data-wui-form-errors":``,children:[/* @__PURE__ */ v(`span`,{className:`alert-icon`,children:/* @__PURE__ */ v(c,{name:`x`,size:11})}),/* @__PURE__ */ v(`div`,{className:`alert-content`,children:$.length===1?$[0]:$.map(e=>/* @__PURE__ */ v(`div`,{children:e},e))})]}):null,E]})}),N?.blocked?/* @__PURE__ */ v(s,{open:!0,title:C.title,description:se??C.message,confirmLabel:C.leaveLabel,cancelLabel:C.keepLabel,tone:`danger`,icon:/* @__PURE__ */ v(u.warning,{size:120}),onConfirm:N.discard,onClose:N.keep}):null]})})}export{b as FormSubmitContext,w as default,x as useFormSubmit};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./assertValidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[`end`,`start`,`between`];function a(a){let{marker:o,props:s}=e(`AppFormActions`,a),{children:c,sticky:l=!1,align:u=`end`,className:d=``,...f}=s;n(`AppFormActions`,f),t(`AppFormActions`,`align`,u,i);let p=[`form-actions`,l?`form-actions-sticky`:``,u&&u!==`end`?`form-actions-${u}`:``,d].filter(Boolean).join(` `);return/* @__PURE__ */ r(`div`,{className:p,...o,...f,children:c})}export{a as default};
1
+ import e from"../lib/focusField.js";import{FormStatusContext as t}from"../lib/formStatusContext.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppButton.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{formatDate as c}from"@webority/ui-elements/helpers";import{use as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{FORM_ACTIONS_TEXT as f,fillText as p,pluralText as m}from"@webority/ui-elements/text";var h=[`end`,`start`,`between`],g=[`surface`],_=[`neutral`,`success`,`warning`,`danger`,`info`],v=[`pristine`,`dirty`,`saving`,`saved`,`invalid`],y={pristine:{tone:`neutral`,icon:null},dirty:{tone:`warning`,icon:`edit`},saving:{tone:`neutral`,icon:null},saved:{tone:`success`,icon:`tick-circle`},invalid:{tone:`danger`,icon:`warning-2`}};function b(b){let{marker:x,props:S}=r(`AppFormActions`,b),C=n(`formActions`,f),w=l(t),{children:T,sticky:E=!1,align:D=`end`,status:O,statusTone:k,saveState:A,savedAt:j,invalidCount:M,className:N=``,...P}=S;if(s(`AppFormActions`,P),o(`AppFormActions`,`align`,D,h),o(`AppFormActions`,`sticky`,typeof E==`string`?E:null,g),o(`AppFormActions`,`statusTone`,k,_),o(`AppFormActions`,`saveState`,A,v),O!=null&&A!==void 0)throw RangeError(`[@webority/ui-react] <AppFormActions> received both status and saveState. Pass one of them.`);if((O!=null||A!==void 0)&&D!==`end`)throw RangeError(`[@webority/ui-react] <AppFormActions> received align="${D}" with a status. The status sits at the start and the buttons at the end, so align must be "end".`);if(A===`saved`&&j===void 0)throw RangeError(`[@webority/ui-react] <AppFormActions> received saveState="saved" without savedAt. Pass the time of the save.`);if(A===`invalid`&&M===void 0)throw RangeError(`[@webority/ui-react] <AppFormActions> received saveState="invalid" without invalidCount. Pass how many fields need attention.`);let F=[`form-actions`,E?`form-actions-sticky`:``,E===`surface`?`wui-form-actions-surface`:``,D&&D!==`end`?`form-actions-${D}`:``,N].filter(Boolean).join(` `);return/* @__PURE__ */ d(`div`,{className:F,...x,...P,children:[L(),T]});function I(e){return m(C,`invalid`,e)}function L(){if(w!==null&&w.errorCount>0)return/* @__PURE__ */ d(`div`,{className:`wui-form-actions-status`,role:`status`,"aria-live":`polite`,"data-tone":`danger`,children:[/* @__PURE__ */ u(a,{name:`warning-2`}),/* @__PURE__ */ u(`span`,{children:I(w.errorCount)}),w.links.length>0&&/* @__PURE__ */ u(`span`,{className:`wui-form-actions-status-links`,children:w.links.map(t=>/* @__PURE__ */ u(i,{type:`button`,variant:`link`,size:`sm`,onClick:()=>e(t.fieldName),children:t.label},t.fieldName))})]});if(A!==void 0){let e=y[A],t;return t=A===`saved`?p(C.saved,{time:`${c(j,{pattern:`time`})} IST`}):A===`invalid`?I(M??0):C[A],/* @__PURE__ */ d(`div`,{className:`wui-form-actions-status`,role:`status`,"aria-live":`polite`,"data-tone":e?.tone,children:[A===`saving`&&/* @__PURE__ */ u(`span`,{className:`spinner-border spinner-border-sm`,"aria-hidden":`true`,"data-wui":`AppSpinner`}),e?.icon!=null&&/* @__PURE__ */ u(a,{name:e.icon}),/* @__PURE__ */ u(`span`,{children:t})]})}return O==null?null:/* @__PURE__ */ u(`div`,{className:`wui-form-actions-status`,role:`status`,"aria-live":`polite`,"data-tone":k??`neutral`,children:O})}}export{b as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./assertValidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[1,2,3,4,5,6,7,8,9,10,11,12];function a(a){let{marker:o,props:s}=e(`AppFormRow`,a),{children:c,columns:l=2,collapse:u=!0,className:d=``,...f}=s;n(`AppFormRow`,f),t(`AppFormRow`,`columns`,l,i);let{style:p,...m}=f,h=[`form-row-grid`,`wui-form-cols-${Math.min(12,Math.max(1,Number(l)||2))}`,u===!1&&`wui-form-row-keep`,d].filter(Boolean).join(` `);return/* @__PURE__ */ r(`div`,{className:h,style:p,...o,...m,children:c})}export{a as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./assertValidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[1,2,3,4,5,6,7,8,9,10,11,12];function a(a){let{marker:o,props:s}=e(`AppFormRow`,a),{children:c,columns:l=2,collapse:u=!0,reserveMessage:d=!1,className:f=``,...p}=s;n(`AppFormRow`,p),t(`AppFormRow`,`columns`,l,i);let{style:m,...h}=p,g=[`form-row-grid`,`wui-form-cols-${Math.min(12,Math.max(1,Number(l)||2))}`,u===!1&&`wui-form-row-keep`,d&&`wui-form-row-reserve`,f].filter(Boolean).join(` `);return/* @__PURE__ */ r(`div`,{className:g,style:m,...o,...h,children:c})}export{a as default};
@@ -1 +1 @@
1
- import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{validateGantt as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useLayoutEffect as ee,useMemo as te,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";var u=()=>import(`@webority/ui-elements/elements/gantt`),d=[`table`,`lanes`],f=[`day`,`week`,`month`],ne=[`ready`,`loading`,`empty`,`error`],p=`wui-gantt:zoom-change`,m=`wui-gantt:from-change`,h=`wui-gantt:fold-change`,g=`wui-gantt:select`,_=`wui-gantt:add-task`,v=`wui-gantt:retry`,y=(e,t)=>{if(!(e instanceof CustomEvent))throw Error(`${t} arrived without a CustomEvent`);return e.detail},b=e=>e===``?void 0:e,x=e=>({title:e.title,rows:e.rows,layout:e.layout,zoom:e.zoom,from:b(e.from),folded:e.folded,selected:e.selected,today:b(e.today),state:e.state,emptyText:b(e.emptyText),errorText:b(e.errorText),loadingText:b(e.loadingText),addTask:e.addTask?!0:void 0,controlled:!0}),S=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),C=e=>{try{return JSON.stringify(e)}catch{return null}};function w(b){e(`wui-gantt`,u);let{marker:w,props:T}=t(`AppGantt`,b),{rows:E,title:re,layout:D,zoom:O,onZoomChange:k,from:A,onFromChange:j,folded:M,onFoldedChange:N,selected:P,onSelectedChange:F,today:I,state:L,loading:R,error:z,emptyText:B,errorText:V,loadingText:H,onAddTask:U,onRetry:W,className:G=``,style:ie,ref:K,...q}=T;r(`AppGantt`,q),n(`AppGantt`,`layout`,D,d),n(`AppGantt`,`zoom`,O,f),n(`AppGantt`,`state`,L,ne);let J=te(()=>{if(!Array.isArray(E))throw Error(`<AppGantt> rows is required: pass the list of tasks.`);return i({rows:E,zoom:O,layout:D}),E},[E,O,D]),[Y,ae]=c(`week`),[oe,se]=c(void 0),[ce,le]=c([]),[ue,de]=c(null),fe=O??Y,pe=A??oe,me=M??ce,he=P===void 0?ue:P,ge=z?`error`:R?`loading`:L,X=z||V,Z=s(null),Q=s({props:null,signature:null}),$=s({zoom:O,from:A,folded:M,selected:P,onZoomChange:k,onFromChange:j,onFoldedChange:N,onSelectedChange:F,onAddTask:U,onRetry:W}),_e=a(e=>{Z.current=e,typeof K==`function`?K(e):K&&(K.current=e)},[K]);return o(()=>{$.current={zoom:O,from:A,folded:M,selected:P,onZoomChange:k,onFromChange:j,onFoldedChange:N,onSelectedChange:F,onAddTask:U,onRetry:W}}),ee(()=>{let e=Z.current;if(!e)return;let t={title:re,rows:J,layout:D,zoom:fe,from:pe,folded:me,selected:he??null,today:I,state:ge,emptyText:B,errorText:X,loadingText:H,addTask:!!U};if(S(t,Q.current.props))return;Q.current.props=t;let n=x(t),r=C(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),o(()=>{let e=Z.current;if(!e)throw Error(`AppGantt: the <wui-gantt> element is not mounted`);let t=[[p,e=>{let{zoom:t}=y(e,p),n=$.current;n.onZoomChange?.(t),n.zoom===void 0&&ae(t)}],[m,e=>{let{from:t}=y(e,m),n=$.current;n.onFromChange?.(t),n.from===void 0&&se(t)}],[h,e=>{let{folded:t}=y(e,h),n=$.current;n.onFoldedChange?.(t),n.folded===void 0&&le(t)}],[g,e=>{let{key:t}=y(e,g),n=$.current;n.onSelectedChange?.(t),n.selected===void 0&&de(t)}],[_,()=>$.current.onAddTask?.()],[v,()=>$.current.onRetry?.()]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),/* @__PURE__ */ l(`wui-gantt`,{ref:_e,className:G||void 0,style:ie,...w,...q})}export{w as default};
1
+ import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{validateGantt as i}from"@webority/ui-elements/helpers";import{useCallback as ee,useEffect as a,useLayoutEffect as te,useMemo as ne,useRef as o,useState as s}from"react";import{jsx as c}from"react/jsx-runtime";var l=()=>import(`@webority/ui-elements/elements/gantt`),u=[`table`,`lanes`],re=[`day`,`week`,`month`],ie=[`ready`,`loading`,`empty`,`error`],ae=[1,2],d=`wui-gantt:zoom-change`,f=`wui-gantt:from-change`,p=`wui-gantt:fold-change`,m=`wui-gantt:select`,h=`wui-gantt:add-task`,g=`wui-gantt:retry`,_=(e,t)=>{if(!(e instanceof CustomEvent))throw Error(`${t} arrived without a CustomEvent`);return e.detail},v=e=>e===``?void 0:e,y=e=>({title:e.title,rows:e.rows,layout:e.layout,zoom:e.zoom,from:v(e.from),folded:e.folded,selected:e.selected,today:v(e.today),state:e.state,emptyText:v(e.emptyText),errorText:v(e.errorText),loadingText:v(e.loadingText),addTask:e.addTask?!0:void 0,holidays:e.holidays,weeks:e.weeks,countLabel:v(e.countLabel),clashLabel:v(e.clashLabel),controlled:!0}),b=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),x=e=>{try{return JSON.stringify(e)}catch{return null}};function S(v){e(`wui-gantt`,l);let{marker:S,props:C}=t(`AppGantt`,v),{rows:w,title:oe,layout:T,zoom:E,onZoomChange:D,from:O,onFromChange:k,folded:A,onFoldedChange:j,selected:M,onSelectedChange:N,today:P,state:F,loading:I,error:L,emptyText:R,errorText:z,loadingText:B,onAddTask:V,onRetry:H,holidays:U,weeks:W,countLabel:G,clashLabel:K,className:q=``,style:se,ref:J,...Y}=C;r(`AppGantt`,Y),n(`AppGantt`,`layout`,T,u),n(`AppGantt`,`zoom`,E,re),n(`AppGantt`,`state`,F,ie),n(`AppGantt`,`weeks`,W,ae);let ce=ne(()=>{if(!Array.isArray(w))throw Error(`<AppGantt> rows is required: pass the list of tasks.`);return i({rows:w,zoom:E,layout:T,weeks:W,holidays:U}),w},[w,E,T,W,U]),[le,ue]=s(`week`),[de,fe]=s(void 0),[pe,me]=s([]),[he,ge]=s(null),X=E??le,_e=O??de,ve=A??pe,ye=M===void 0?he:M,be=L?`error`:I?`loading`:F,xe=L||z,Z=o(null),Q=o({props:null,signature:null}),$=o({zoom:E,from:O,folded:A,selected:M,onZoomChange:D,onFromChange:k,onFoldedChange:j,onSelectedChange:N,onAddTask:V,onRetry:H}),Se=ee(e=>{Z.current=e,typeof J==`function`?J(e):J&&(J.current=e)},[J]);return a(()=>{$.current={zoom:E,from:O,folded:A,selected:M,onZoomChange:D,onFromChange:k,onFoldedChange:j,onSelectedChange:N,onAddTask:V,onRetry:H}}),te(()=>{let e=Z.current;if(!e)return;let t={title:oe,rows:ce,layout:T,zoom:X,from:_e,folded:ve,selected:ye??null,today:P,state:be,emptyText:R,errorText:xe,loadingText:B,addTask:!!V,holidays:U,weeks:W,countLabel:G,clashLabel:K};if(b(t,Q.current.props))return;Q.current.props=t;let n=y(t),r=x(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),a(()=>{let e=Z.current;if(!e)throw Error(`AppGantt: the <wui-gantt> element is not mounted`);let t=[[d,e=>{let{zoom:t}=_(e,d),n=$.current;n.onZoomChange?.(t),n.zoom===void 0&&ue(t)}],[f,e=>{let{from:t}=_(e,f),n=$.current;n.onFromChange?.(t),n.from===void 0&&fe(t)}],[p,e=>{let{folded:t}=_(e,p),n=$.current;n.onFoldedChange?.(t),n.folded===void 0&&me(t)}],[m,e=>{let{key:t}=_(e,m),n=$.current;n.onSelectedChange?.(t),n.selected===void 0&&ge(t)}],[h,()=>$.current.onAddTask?.()],[g,()=>$.current.onRetry?.()]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),/* @__PURE__ */ c(`wui-gantt`,{ref:Se,className:q||void 0,style:se,...S,...Y})}export{S as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,blockWhenReadOnly as ee}from"../lib/fieldState.js";import{useFieldError as te}from"../lib/formFields.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import ie from"./AppInfoTip.js";import ae from"./AppPopover.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import oe from"./warnUnknownProps.js";import{MASK_INPUT_TYPES as se,MASK_NAMES as ce,attachInputMask as le,evaluatePassword as ue,formatMasked as de,isMaskPattern as fe,postedMasked as pe}from"@webority/ui-elements/helpers";import{cloneElement as me,useEffect as o,useId as he,useRef as ge,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{INPUT_TEXT as _e}from"@webority/ui-elements/text";import{Form as u}from"react-bootstrap";var ve=[`sm`,`md`,`lg`,`xl`],ye=[`bare`,`underline`],be=[`off`,`border`,`above`],xe=[`off`,`shown`];function d(e,t){if(t!=null&&t!==``&&t!==!1)throw Error(`<AppInput> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}function Se(e){return e==null||{...`minLength`in e&&{minLength:e.minLength??0},...`uppercase`in e&&{uppercase:e.uppercase??!1},...`lowercase`in e&&{lowercase:e.lowercase??!1},...`digit`in e&&{digit:e.digit??!1},...`special`in e&&{special:e.special??!1},...`uniqueChars`in e&&{uniqueChars:e.uniqueChars??0},...`customRules`in e&&{customRules:e.customRules??[]}}}function f({ref:f,...Ce}){let{marker:we,props:Te}=re(`AppInput`,Ce),p=ne(`input`,_e),{label:m,required:h=!1,optional:g=!1,error:Ee,valid:De=!1,helperText:_,help:v,helpLabel:Oe=p.helpLabel,type:y=`text`,size:b=`md`,leftIcon:x,rightIcon:S,onRightIconClick:ke,rightIconLabel:Ae,unit:C,id:je,name:Me,className:Ne=``,fieldClassName:w=``,disabled:Pe=!1,readOnly:T=!1,loading:E=!1,clearable:D=!1,clearLabel:Fe=p.clearLabel,optionalLabel:Ie=p.optionalLabel,requirementsTitle:Le=p.requirementsTitle,showPasswordLabel:Re=p.showPasswordLabel,hidePasswordLabel:ze=p.hidePasswordLabel,showCount:O=!1,maxLength:k,monospace:Be=!1,prefix:A,suffix:j,action:Ve,floatingLabel:M=`off`,variant:N,passwordRequirements:P=`off`,passwordPolicy:He,requirementsPlacement:F=`auto`,mask:I,postFormatted:L=!1,onMaskChange:Ue,controlOnly:We=!1,value:R,...z}=Te,Ge=te(Me);oe(`AppInput`,z);let{onChange:Ke,onBlur:qe,onClick:Je,onInput:B,...Ye}=z;a(`AppInput`,`size`,b,ve),a(`AppInput`,`variant`,N,ye),a(`AppInput`,`floatingLabel`,M,be),a(`AppInput`,`passwordRequirements`,P,xe),We&&(d(`label`,m),d(`error`,Ee),d(`helperText`,_),d(`fieldClassName`,w),d(`showCount`,O),d(`help`,v),d(`optional`,g),d(`floatingLabel`,M===`off`?void 0:M),d(`passwordRequirements`,P===`shown`?P:void 0)),o(()=>{g&&h&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppInput: optional and required together; optional ignored`)},[g,h]),I!=null&&!fe(I)&&a(`AppInput`,`mask`,I,ce),I!=null&&a(`AppInput`,`type`,y,se);let[V,Xe]=s(!1),[Ze,Qe]=s(``),H=Ee||Ze||Ge,$e=he(),U=je||$e,W=y===`password`,et=W&&V?`text`:y,G=ge(null),tt=e=>{G.current=e,typeof f==`function`?f(e):f&&(f.current=e)},K=String(R??z.defaultValue??``),[nt,q]=s(()=>!!K),[rt,it]=s(()=>K.length),at=D&&!Pe&&!T&&!E,J=D||O,Y=W&&P===`shown`,[ot,st]=s(K);o(()=>{Y&&R!==void 0&&st(String(R??``))},[R,Y]),o(()=>{if(!J||R===void 0)return;let e=String(R??``);q(!!e),it(e.length)},[R,J]);let ct=e=>{let t=e.currentTarget;q(!!t.value),it(t.value.length),B?.(e)},lt=e=>{Y&&st(e.currentTarget.value),J?ct(e):B?.(e)},ut=I?{...R!==void 0&&{value:de(I,R)},...z.defaultValue!==void 0&&{defaultValue:de(I,z.defaultValue)}}:null,dt=ge(Ue);dt.current=Ue,o(()=>{let e=G.current;if(!I||!e)return;let t,n=le(e,{mask:I,postFormatted:L,onChange:(e,t)=>dt.current?.(e,t),onInvalidChange:e=>{clearTimeout(t),t=setTimeout(()=>Qe(e),0)}});return()=>{n(),clearTimeout(t),Qe(``)}},[I,L]);let ft=e=>I&&!L&&e?t=>{let n=t.currentTarget,ee=new Proxy(n,{get:(e,t)=>{if(t===`value`)return pe(I,e.value);let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}});e(Object.create(t,{target:{value:ee}}))}:e,pt=at?/* @__PURE__ */ c(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=G.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?t.call(e,``):e.value=``,e.dispatchEvent(new Event(`input`,{bubbles:!0})),q(!1),e.focus()},"aria-label":Fe,tabIndex:-1,hidden:!nt,children:/* @__PURE__ */ c(r,{name:`x`,size:16})}):null,mt=H&&U?`${U}-error`:void 0,ht=_&&U?`${U}-hint`:void 0,X=Y&&F===`inline`,gt=X&&U?`${U}-requirements`:void 0,_t=mt||(X?gt:ht),vt=[`input`,b===`sm`?`wui-input-sm`:``,b===`lg`?`wui-input-lg`:``,b===`xl`?`wui-input-xl`:``,H?`error`:``,De&&!H?`wui-valid`:``,W?`pw`:``,C?`num-input`:``,!(M!==`off`&&m||A||j||C||W||S)&&D&&at?`has-clear`:``,N===`underline`?`wui-input-underline`:N?`input-${N}`:``,Be?`wui-mono`:``,E?n:``,Ne].filter(Boolean).join(` `),yt=ee(T||E),bt=yt?e=>{yt(e),Je?.(e)}:Je,xt=ft(Ke),St=ft(qe),Ct=J||Y?lt:B,Z=/* @__PURE__ */ c(u.Control,{id:U,name:Me,type:et,className:vt,disabled:Pe,readOnly:T||E,"aria-busy":E||void 0,required:h,"aria-invalid":H?`true`:`false`,"aria-describedby":_t,maxLength:k,...R===void 0?null:{value:R},...Ye,...bt?{onClick:bt}:null,...xt?{onChange:xt}:null,...St?{onBlur:St}:null,...ut,placeholder:M===`off`?z.placeholder:` `,ref:tt,...Ct?{onInput:Ct}:null}),Q=He??!0,wt=Q&&typeof Q==`object`&&Q.title||Le,Tt=Y?ue(ot,Se(He)):null,Et=Y?/* @__PURE__ */ c(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:gt,"aria-label":X?wt:void 0,children:Tt?.map(e=>/* @__PURE__ */ l(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[/* @__PURE__ */ c(`span`,{className:`pw-mark`,"aria-hidden":`true`}),/* @__PURE__ */ c(`span`,{className:`pw-rule-text`,children:e.label}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:e.met?p.requirementMetLabel:p.requirementNotMetLabel})]},e.key))}):null,$;if(M!==`off`&&m&&!W)$=/* @__PURE__ */ l(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:[Z,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:U,children:[m,h&&/* @__PURE__ */ c(i,{})]})]});else if(Ve)$=/* @__PURE__ */ l(`div`,{className:`input-action-row`,children:[/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z]}),/* @__PURE__ */ c(`div`,{className:`input-action`,children:Ve})]});else if(A||j)$=/* @__PURE__ */ l(`div`,{className:`input-affixed`,children:[A!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-pre`,children:A}),Z,j!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-suf`,children:j})]});else if(C)$=/* @__PURE__ */ l(`div`,{className:`input-with-unit`,children:[Z,/* @__PURE__ */ c(`span`,{className:`unit`,children:C})]});else if(W){let e=/* @__PURE__ */ l(`button`,{type:`button`,className:`pw-toggle${V?` pw-revealed`:``}`,onClick:()=>Xe(e=>!e),"aria-label":V?ze:Re,tabIndex:-1,children:[/* @__PURE__ */ c(r,{name:`eye`,size:18,className:`pw-eye`}),/* @__PURE__ */ c(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=M!==`off`&&m?/* @__PURE__ */ c(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Z,e,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:U,children:[m,h&&/* @__PURE__ */ c(i,{})]})]})}):/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z,e]});$=Y&&!X&&F!==`inline`?/* @__PURE__ */ c(ae,{trigger:t,triggerType:`focus`,placement:F,title:wt,className:`pw-popover`,children:Et}):t}else $=S?/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Z,/* @__PURE__ */ c(`button`,{type:`button`,className:`pw-toggle`,onClick:ke,disabled:!ke,tabIndex:-1,"aria-label":Ae||S,children:/* @__PURE__ */ c(r,{name:S,size:18})})]}):D?/* @__PURE__ */ l(`div`,{className:x?`input-icon`:`input-wrap`,children:[x&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z,pt]}):x?/* @__PURE__ */ l(`div`,{className:`input-icon`,children:[/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:x,size:16})}),Z]}):Z;return We?me($,we):/* @__PURE__ */ l(u.Group,{...we,className:`field${w?` ${w}`:``}`,children:[m&&M===`off`&&/* @__PURE__ */ l(u.Label,{className:`label`,htmlFor:U,children:[m,g&&!h&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${Ie}`}),h&&/* @__PURE__ */ c(i,{}),v&&/* @__PURE__ */ c(ie,{label:Oe,children:v})]}),$,X&&/* @__PURE__ */ c(`div`,{className:`wui-pw-inline`,children:Et}),/* @__PURE__ */ c(t,{error:H,hint:X?null:_,errorId:mt,hintId:ht}),O&&/* @__PURE__ */ l(`div`,{className:`field-count${k&&rt>=k?` at-limit`:``}`,children:[rt,k?` / ${k}`:``]})]})}export{f as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,blockWhenReadOnly as ee}from"../lib/fieldState.js";import{useFieldError as te}from"../lib/formFields.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import ie from"./AppInfoTip.js";import ae from"./AppPopover.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import oe from"./warnUnknownProps.js";import{MASK_INPUT_TYPES as se,MASK_NAMES as ce,attachInputMask as le,evaluatePassword as ue,formatMasked as de,isMaskPattern as fe,postedMasked as pe}from"@webority/ui-elements/helpers";import{cloneElement as me,useEffect as o,useId as he,useRef as ge,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{INPUT_TEXT as _e}from"@webority/ui-elements/text";import{Form as u}from"react-bootstrap";var ve=[`sm`,`md`,`lg`,`xl`],ye=[`bare`,`underline`],be=[`off`,`border`,`above`],xe=[`off`,`shown`],Se=[`reserve`,`none`];function d(e,t){if(t!=null&&t!==``&&t!==!1)throw Error(`<AppInput> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}function Ce(e){return e==null||{...`minLength`in e&&{minLength:e.minLength??0},...`uppercase`in e&&{uppercase:e.uppercase??!1},...`lowercase`in e&&{lowercase:e.lowercase??!1},...`digit`in e&&{digit:e.digit??!1},...`special`in e&&{special:e.special??!1},...`uniqueChars`in e&&{uniqueChars:e.uniqueChars??0},...`customRules`in e&&{customRules:e.customRules??[]}}}function f({ref:f,...we}){let{marker:Te,props:Ee}=re(`AppInput`,we),p=ne(`input`,_e),{label:m,required:h=!1,optional:g=!1,error:De,valid:Oe=!1,helperText:_,messageRoom:v=`reserve`,help:y,helpLabel:ke=p.helpLabel,type:b=`text`,size:x=`md`,leftIcon:S,rightIcon:C,onRightIconClick:Ae,rightIconLabel:je,unit:w,id:Me,name:Ne,className:Pe=``,fieldClassName:T=``,disabled:Fe=!1,readOnly:E=!1,loading:D=!1,clearable:O=!1,clearLabel:Ie=p.clearLabel,optionalLabel:Le=p.optionalLabel,requirementsTitle:Re=p.requirementsTitle,showPasswordLabel:ze=p.showPasswordLabel,hidePasswordLabel:Be=p.hidePasswordLabel,showCount:k=!1,maxLength:A,monospace:Ve=!1,prefix:j,suffix:M,action:He,floatingLabel:N=`off`,variant:P,passwordRequirements:F=`off`,passwordPolicy:Ue,requirementsPlacement:I=`auto`,mask:L,postFormatted:R=!1,onMaskChange:We,controlOnly:Ge=!1,value:z,...B}=Ee,Ke=te(Ne);oe(`AppInput`,B);let{onChange:qe,onBlur:Je,onClick:Ye,onInput:V,...Xe}=B;a(`AppInput`,`size`,x,ve),a(`AppInput`,`variant`,P,ye),a(`AppInput`,`floatingLabel`,N,be),a(`AppInput`,`passwordRequirements`,F,xe),a(`AppInput`,`messageRoom`,v,Se),Ge&&(d(`label`,m),d(`error`,De),d(`helperText`,_),d(`messageRoom`,v===`reserve`?void 0:v),d(`fieldClassName`,T),d(`showCount`,k),d(`help`,y),d(`optional`,g),d(`floatingLabel`,N===`off`?void 0:N),d(`passwordRequirements`,F===`shown`?F:void 0)),o(()=>{g&&h&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppInput: optional and required together; optional ignored`)},[g,h]),L!=null&&!fe(L)&&a(`AppInput`,`mask`,L,ce),L!=null&&a(`AppInput`,`type`,b,se);let[H,Ze]=s(!1),[Qe,$e]=s(``),U=De||Qe||Ke,et=he(),W=Me||et,G=b===`password`,tt=G&&H?`text`:b,K=ge(null),nt=e=>{K.current=e,typeof f==`function`?f(e):f&&(f.current=e)},q=String(z??B.defaultValue??``),[rt,J]=s(()=>!!q),[it,at]=s(()=>q.length),ot=O&&!Fe&&!E&&!D,Y=O||k,X=G&&F===`shown`,[st,ct]=s(q);o(()=>{X&&z!==void 0&&ct(String(z??``))},[z,X]),o(()=>{if(!Y||z===void 0)return;let e=String(z??``);J(!!e),at(e.length)},[z,Y]);let lt=e=>{let t=e.currentTarget;J(!!t.value),at(t.value.length),V?.(e)},ut=e=>{X&&ct(e.currentTarget.value),Y?lt(e):V?.(e)},dt=L?{...z!==void 0&&{value:de(L,z)},...B.defaultValue!==void 0&&{defaultValue:de(L,B.defaultValue)}}:null,ft=ge(We);ft.current=We,o(()=>{let e=K.current;if(!L||!e)return;let t,n=le(e,{mask:L,postFormatted:R,onChange:(e,t)=>ft.current?.(e,t),onInvalidChange:e=>{clearTimeout(t),t=setTimeout(()=>$e(e),0)}});return()=>{n(),clearTimeout(t),$e(``)}},[L,R]);let pt=e=>L&&!R&&e?t=>{let n=t.currentTarget,ee=new Proxy(n,{get:(e,t)=>{if(t===`value`)return pe(L,e.value);let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}});e(Object.create(t,{target:{value:ee}}))}:e,mt=ot?/* @__PURE__ */ c(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=K.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?t.call(e,``):e.value=``,e.dispatchEvent(new Event(`input`,{bubbles:!0})),J(!1),e.focus()},"aria-label":Ie,tabIndex:-1,hidden:!rt,children:/* @__PURE__ */ c(r,{name:`x`,size:16})}):null,ht=U&&W?`${W}-error`:void 0,gt=_&&W?`${W}-hint`:void 0,Z=X&&I===`inline`,_t=Z&&W?`${W}-requirements`:void 0,vt=ht||(Z?_t:gt),yt=[`input`,x===`sm`?`wui-input-sm`:``,x===`lg`?`wui-input-lg`:``,x===`xl`?`wui-input-xl`:``,U?`error`:``,Oe&&!U?`wui-valid`:``,G?`pw`:``,w?`num-input`:``,!(N!==`off`&&m||j||M||w||G||C)&&O&&ot?`has-clear`:``,P===`underline`?`wui-input-underline`:P?`input-${P}`:``,Ve?`wui-mono`:``,D?n:``,Pe].filter(Boolean).join(` `),bt=ee(E||D),xt=bt?e=>{bt(e),Ye?.(e)}:Ye,St=pt(qe),Ct=pt(Je),wt=Y||X?ut:V,Q=/* @__PURE__ */ c(u.Control,{id:W,name:Ne,type:tt,className:yt,disabled:Fe,readOnly:E||D,"aria-busy":D||void 0,required:h,"aria-invalid":U?`true`:`false`,"aria-describedby":vt,maxLength:A,...z===void 0?null:{value:z},...Xe,...xt?{onClick:xt}:null,...St?{onChange:St}:null,...Ct?{onBlur:Ct}:null,...dt,placeholder:N===`off`?B.placeholder:` `,ref:nt,...wt?{onInput:wt}:null}),Tt=Ue??!0,Et=Tt&&typeof Tt==`object`&&Tt.title||Re,Dt=X?ue(st,Ce(Ue)):null,Ot=X?/* @__PURE__ */ c(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:_t,"aria-label":Z?Et:void 0,children:Dt?.map(e=>/* @__PURE__ */ l(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[/* @__PURE__ */ c(`span`,{className:`pw-mark`,"aria-hidden":`true`}),/* @__PURE__ */ c(`span`,{className:`pw-rule-text`,children:e.label}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:e.met?p.requirementMetLabel:p.requirementNotMetLabel})]},e.key))}):null,$;if(N!==`off`&&m&&!G)$=/* @__PURE__ */ l(`div`,{className:N===`above`?`field-float wui-float-above`:`field-float`,children:[Q,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:W,children:[m,h&&/* @__PURE__ */ c(i,{})]})]});else if(He)$=/* @__PURE__ */ l(`div`,{className:`input-action-row`,children:[/* @__PURE__ */ l(`div`,{className:S?`input-icon`:`input-wrap`,children:[S&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:S,size:16})}),Q]}),/* @__PURE__ */ c(`div`,{className:`input-action`,children:He})]});else if(j||M)$=/* @__PURE__ */ l(`div`,{className:`input-affixed`,children:[j!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-pre`,children:j}),Q,M!=null&&/* @__PURE__ */ c(`span`,{className:`affix affix-suf`,children:M})]});else if(w)$=/* @__PURE__ */ l(`div`,{className:`input-with-unit`,children:[Q,/* @__PURE__ */ c(`span`,{className:`unit`,children:w})]});else if(G){let e=/* @__PURE__ */ l(`button`,{type:`button`,className:`pw-toggle${H?` pw-revealed`:``}`,onClick:()=>Ze(e=>!e),"aria-label":H?Be:ze,tabIndex:-1,children:[/* @__PURE__ */ c(r,{name:`eye`,size:18,className:`pw-eye`}),/* @__PURE__ */ c(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=N!==`off`&&m?/* @__PURE__ */ c(`div`,{className:N===`above`?`field-float wui-float-above`:`field-float`,children:/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Q,e,/* @__PURE__ */ l(`label`,{className:`float-label`,htmlFor:W,children:[m,h&&/* @__PURE__ */ c(i,{})]})]})}):/* @__PURE__ */ l(`div`,{className:S?`input-icon`:`input-wrap`,children:[S&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:S,size:16})}),Q,e]});$=X&&!Z&&I!==`inline`?/* @__PURE__ */ c(ae,{trigger:t,triggerType:`focus`,placement:I,title:Et,className:`pw-popover`,children:Ot}):t}else $=C?/* @__PURE__ */ l(`div`,{className:`input-wrap`,children:[Q,/* @__PURE__ */ c(`button`,{type:`button`,className:`pw-toggle`,onClick:Ae,disabled:!Ae,tabIndex:-1,"aria-label":je||C,children:/* @__PURE__ */ c(r,{name:C,size:18})})]}):O?/* @__PURE__ */ l(`div`,{className:S?`input-icon`:`input-wrap`,children:[S&&/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:S,size:16})}),Q,mt]}):S?/* @__PURE__ */ l(`div`,{className:`input-icon`,children:[/* @__PURE__ */ c(`span`,{className:`ic`,children:/* @__PURE__ */ c(r,{name:S,size:16})}),Q]}):Q;return Ge?me($,Te):/* @__PURE__ */ l(u.Group,{...Te,className:`field${T?` ${T}`:``}`,children:[m&&N===`off`&&/* @__PURE__ */ l(u.Label,{className:`label`,htmlFor:W,children:[m,g&&!h&&/* @__PURE__ */ c(`span`,{className:`label-optional`,children:` ${Le}`}),h&&/* @__PURE__ */ c(i,{}),y&&/* @__PURE__ */ c(ie,{label:ke,children:y})]}),$,Z&&/* @__PURE__ */ c(`div`,{className:`wui-pw-inline`,children:Ot}),v===`none`&&!U&&(Z||!_)?null:/* @__PURE__ */ c(t,{error:U,hint:Z?null:_,errorId:ht,hintId:gt}),k&&/* @__PURE__ */ l(`div`,{className:`field-count${A&&it>=A?` at-limit`:``}`,children:[it,A?` / ${A}`:``]})]})}export{f as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import{errorToast as s}from"./toast.js";import c from"./warnUnknownProps.js";import{KANBAN_SUMMARY_FORMATS as l,KANBAN_TONES as u,formatValue as ee,kanbanOverflow as te,kanbanSummaryFormat as d,kanbanVisibleLimit as ne,sumKanbanValues as re}from"@webority/ui-elements/helpers";import{useEffect as f,useId as p,useMemo as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{KANBAN_TEXT as ie,fillText as y}from"@webority/ui-elements/text";var ae=()=>import(`@webority/ui-elements/elements/kanban`),oe=e=>e.key??e.id,se=e=>e.column,b=[`rupees`,`paise`],ce=[`inline`,`stacked`];function le(e){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:void 0}function x(x){let S=n(`wui-kanban`,ae),C=r(`kanban`,ie),{marker:ue,props:de}=i(`AppKanban`,x),{columns:w,cards:T,renderCard:fe,renderColumnActions:pe,getCardKey:E=oe,getCardColumn:D=se,getCardValue:O,cardLabel:k,isCardLocked:me,onLocked:A,onMove:j,accept:M,filter:he,boardId:ge,ariaLabel:_e=C.ariaLabel,columnsLabel:ve=C.columnsLabel,expandLabel:ye=C.expandLabel,collapseLabel:be=C.collapseLabel,emptyText:xe=C.emptyText,helpText:Se=C.helpText,readOnly:Ce=!1,swipeHint:we=!1,swipeHintText:Te=C.swipeHintText,fill:Ee=!1,columnWidth:N,fillOffset:P,activeCardKey:F,headLayout:I=`inline`,truncateHeads:L=!1,summaryFormat:R,summaryUnit:z,className:B=``,id:De,linkComponent:Oe,...V}=de;if(!Array.isArray(w))throw Error(`<AppKanban> columns is required: pass the board's stage columns.`);if(!Array.isArray(T))throw Error(`<AppKanban> cards is required: pass the cards, an empty array for an empty board.`);c(`AppKanban`,V),o(`AppKanban`,`summaryFormat`,R,l),o(`AppKanban`,`summaryUnit`,z,b),o(`AppKanban`,`headLayout`,I,ce);for(let e of w)o(`AppKanban`,`columns[].tone`,e.tone,u);let ke=p(),H=De||`kanban-${ke.replace(/[^a-zA-Z0-9_-]/g,``)}`,U=h(null),[W,G]=g(()=>/* @__PURE__ */ new Map),[K,Ae]=g(()=>/* @__PURE__ */ new Set),[je,q]=g(()=>/* @__PURE__ */ new Set),J=m(()=>new Map(T.map(e=>[String(E(e)),e])),[T,E]),Y=h({accept:M,onMove:j,onLocked:A,byKey:J,columns:w});Y.current={accept:M,onMove:j,onLocked:A,byKey:J,columns:w};let X=R&&l.includes(R)&&(z==null||b.includes(z))?d(R,z):null,Z=m(()=>{let e=new Map(w.map(e=>[e.key,[]])),t=[];for(let n of T){let r=String(E(n)),i=W.get(r);i?t.push([n,i]):e.get(D(n))?.push(n)}for(let[n,r]of t){let t=e.get(r.to);t&&t.splice(Math.min(r.index,t.length),0,n)}return e},[w,T,W,E,D]);f(()=>{let e=U.current;if(!e||!S)return;e.accept=(e,t,n)=>{let r=Y.current.accept;return!r||r(Y.current.byKey.get(e.getAttribute(`data-wui-card`)??``),t,n)};let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:kanban:move arrived without a CustomEvent`);let{key:t,from:n,to:r,index:i}=e.detail,a=Y.current.onMove,o=Y.current.byKey.get(t);if(!a||!o)return;let c=Y.current.columns.find(e=>e.key===r)?.visibleLimit!=null;c&&q(e=>new Set(e).add(t)),G(e=>new Map(e).set(t,{to:r,index:i}));let l=()=>G(e=>{let n=new Map(e);return n.delete(t),n}),u;try{u=a({card:o,key:t,from:n,to:r,index:i})}catch(e){u=Promise.reject(e)}Promise.resolve(u).then(l,e=>{l(),c&&q(e=>{let n=new Set(e);return n.delete(t),n}),s(le(e)||C.serverMessage)})},n=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:kanban:locked arrived without a CustomEvent`);let{key:t,reason:n}=e.detail,r=Y.current.byKey.get(t);r&&Y.current.onLocked?.({card:r,key:t,reason:n})};return e.addEventListener(`wui:kanban:move`,t),e.addEventListener(`wui:kanban:locked`,n),()=>{e.removeEventListener(`wui:kanban:move`,t),e.removeEventListener(`wui:kanban:locked`,n),e.accept=void 0}},[S,C.serverMessage]);let Q=e=>he?.(e)!==!1,Me=(e,t)=>{K.has(e)&&q(e=>{let n=new Set(e);for(let e of t)n.delete(String(E(e)));return n}),Ae(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},$={};return N!=null&&($[`--wui-kanban-column-width`]=`${N}px`),P!=null&&($[`--wui-kanban-fill-offset`]=`${P}px`),/* @__PURE__ */ v(`wui-kanban`,{ref:U,id:H,class:B?`wui-kanban ${B}`:`wui-kanban`,role:`region`,"aria-label":_e,"board-id":ge||void 0,"summary-format":X?R:void 0,"summary-unit":X&&z?z:void 0,readonly:Ce?``:void 0,fill:Ee?``:void 0,"data-head-layout":I===`stacked`?`stacked`:void 0,"data-head-truncate":L?``:void 0,style:$,controlled:``,...ue,...V,children:[/* @__PURE__ */ _(`nav`,{className:`wui-kanban-switcher`,"aria-label":ve,children:w.map((e,t)=>/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-kanban-switch`,"data-wui-switch":e.key,"aria-controls":`${H}-${e.key}`,"aria-current":t===0?`true`:void 0,children:[/* @__PURE__ */ _(`span`,{className:`wui-kanban-switch-title`,children:e.title}),/* @__PURE__ */ _(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:(Z.get(e.key)||[]).filter(Q).length})]},e.key))}),we&&/* @__PURE__ */ v(`p`,{className:`wui-kanban-hint`,"aria-hidden":`true`,children:[/* @__PURE__ */ _(a,{name:`arrow-swap-horizontal`,size:14}),Te]}),/* @__PURE__ */ _(`div`,{className:`wui-kanban-board`,"data-wui-scroller":``,children:w.map(n=>{let r=e(Oe,{href:n.href}),i=`${H}-${n.key}`,o=Z.get(n.key)||[],s=o.filter(Q),c=!!(n.collapsible&&n.collapsed),l=ne(n.visibleLimit),d=K.has(n.key),f=te(s.map(e=>String(E(e))),l,d,je),p=typeof n.summary==`function`?n.summary(s):n.summary;X&&(p=ee(re(s.map(e=>O?.(e))),X));let m=pe?.(n,s);return/* @__PURE__ */ v(`section`,{className:`wui-kanban-column`,id:i,"data-wui-column":n.key,"data-tone":n.tone&&u.includes(n.tone)?n.tone:`neutral`,"aria-labelledby":`${i}-title`,"data-accept-from":n.acceptFrom?n.acceptFrom.join(` `):void 0,"data-collapsible":n.collapsible?``:void 0,"data-collapsed":c?``:void 0,children:[/* @__PURE__ */ v(`header`,{className:`wui-kanban-head`,children:[/* @__PURE__ */ _(`span`,{className:`wui-kanban-dot`,"aria-hidden":`true`}),/* @__PURE__ */ _(`h2`,{className:`wui-kanban-title`,id:`${i}-title`,title:L?n.title:void 0,children:n.href?/* @__PURE__ */ _(t,{link:r,children:n.title}):n.title}),/* @__PURE__ */ _(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:s.length}),n.collapsible&&/* @__PURE__ */ _(`span`,{className:`wui-kanban-lock`,"aria-hidden":`true`,children:/* @__PURE__ */ _(a,{name:`lock`,size:14})}),m!=null&&m!==!1&&/* @__PURE__ */ _(`div`,{className:`wui-kanban-actions`,"data-wui-no-drag":``,children:m}),n.collapsible&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-kanban-collapse`,"data-wui-collapse":``,"aria-expanded":c?`false`:`true`,"aria-controls":`${i}-body`,"aria-label":y(c?ye:be,{title:n.title}),children:/* @__PURE__ */ _(a,{name:`chevron-left`,size:16})}),p!=null&&/* @__PURE__ */ _(`div`,{className:`wui-kanban-summary`,"data-wui-summary":``,children:p})]}),/* @__PURE__ */ _(`p`,{className:`wui-kanban-drop-note`,"data-wui-drop-note":``,hidden:!0}),/* @__PURE__ */ _(`div`,{className:`wui-kanban-body`,id:`${i}-body`,"data-wui-body":``,children:o.map(e=>{let t=String(E(e)),n=W.has(t);return/* @__PURE__ */ _(`article`,{className:`wui-kanban-card`,"data-wui-card":t,tabIndex:0,"aria-label":k?k(e):void 0,"data-wui-locked":me?.(e)?``:void 0,"data-wui-value":O?O(e)??void 0:void 0,"aria-current":F!=null&&t===String(F)?`true`:void 0,"aria-busy":n?`true`:void 0,"data-wui-saving":n?``:void 0,"data-wui-overflow":f.has(t)?``:void 0,hidden:!Q(e),children:fe?.(e)},t)})}),l!=null&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-kanban-more`,"data-wui-more":``,"aria-controls":`${i}-body`,"aria-expanded":d?`true`:`false`,hidden:d?s.length<=l:f.size===0,onClick:()=>Me(n.key,o),children:d?C.fewerLabel:y(C.moreText,{count:f.size})}),/* @__PURE__ */ _(`p`,{className:`wui-kanban-empty`,"data-wui-empty":``,hidden:s.length>0,children:n.emptyText??xe})]},n.key)})}),/* @__PURE__ */ _(`p`,{className:`visually-hidden`,id:`${H}-help`,"data-wui-help":``,children:Se}),/* @__PURE__ */ _(`div`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{x as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import{errorToast as s}from"./toast.js";import c from"./warnUnknownProps.js";import{KANBAN_SUMMARY_FORMATS as l,KANBAN_TONES as u,formatValue as ee,kanbanOverflow as te,kanbanSummaryFormat as d,kanbanVisibleLimit as ne,sumKanbanValues as re}from"@webority/ui-elements/helpers";import{useEffect as f,useId as p,useMemo as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{KANBAN_TEXT as ie,fillText as y}from"@webority/ui-elements/text";var ae=()=>import(`@webority/ui-elements/elements/kanban`),oe=e=>e.key??e.id,se=e=>e.column,b=[`rupees`,`paise`],ce=[`inline`,`stacked`],le=[`rail`,`strip`];function ue(e){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:void 0}function x(x){let S=n(`wui-kanban`,ae),C=r(`kanban`,ie),{marker:de,props:fe}=i(`AppKanban`,x),{columns:w,cards:T,renderCard:pe,renderColumnActions:me,getCardKey:E=oe,getCardColumn:D=se,getCardValue:O,cardLabel:k,isCardLocked:he,lockedReason:A,onLocked:j,onMove:M,accept:N,filter:ge,boardId:_e,ariaLabel:ve=C.ariaLabel,columnsLabel:ye=C.columnsLabel,expandLabel:be=C.expandLabel,collapseLabel:xe=C.collapseLabel,emptyText:Se=C.emptyText,helpText:Ce=C.helpText,readOnly:we=!1,swipeHint:Te=!1,swipeHintText:Ee=C.swipeHintText,fill:De=!1,columnWidth:P,fillOffset:F,activeCardKey:I,headLayout:L=`inline`,truncateHeads:R=!1,summaryFormat:z,summaryUnit:B,className:V=``,id:Oe,linkComponent:ke,...H}=fe;if(!Array.isArray(w))throw Error(`<AppKanban> columns is required: pass the board's stage columns.`);if(!Array.isArray(T))throw Error(`<AppKanban> cards is required: pass the cards, an empty array for an empty board.`);c(`AppKanban`,H),o(`AppKanban`,`summaryFormat`,z,l),o(`AppKanban`,`summaryUnit`,B,b),o(`AppKanban`,`headLayout`,L,ce);for(let e of w)o(`AppKanban`,`columns[].tone`,e.tone,u),o(`AppKanban`,`columns[].collapsedLayout`,e.collapsedLayout,le);let Ae=p(),U=Oe||`kanban-${Ae.replace(/[^a-zA-Z0-9_-]/g,``)}`,W=h(null),[G,K]=g(()=>/* @__PURE__ */ new Map),[q,je]=g(()=>/* @__PURE__ */ new Set),[Me,J]=g(()=>/* @__PURE__ */ new Set),Y=m(()=>new Map(T.map(e=>[String(E(e)),e])),[T,E]),X=h({accept:N,onMove:M,onLocked:j,byKey:Y,columns:w});X.current={accept:N,onMove:M,onLocked:j,byKey:Y,columns:w};let Z=z&&l.includes(z)&&(B==null||b.includes(B))?d(z,B):null,Ne=m(()=>{let e=new Map(w.map(e=>[e.key,[]])),t=[];for(let n of T){let r=String(E(n)),i=G.get(r);i?t.push([n,i]):e.get(D(n))?.push(n)}for(let[n,r]of t){let t=e.get(r.to);t&&t.splice(Math.min(r.index,t.length),0,n)}return e},[w,T,G,E,D]);f(()=>{let e=W.current;if(!e||!S)return;e.accept=(e,t,n)=>{let r=X.current.accept;return!r||r(X.current.byKey.get(e.getAttribute(`data-wui-card`)??``),t,n)};let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:kanban:move arrived without a CustomEvent`);let{key:t,from:n,to:r,index:i}=e.detail,a=X.current.onMove,o=X.current.byKey.get(t);if(!a||!o)return;let c=X.current.columns.find(e=>e.key===r)?.visibleLimit!=null;c&&J(e=>new Set(e).add(t)),K(e=>new Map(e).set(t,{to:r,index:i}));let l=()=>K(e=>{let n=new Map(e);return n.delete(t),n}),u;try{u=a({card:o,key:t,from:n,to:r,index:i})}catch(e){u=Promise.reject(e)}Promise.resolve(u).then(l,e=>{l(),c&&J(e=>{let n=new Set(e);return n.delete(t),n}),s(ue(e)||C.serverMessage)})},n=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:kanban:locked arrived without a CustomEvent`);let{key:t,reason:n}=e.detail,r=X.current.byKey.get(t);r&&X.current.onLocked?.({card:r,key:t,reason:n})};return e.addEventListener(`wui:kanban:move`,t),e.addEventListener(`wui:kanban:locked`,n),()=>{e.removeEventListener(`wui:kanban:move`,t),e.removeEventListener(`wui:kanban:locked`,n),e.accept=void 0}},[S,C.serverMessage]);let Q=e=>ge?.(e)!==!1,Pe=(e,t)=>{q.has(e)&&J(e=>{let n=new Set(e);for(let e of t)n.delete(String(E(e)));return n}),je(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},$={};return P!=null&&($[`--wui-kanban-column-width`]=`${P}px`),F!=null&&($[`--wui-kanban-fill-offset`]=`${F}px`),/* @__PURE__ */ v(`wui-kanban`,{ref:W,id:U,class:V?`wui-kanban ${V}`:`wui-kanban`,role:`region`,"aria-label":ve,"board-id":_e||void 0,"summary-format":Z?z:void 0,"summary-unit":Z&&B?B:void 0,readonly:we?``:void 0,fill:De?``:void 0,"data-head-layout":L===`stacked`?`stacked`:void 0,"data-head-truncate":R?``:void 0,style:$,controlled:``,...de,...H,children:[/* @__PURE__ */ _(`nav`,{className:`wui-kanban-switcher`,"aria-label":ye,children:w.map((e,t)=>/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-kanban-switch`,"data-wui-switch":e.key,"aria-controls":`${U}-${e.key}`,"aria-current":t===0?`true`:void 0,children:[/* @__PURE__ */ _(`span`,{className:`wui-kanban-switch-title`,children:e.title}),/* @__PURE__ */ _(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:(Ne.get(e.key)||[]).filter(Q).length})]},e.key))}),Te&&/* @__PURE__ */ v(`p`,{className:`wui-kanban-hint`,"aria-hidden":`true`,children:[/* @__PURE__ */ _(a,{name:`arrow-swap-horizontal`,size:14}),Ee]}),/* @__PURE__ */ _(`div`,{className:`wui-kanban-board`,"data-wui-scroller":``,children:w.map(n=>{let r=e(ke,{href:n.href}),i=`${U}-${n.key}`,o=Ne.get(n.key)||[],s=o.filter(Q),c=!!(n.collapsible&&n.collapsed),l=ne(n.visibleLimit),d=q.has(n.key),f=te(s.map(e=>String(E(e))),l,d,Me),p=typeof n.summary==`function`?n.summary(s):n.summary;Z&&(p=ee(re(s.map(e=>O?.(e))),Z));let m=me?.(n,s);return/* @__PURE__ */ v(`section`,{className:`wui-kanban-column`,id:i,"data-wui-column":n.key,"data-tone":n.tone&&u.includes(n.tone)?n.tone:`neutral`,"aria-labelledby":`${i}-title`,"data-accept-from":n.acceptFrom?n.acceptFrom.join(` `):void 0,"data-collapsible":n.collapsible?``:void 0,"data-collapsed":c?``:void 0,"data-collapsed-layout":n.collapsedLayout===`strip`?`strip`:void 0,children:[/* @__PURE__ */ v(`header`,{className:`wui-kanban-head`,children:[/* @__PURE__ */ _(`span`,{className:`wui-kanban-dot`,"aria-hidden":`true`}),/* @__PURE__ */ _(`h2`,{className:`wui-kanban-title`,id:`${i}-title`,title:R?n.title:void 0,children:n.href?/* @__PURE__ */ _(t,{link:r,children:n.title}):n.title}),/* @__PURE__ */ _(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:s.length}),n.collapsible&&/* @__PURE__ */ _(`span`,{className:`wui-kanban-lock`,"aria-hidden":`true`,children:/* @__PURE__ */ _(a,{name:`lock`,size:14})}),m!=null&&m!==!1&&/* @__PURE__ */ _(`div`,{className:`wui-kanban-actions`,"data-wui-no-drag":``,children:m}),n.collapsible&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-kanban-collapse`,"data-wui-collapse":``,"aria-expanded":c?`false`:`true`,"aria-controls":`${i}-body`,"aria-label":y(c?be:xe,{title:n.title}),children:/* @__PURE__ */ _(a,{name:`chevron-left`,size:16})}),p!=null&&/* @__PURE__ */ _(`div`,{className:`wui-kanban-summary`,"data-wui-summary":``,children:p})]}),/* @__PURE__ */ _(`p`,{className:`wui-kanban-drop-note`,"data-wui-drop-note":``,hidden:!0}),/* @__PURE__ */ _(`div`,{className:`wui-kanban-body`,id:`${i}-body`,"data-wui-body":``,children:o.map(e=>{let t=String(E(e)),n=G.has(t),r=!!he?.(e),i=r&&A?A(e):void 0;return/* @__PURE__ */ v(`article`,{className:`wui-kanban-card`,"data-wui-card":t,tabIndex:0,"aria-label":k?k(e):void 0,"data-wui-locked":r?``:void 0,"data-wui-value":O?O(e)??void 0:void 0,"aria-current":I!=null&&t===String(I)?`true`:void 0,"aria-busy":n?`true`:void 0,"data-wui-saving":n?``:void 0,"data-wui-overflow":f.has(t)?``:void 0,hidden:!Q(e),children:[!!i&&/* @__PURE__ */ v(`span`,{className:`wui-kanban-card-lock`,title:i,children:[/* @__PURE__ */ _(`span`,{"aria-hidden":`true`,children:/* @__PURE__ */ _(a,{name:`lock`,size:14})}),/* @__PURE__ */ _(`span`,{className:`visually-hidden`,children:i})]}),pe?.(e)]},t)})}),l!=null&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-kanban-more`,"data-wui-more":``,"aria-controls":`${i}-body`,"aria-expanded":d?`true`:`false`,hidden:d?s.length<=l:f.size===0,onClick:()=>Pe(n.key,o),children:d?C.fewerLabel:y(C.moreText,{count:f.size})}),/* @__PURE__ */ _(`p`,{className:`wui-kanban-empty`,"data-wui-empty":``,hidden:s.length>0,children:n.emptyText??Se})]},n.key)})}),/* @__PURE__ */ _(`p`,{className:`visually-hidden`,id:`${U}-help`,"data-wui-help":``,children:Ce}),/* @__PURE__ */ _(`div`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{x as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{TONES as n}from"../lib/vocabulary.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./AppSparkline.js";import o from"./assertValidValue.js";import s from"./renderIconProp.js";import c from"./textOf.js";import l from"./warnUnknownProps.js";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var ee=[`plain`,`filled`,`accent`,`spotlight`],p=[`sm`,`md`,`lg`],m=n,h=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],te=[`up`,`down`,`flat`],g=[1,2,3,4,5,6,7,8],_=n.filter(e=>[`success`,`danger`,`neutral`].includes(e)),v={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function y(e){let t=c(e).trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function b(n){let{marker:c,props:b}=r(`AppKpiTile`,n),{label:x,value:S,caption:C,icon:w,iconTone:T,iconVariant:E=`twotone`,delta:D,deltaDirection:O,deltaTone:k,sparkline:A,variant:j=`plain`,size:M=`md`,valueSize:N,inline:ne=!1,stacked:P=!1,iconSlot:F,attention:I=!1,href:L,linkComponent:R,className:z=``,style:B,iconClassName:V=``,labelClassName:H=``,valueClassName:U=``,captionClassName:W=``,deltaClassName:G=``,sparklineClassName:K=``,...q}=b;l(`AppKpiTile`,q),o(`AppKpiTile`,`variant`,j,ee),o(`AppKpiTile`,`size`,M,p),o(`AppKpiTile`,`iconTone`,T,m),o(`AppKpiTile`,`iconVariant`,E,h),o(`AppKpiTile`,`deltaDirection`,O,te),o(`AppKpiTile`,`deltaTone`,k,_),o(`AppKpiTile`,`iconSlot`,F,g);let J=`kpi${ne?` kpi-inline`:P||j===`spotlight`?``:` wui-kpi-picked`}${j===`filled`?` kpi-filled`:j===`accent`?` kpi-accent`:j===`spotlight`?` kpi-spotlight`:``}${M===`lg`?` kpi-lg`:M===`sm`?` kpi-sm`:``}${I?` kpi-attention`:``}${z?` ${z}`:``}`,Y=typeof N==`number`&&N>0?{...B,"--wui-kpi-value-size":`${N}px`}:B,X=O??y(D),Z=X===`up`?`arrow-up`:X===`down`?`arrow-down`:null,re=k!==void 0&&Object.hasOwn(v,k)?v[k]:``,Q=L==null?null:e(R,{href:L}),ie=F==null?``:` wui-kpi-icon-chart-${F}`,$=/* @__PURE__ */ f(u,{children:[w&&/* @__PURE__ */ d(`span`,{className:`kpi-icon${ie}${T?` kpi-icon-${T}`:``}${V?` ${V}`:``}`,children:s(w,{size:20,variant:E})}),/* @__PURE__ */ d(`div`,{className:`kpi-label${H?` ${H}`:``}`,children:x}),/* @__PURE__ */ d(`div`,{className:`kpi-value${U?` ${U}`:``}`,children:S}),C&&/* @__PURE__ */ d(`div`,{className:`kpi-caption${W?` ${W}`:``}`,children:C}),D&&/* @__PURE__ */ f(`div`,{className:`kpi-delta${X===`flat`?``:` ${X}`}${re}${G?` ${G}`:``}`,children:[Z&&/* @__PURE__ */ d(i,{name:Z,size:13}),D]}),A&&A.length>0&&/* @__PURE__ */ d(a,{data:A,className:`kpi-sparkline${K?` ${K}`:``}`})]});return Q===null?/* @__PURE__ */ d(`div`,{className:J,style:Y,...c,...q,children:$}):/* @__PURE__ */ d(t,{link:Q,className:J,style:Y,...c,...q,children:$})}export{b as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import ee from"./AppIcon.js";import a from"./AppSparkline.js";import o from"./assertValidValue.js";import s from"./renderIconProp.js";import c from"./textOf.js";import l from"./warnUnknownProps.js";import{Fragment as te,jsx as u,jsxs as d}from"react/jsx-runtime";import{KPI_TILE_TEXT as ne}from"@webority/ui-elements/text";var re=[`plain`,`filled`,`accent`,`spotlight`],ie=[`sm`,`md`,`lg`],ae=r,oe=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],se=[`up`,`down`,`flat`],f=[`above`,`below`],ce=[1,2,3,4,5,6,7,8],le=r.filter(e=>[`success`,`danger`,`neutral`].includes(e)),p={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function ue(e){let t=c(e).trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function m(r){let{marker:c,props:m}=i(`AppKpiTile`,r),h=n(`kpiTile`,ne),{label:g,value:_,caption:v,icon:y,iconTone:b,iconVariant:x=`twotone`,delta:S,deltaDirection:C,deltaTone:w,sparkline:T,variant:E=`plain`,size:D=`md`,valueSize:O,inline:de=!1,stacked:fe=!1,iconSlot:k,attention:pe=!1,href:A,linkComponent:me,className:j=``,style:M,iconClassName:N=``,labelClassName:P=``,valueClassName:F=``,captionClassName:I=``,deltaClassName:L=``,sparklineClassName:R=``,loading:z=!1,labelPosition:B=`above`,sparklineLabel:he,...V}=m;l(`AppKpiTile`,V),o(`AppKpiTile`,`variant`,E,re),o(`AppKpiTile`,`size`,D,ie),o(`AppKpiTile`,`iconTone`,b,ae),o(`AppKpiTile`,`iconVariant`,x,oe),o(`AppKpiTile`,`deltaDirection`,C,se),o(`AppKpiTile`,`deltaTone`,w,le),o(`AppKpiTile`,`iconSlot`,k,ce),o(`AppKpiTile`,`labelPosition`,B,f);let ge=E===`filled`?` kpi-filled`:E===`accent`?` kpi-accent`:E===`spotlight`?` kpi-spotlight`:``,_e=D===`lg`?` kpi-lg`:D===`sm`?` kpi-sm`:``,ve=de?` kpi-inline`:fe||E===`spotlight`?``:` wui-kpi-picked`,H=B===`below`,U=`kpi${ve}${ge}${_e}${pe?` kpi-attention`:``}${H?` wui-kpi-label-below`:``}${j?` ${j}`:``}`,W=typeof O==`number`&&O>0?{...M,"--wui-kpi-value-size":`${O}px`}:M,G=C??ue(S),K=G===`up`?`arrow-up`:G===`down`?`arrow-down`:null,ye=w!==void 0&&Object.hasOwn(p,w)?p[w]:``,q=A==null?null:e(me,{href:A}),J=k==null?``:` wui-kpi-icon-chart-${k}`,Y=!z&&_===null,X=z?{"aria-busy":!0}:{},be=z?/* @__PURE__ */ u(`span`,{className:`skeleton wui-kpi-skeleton`,"aria-hidden":`true`}):Y?h.noData:_,Z=/* @__PURE__ */ u(`div`,{className:`kpi-label${P?` ${P}`:``}`,children:g}),Q=/* @__PURE__ */ u(`div`,{className:`kpi-value${Y?` wui-kpi-nodata`:``}${F?` ${F}`:``}`,children:be}),$=/* @__PURE__ */ d(te,{children:[y&&/* @__PURE__ */ u(`span`,{className:`kpi-icon${J}${b?` kpi-icon-${b}`:``}${N?` ${N}`:``}`,children:s(y,{size:20,variant:x})}),H?Q:Z,H?Z:Q,!z&&v&&/* @__PURE__ */ u(`div`,{className:`kpi-caption${I?` ${I}`:``}`,children:v}),!z&&S&&/* @__PURE__ */ d(`div`,{className:`kpi-delta${G===`flat`?``:` ${G}`}${ye}${L?` ${L}`:``}`,children:[K&&/* @__PURE__ */ u(ee,{name:K,size:13}),S]}),!z&&T&&T.length>0&&/* @__PURE__ */ u(a,{data:T,label:he,className:`kpi-sparkline${R?` ${R}`:``}`})]});return q===null?/* @__PURE__ */ u(`div`,{className:U,style:W,...c,...X,...V,children:$}):/* @__PURE__ */ u(t,{link:q,className:U,style:W,...c,...X,...V,children:$})}export{m as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppBadge.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{DATA_TABLE_TEXT as s}from"@webority/ui-elements/text";var c=[`none`,`md`],l=[`saving`,`saved`,`error`],u=new Intl.NumberFormat(`en-IN`,{maximumFractionDigits:0});function d(d){let f=e(`dataTable`,s),{marker:p,props:m}=t(`AppListCard`,d),{title:h,subtitle:g,count:_,padding:v=`none`,actions:y,filters:b,saveState:x,className:S=``,children:C,...w}=m;i(`AppListCard`,w),r(`AppListCard`,`padding`,v,c),r(`AppListCard`,`saveState`,x,l);let T=[v===`none`?`card card-pad-none wui-list-card`:`card wui-list-card`,S].filter(Boolean).join(` `),E=!!h||y!==void 0||!!x,D=x===`saving`?f.saveBusyLabel:x===`saved`?f.saveDoneLabel:f.saveFailedLabel;return/* @__PURE__ */ o(`div`,{className:T,"data-wui-save-state":x||void 0,"aria-busy":x===`saving`?`true`:void 0,...p,...w,children:[E&&/* @__PURE__ */ o(`div`,{className:`card-header`,children:[/* @__PURE__ */ a(`div`,{className:`card-header-main`,children:/* @__PURE__ */ o(`div`,{className:`card-header-titles`,children:[h&&/* @__PURE__ */ o(`div`,{className:`card-title`,children:[h,_!==void 0&&/* @__PURE__ */ a(n,{className:`wui-list-card-count`,children:u.format(_)})]}),g&&/* @__PURE__ */ a(`div`,{className:`card-subtitle`,children:g})]})}),y!==void 0&&x!==`saving`&&/* @__PURE__ */ a(`div`,{className:`card-header-actions`,children:y}),x&&/* @__PURE__ */ a(`span`,{className:`wui-row-status wui-row-status-${x}`,role:`status`,children:D})]}),b!==void 0&&/* @__PURE__ */ a(`div`,{className:`wui-list-card-filters`,children:b}),/* @__PURE__ */ a(`div`,{className:`card-body`,children:C})]})}export{d as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{FIELD_SIZES 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"./AppInfoTip.js";import s from"./AppRequiredMark.js";import c from"./assertValidValue.js";import l from"./useWuiControl.js";import u from"./warnUnknownProps.js";import{useEffect as d,useId as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{MENTION_INPUT_TEXT as ee}from"@webority/ui-elements/text";var te=()=>import(`@webority/ui-elements/elements/mention-input`),ne=e=>typeof e==`object`&&!!e&&`query`in e&&typeof e.query==`string`;function g({ref:g,..._}){let v=r(`wui-mention-input`,te),y=i(`mentionInput`,ee),{marker:b,props:x}=a(`AppMentionInput`,_),{value:S,defaultValue:C,onChange:w,people:T,loadPeople:E,minChars:D,debounce:O,onSubmit:k,rows:A=3,placeholder:re,disabled:j=!1,readOnly:M=!1,loading:N=!1,size:P=`md`,name:F,id:I,label:L,error:R,helperText:z,required:B=!1,help:V,helpLabel:H=y.helpLabel,className:U=``,fieldClassName:W=``,...G}=x,K=n(F),q=R??K;u(`AppMentionInput`,G),c(`AppMentionInput`,`size`,P,t);let J=typeof E==`function`,Y=f(),X=I||`mention-${Y.replace(/[^a-zA-Z0-9_-]/g,``)}`,ie=q?`${X}-error`:z?`${X}-hint`:void 0,Z=p(N),Q=p(!1),{setRef:ae,innerRef:$}=l({ready:v,ref:g,value:S??(C===void 0?``:void 0),defaultValue:C,on:{change:e=>{let t=$.current;if(e.target===e.currentTarget&&t){if(typeof t.value!=`string`||!Array.isArray(t.mentions))throw TypeError(`<wui-mention-input> reported a change without its value and mentions.`);w?.(t.value,{mentions:t.mentions})}},"wui:mention-input:submit":()=>k?.()}});return d(()=>{let e=$.current;e&&v&&!J&&(e.people=T||[])},[T,J,v,$]),d(()=>{Z.current=N;let e=$.current;e&&v&&!Q.current&&(e.loading=N)},[N,v,$]),d(()=>{let e=$.current;if(!e||!v||!J)return;let t=0,n=null,r=async r=>{if(!(r instanceof CustomEvent))throw TypeError(`<wui-mention-input> search arrived without its query.`);let i=r.detail;if(!ne(i))throw TypeError(`<wui-mention-input> search arrived without its query.`);let a=i.query,o=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,Q.current=!0,e.loading=!0;try{let r=await E(a,{signal:n?.signal});o===t&&(e.people=r||[])}catch(r){if((r instanceof DOMException||r instanceof Error)&&r.name===`AbortError`)return;o===t&&(e.people=[],e.searchFailed=!0,n?.signal.aborted||reportError(r))}finally{o===t&&(Q.current=!1,e.loading=Z.current)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),Q.current=!1,e.loading=Z.current}},[J,E,v,$]),/* @__PURE__ */ h(`div`,{...b,className:`field${W?` ${W}`:``}`,children:[L&&/* @__PURE__ */ h(`label`,{className:`label`,htmlFor:`${X}-text`,children:[L,B&&/* @__PURE__ */ m(s,{}),V&&/* @__PURE__ */ m(o,{label:H,children:V})]}),/* @__PURE__ */ m(`wui-mention-input`,{ref:ae,id:X,class:U?`wui-mention-input ${U}`:`wui-mention-input`,label:typeof L==`string`?L:void 0,placeholder:re||void 0,rows:String(A),name:F||void 0,remote:J?``:void 0,"min-chars":D==null?void 0:String(D),debounce:O==null?void 0:String(O),disabled:j?``:void 0,readonly:M?``:void 0,loading:N?``:void 0,size:P===`md`?void 0:P,"aria-describedby":ie,"aria-invalid":q?`true`:void 0,...G}),/* @__PURE__ */ m(e,{error:q,hint:z,errorId:`${X}-error`,hintId:`${X}-hint`})]})}export{g as default};
1
+ import e from"../lib/FieldMessage.js";import{FIELD_SIZES 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"./AppInfoTip.js";import s from"./AppRequiredMark.js";import c from"./assertValidValue.js";import l from"./useWuiControl.js";import u from"./warnUnknownProps.js";import{useEffect as d,useId as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{MENTION_INPUT_TEXT as ee}from"@webority/ui-elements/text";var te=()=>import(`@webority/ui-elements/elements/mention-input`),ne=[`underline`],re=e=>typeof e==`object`&&!!e&&`query`in e&&typeof e.query==`string`;function g({ref:g,..._}){let v=r(`wui-mention-input`,te),y=i(`mentionInput`,ee),{marker:b,props:x}=a(`AppMentionInput`,_),{value:S,defaultValue:C,onChange:w,people:T,loadPeople:E,minChars:D,debounce:O,onSubmit:k,rows:A=3,placeholder:ie,disabled:j=!1,readOnly:M=!1,loading:N=!1,size:P=`md`,variant:F,name:I,id:L,label:R,error:z,helperText:B,required:V=!1,help:H,helpLabel:U=y.helpLabel,className:W=``,fieldClassName:G=``,...K}=x,q=n(I),J=z??q;u(`AppMentionInput`,K),c(`AppMentionInput`,`size`,P,t),c(`AppMentionInput`,`variant`,F,ne);let Y=typeof E==`function`,ae=f(),X=L||`mention-${ae.replace(/[^a-zA-Z0-9_-]/g,``)}`,oe=J?`${X}-error`:B?`${X}-hint`:void 0,Z=p(N),Q=p(!1),{setRef:se,innerRef:$}=l({ready:v,ref:g,value:S??(C===void 0?``:void 0),defaultValue:C,on:{change:e=>{let t=$.current;if(e.target===e.currentTarget&&t){if(typeof t.value!=`string`||!Array.isArray(t.mentions))throw TypeError(`<wui-mention-input> reported a change without its value and mentions.`);w?.(t.value,{mentions:t.mentions})}},"wui:mention-input:submit":()=>k?.()}});return d(()=>{let e=$.current;e&&v&&!Y&&(e.people=T||[])},[T,Y,v,$]),d(()=>{Z.current=N;let e=$.current;e&&v&&!Q.current&&(e.loading=N)},[N,v,$]),d(()=>{let e=$.current;if(!e||!v||!Y)return;let t=0,n=null,r=async r=>{if(!(r instanceof CustomEvent))throw TypeError(`<wui-mention-input> search arrived without its query.`);let i=r.detail;if(!re(i))throw TypeError(`<wui-mention-input> search arrived without its query.`);let a=i.query,o=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,Q.current=!0,e.loading=!0;try{let r=await E(a,{signal:n?.signal});o===t&&(e.people=r||[])}catch(r){if((r instanceof DOMException||r instanceof Error)&&r.name===`AbortError`)return;o===t&&(e.people=[],e.searchFailed=!0,n?.signal.aborted||reportError(r))}finally{o===t&&(Q.current=!1,e.loading=Z.current)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),Q.current=!1,e.loading=Z.current}},[Y,E,v,$]),/* @__PURE__ */ h(`div`,{...b,className:`field${G?` ${G}`:``}`,children:[R&&/* @__PURE__ */ h(`label`,{className:`label`,htmlFor:`${X}-text`,children:[R,V&&/* @__PURE__ */ m(s,{}),H&&/* @__PURE__ */ m(o,{label:U,children:H})]}),/* @__PURE__ */ m(`wui-mention-input`,{ref:se,id:X,class:`wui-mention-input${F===`underline`?` wui-input-underline`:``}${W?` ${W}`:``}`,label:typeof R==`string`?R:void 0,placeholder:ie||void 0,rows:String(A),name:I||void 0,remote:Y?``:void 0,"min-chars":D==null?void 0:String(D),debounce:O==null?void 0:String(O),disabled:j?``:void 0,readonly:M?``:void 0,loading:N?``:void 0,size:P===`md`?void 0:P,"aria-describedby":oe,"aria-invalid":J?`true`:void 0,...K}),/* @__PURE__ */ m(e,{error:J,hint:B,errorId:`${X}-error`,hintId:`${X}-hint`})]})}export{g as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{useCallback as a,useEffect as o,useRef as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{DATE_PICKER_TEXT as u,MINI_CALENDAR_TEXT as d}from"@webority/ui-elements/text";var f=()=>import(`@webority/ui-elements/elements/mini-calendar`),p=[`monday`,`sunday`],m=[`neutral`,`warning`],h=/^(\d{4})-(\d{2})$/,g=864e5,_=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)))/g,v=e=>(/* @__PURE__ */ new Date(e*g)).toISOString().slice(0,10),y=e=>(/* @__PURE__ */ new Date(e*g)).getUTCDay(),b=()=>new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}).format(/* @__PURE__ */ new Date),x=(e,t)=>new Intl.DateTimeFormat(`en`,{...t,timeZone:`UTC`}).format(/* @__PURE__ */ new Date(e*g));function S({ref:g,...S}){e(`wui-mini-calendar`,f);let{marker:C,props:w}=n(`AppMiniCalendar`,S),T=t(`datePicker`,u),E=t(`miniCalendar`,d),{month:D,onMonthChange:O,value:k,onChange:A,markers:j=[],rangeStart:M=null,rangeEnd:N=null,firstDay:P=`monday`,label:F=E.label,className:I=``,...L}=w;i(`AppMiniCalendar`,L),r(`AppMiniCalendar`,`firstDay`,P,p);let R=s(null),z=a(e=>{R.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]);o(()=>{let e=R.current;if(!e)return;let t=e=>{let t=e instanceof CustomEvent?e.detail?.value:void 0;typeof t==`string`&&A?.(t)},n=e=>{let t=e instanceof CustomEvent?e.detail?.month:void 0;typeof t==`string`&&O?.(t)};return e.addEventListener(`wui-mini-calendar:select`,t),e.addEventListener(`wui-mini-calendar:navigate`,n),()=>{e.removeEventListener(`wui-mini-calendar:select`,t),e.removeEventListener(`wui-mini-calendar:navigate`,n)}},[A,O]);let B=D??b().slice(0,7),V=h.exec(B);if(!V)throw Error(`AppMiniCalendar: month must be YYYY-MM, got "${B}".`);let H=Number(V[1]),U=Number(V[2])-1,W=/* @__PURE__ */ new Map;for(let e of j){r(`AppMiniCalendar`,`markers.tone`,e.tone??`neutral`,m);let t=W.get(e.date),n=e.tone??`neutral`,i=[...t?.labels??[],...e.label?[e.label]:[]];W.set(e.date,{tone:t?.tone===`warning`||n===`warning`?`warning`:`neutral`,labels:i})}let G=_(`${H}-${String(U+1).padStart(2,`0`)}-01`),K=new Date(Date.UTC(H,U+1,0)).getUTCDate(),q=(y(G)-(P===`sunday`?0:1)+7)%7,J=Math.ceil((q+K)/7)*7,Y=b(),X=Array.from({length:J},(e,t)=>{let n=G-q+t,r=v(n),i=W.get(r),a=r.slice(0,7)===B,o=y(n)===0||y(n)===6,s=M!==null&&N!==null&&r>=M&&r<=N,u=k===r,d=r===Y,f=x(n,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),p=i?.labels.length?`${f}, ${i.labels.join(`; `)}`:f,m=[`wui-mini-calendar-day`,a?``:`is-outside`,o?`wui-mini-calendar-day--weekend`:``,d?`is-today`:``,u?`is-selected`:``,s?`wui-mini-calendar-day--in-range`:``,i?`has-marker`:``].filter(Boolean).join(` `);return/* @__PURE__ */ l(`button`,{type:`button`,className:m,"data-date":r,"aria-label":p,"aria-pressed":u||void 0,"aria-current":d?`date`:void 0,children:[/* @__PURE__ */ c(`span`,{className:`wui-mini-calendar-day-number`,"aria-hidden":`true`,children:Number(r.slice(8,10))}),i&&/* @__PURE__ */ c(`span`,{className:`wui-mini-calendar-marker wui-mini-calendar-marker--${i.tone}`,"aria-hidden":`true`})]},r)}),Z=X.slice(0,7).map((e,t)=>x(G-q+t,{weekday:`short`})),Q=x(G,{month:`long`,year:`numeric`});return/* @__PURE__ */ l(`wui-mini-calendar`,{...C,...L,ref:z,className:`wui-mini-calendar${I?` ${I}`:``}`,role:`group`,"aria-label":F,"data-month":B,children:[/* @__PURE__ */ l(`div`,{className:`wui-mini-calendar-head`,children:[/* @__PURE__ */ c(`button`,{type:`button`,className:`wui-mini-calendar-nav`,"data-nav":`-1`,"aria-label":T.previousMonth,children:/* @__PURE__ */ c(`span`,{"aria-hidden":`true`,children:`‹`})}),/* @__PURE__ */ c(`div`,{className:`wui-mini-calendar-title`,"aria-live":`polite`,children:Q}),/* @__PURE__ */ c(`button`,{type:`button`,className:`wui-mini-calendar-nav`,"data-nav":`1`,"aria-label":T.nextMonth,children:/* @__PURE__ */ c(`span`,{"aria-hidden":`true`,children:`›`})})]}),/* @__PURE__ */ c(`div`,{className:`wui-mini-calendar-weekdays`,"aria-hidden":`true`,children:Z.map(e=>/* @__PURE__ */ c(`span`,{children:e},e))}),/* @__PURE__ */ c(`div`,{className:`wui-mini-calendar-grid`,children:X})]})}export{S as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./renderIconProp.js";import o from"./warnUnknownProps.js";import{Fragment as s,useId as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{NAVIGATION_MENU_TEXT as d}from"@webority/ui-elements/text";var f=()=>import(`@webority/ui-elements/elements/navigation-menu`);function p(p){n(`wui-navigation-menu`,f);let m=r(`navigationMenu`,d),{marker:h,props:g}=i(`AppNavigationMenu`,p),{items:_=[],ariaLabel:v=m.ariaLabel,linkComponent:y,className:b=``,...x}=g;o(`AppNavigationMenu`,x);let S=c();return/* @__PURE__ */ l(`wui-navigation-menu`,{class:[`wui-nav-menu`,b].filter(Boolean).join(` `),...h,...x,children:/* @__PURE__ */ l(`nav`,{"aria-label":v,children:/* @__PURE__ */ l(`ul`,{className:`wui-nav-menu-list`,children:_.map((n,r)=>{let i=n.group&&n.group!==_[r-1]?.group?/* @__PURE__ */ l(`li`,{className:`wui-nav-menu-group`,role:`presentation`,children:n.group},`${n.key}-group`):null;if(!n.links?.length)return/* @__PURE__ */ u(s,{children:[i,/* @__PURE__ */ l(`li`,{className:`wui-nav-menu-item`,children:/* @__PURE__ */ l(t,{link:e(y,{href:n.to}),className:`wui-nav-menu-toplink`,"aria-current":n.current?`page`:void 0,children:n.label})})]},n.key);let o=`${S}-${n.key}`;return/* @__PURE__ */ u(s,{children:[i,/* @__PURE__ */ u(`li`,{className:`wui-nav-menu-item`,children:[/* @__PURE__ */ u(`button`,{type:`button`,className:n.current?`wui-nav-menu-trigger is-current`:`wui-nav-menu-trigger`,"aria-expanded":`false`,"aria-controls":o,"data-key":n.key,children:[n.label,a(`chevron-down`,{size:14,className:`wui-nav-menu-chevron`})]}),/* @__PURE__ */ l(`div`,{className:`wui-nav-menu-panel`,id:o,children:/* @__PURE__ */ l(`ul`,{className:`wui-nav-menu-links`,children:n.links.map(n=>/* @__PURE__ */ l(`li`,{children:/* @__PURE__ */ u(t,{link:e(y,{href:n.to}),className:`wui-nav-menu-link`,"aria-current":n.current?`page`:void 0,children:[a(n.icon,{size:18}),/* @__PURE__ */ u(`span`,{className:`wui-nav-menu-link-text`,children:[/* @__PURE__ */ l(`span`,{className:`wui-nav-menu-link-label`,children:n.label}),n.description?/* @__PURE__ */ l(`span`,{className:`wui-nav-menu-link-desc`,children:n.description}):null]})]})},n.key))})})]})]},n.key)})})})})}export{p as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import{Fragment as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{NAVIGATION_MENU_TEXT as f}from"@webority/ui-elements/text";var p=[`pills`,`underline`,`text`],m=()=>import(`@webority/ui-elements/elements/navigation-menu`);function h(h){n(`wui-navigation-menu`,m);let g=r(`navigationMenu`,f),{marker:_,props:v}=i(`AppNavigationMenu`,h),{items:y=[],ariaLabel:b=g.ariaLabel,variant:x=`pills`,flush:S=!1,linkComponent:C,className:w=``,...T}=v;if(s(`AppNavigationMenu`,T),a(`AppNavigationMenu`,`variant`,x,p),S&&x!==`underline`)throw Error(`AppNavigationMenu: flush works only with variant="underline", not "${x}".`);let E=l();return/* @__PURE__ */ u(`wui-navigation-menu`,{class:[`wui-nav-menu`,x===`pills`?``:`wui-nav-menu-${x}`,S?`wui-nav-menu-flush`:``,w].filter(Boolean).join(` `),..._,...T,children:/* @__PURE__ */ u(`nav`,{"aria-label":b,children:/* @__PURE__ */ u(`ul`,{className:`wui-nav-menu-list`,children:y.map((n,r)=>{let i=n.group&&n.group!==y[r-1]?.group?/* @__PURE__ */ u(`li`,{className:`wui-nav-menu-group`,role:`presentation`,children:n.group},`${n.key}-group`):null;if(!n.links?.length)return/* @__PURE__ */ d(c,{children:[i,/* @__PURE__ */ u(`li`,{className:`wui-nav-menu-item`,children:/* @__PURE__ */ u(t,{link:e(C,{href:n.to}),className:`wui-nav-menu-toplink`,"aria-current":n.current?`page`:void 0,children:n.label})})]},n.key);let a=`${E}-${n.key}`;return/* @__PURE__ */ d(c,{children:[i,/* @__PURE__ */ d(`li`,{className:`wui-nav-menu-item`,children:[/* @__PURE__ */ d(`button`,{type:`button`,className:n.current||n.links.some(e=>e.current)?`wui-nav-menu-trigger is-current`:`wui-nav-menu-trigger`,"aria-expanded":`false`,"aria-controls":a,"data-key":n.key,children:[n.label,o(`chevron-down`,{size:14,className:`wui-nav-menu-chevron`})]}),/* @__PURE__ */ u(`div`,{className:`wui-nav-menu-panel`,id:a,children:/* @__PURE__ */ u(`ul`,{className:`wui-nav-menu-links`,children:n.links.map(n=>/* @__PURE__ */ u(`li`,{children:/* @__PURE__ */ d(t,{link:e(C,{href:n.to}),className:`wui-nav-menu-link`,"aria-current":n.current?`page`:void 0,children:[o(n.icon,{size:18}),/* @__PURE__ */ d(`span`,{className:`wui-nav-menu-link-text`,children:[/* @__PURE__ */ u(`span`,{className:`wui-nav-menu-link-label`,children:n.label}),n.description?/* @__PURE__ */ u(`span`,{className:`wui-nav-menu-link-desc`,children:n.description}):null]})]})},n.key))})})]})]},n.key)})})})})}export{h as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./AppTabs.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{groupNotificationsByDay as l,notificationCountText as u,notificationTime as d,notificationTriggerLabel as f,notificationUnreadAnnouncement as p}from"@webority/ui-elements/helpers";import{useEffect as m,useId as h,useLayoutEffect as g,useRef as _,useState as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import{NOTIFICATION_CENTRE_TEXT as S}from"@webority/ui-elements/text";var C=[`all`,`unread`,`archived`],w=`a, button, input, select, textarea`,ee=()=>import(`@webority/ui-elements/elements/notification-center`);function T(e){n(`wui-notification-center`,ee);let t=r(`notificationCentre`,S),{marker:s,props:d}=i(`AppNotificationCenter`,e),{items:y,unread:C,label:w=t.label,emptyText:T=t.emptyText,viewAllHref:O,defaultOpen:A=!1,now:j,onMarkAllRead:M,onItemClick:N,renderItem:P,tabs:F,onTabChange:I,onOpenChange:L,linkComponent:R,className:z=``,...B}=d;if(c(`AppNotificationCenter`,B),!Array.isArray(y))throw Error(`<AppNotificationCenter> items is required: pass the notifications, newest first.`);let V=te(F,t),[H,U]=v(V[0]?.key),W=V.some(e=>e.key===H)?H:V[0]?.key,G=e=>{e!==W&&(U(e),I?.(e))},K=h(),q=h(),J=_(null),Y=_(L);Y.current=L,m(()=>{let e=J.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:notification-center:toggle carried no CustomEvent`);let t=e.detail;if(typeof t!=`object`||!t||!(`open`in t))throw Error(`wui:notification-center:toggle carried no open flag in its detail`);Y.current?.(!!t.open)};return e.addEventListener(`wui:notification-center:toggle`,t),()=>e.removeEventListener(`wui:notification-center:toggle`,t)},[]);let X=_(A);g(()=>{if(!X.current)return;let e=J.current;e&&(e.setAttribute(`open`,``),e.querySelector(`.wui-notification-center-trigger`)?.setAttribute(`aria-expanded`,`true`))},[]);let Z=C??y.filter(e=>!e.read&&!e.archived).length,[ne,re]=v(``),Q=_(Z);m(()=>{Q.current!==Z&&(Q.current=Z,re(p(Z)))},[Z]);let $=l(V.length>0?E(y,W):y,j),ie=[`wui-notification-center`,z].filter(Boolean).join(` `);return/* @__PURE__ */ x(`wui-notification-center`,{ref:J,class:ie,label:w,controlled:``,...s,...B,children:[/* @__PURE__ */ x(`button`,{type:`button`,className:`topbar-icon-btn wui-notification-center-trigger`,"aria-expanded":X.current?`true`:`false`,"aria-controls":K,"aria-haspopup":`dialog`,"aria-label":f(w,Z),children:[/* @__PURE__ */ b(a,{name:`notification`,size:20}),/* @__PURE__ */ b(`span`,{className:`wui-notification-center-count`,"aria-hidden":`true`,hidden:Z===0,children:u(Z)})]}),/* @__PURE__ */ b(`span`,{className:`visually-hidden wui-notification-center-live`,"aria-live":`polite`,children:ne}),/* @__PURE__ */ x(`div`,{className:`wui-notification-center-panel`,popover:`auto`,id:K,role:`dialog`,"aria-labelledby":q,tabIndex:-1,children:[/* @__PURE__ */ x(`div`,{className:`wui-notification-center-head`,children:[/* @__PURE__ */ b(`h2`,{className:`wui-notification-center-title`,id:q,children:w}),M&&/* @__PURE__ */ b(`button`,{type:`button`,className:`wui-notification-center-markall`,disabled:Z===0,onClick:M,children:t.markAllLabel})]}),W!==void 0&&/* @__PURE__ */ b(`div`,{className:`wui-notification-center-tabs`,children:/* @__PURE__ */ b(o,{tabs:V,value:W,onChange:G,size:`sm`,fitted:!0,ariaLabel:w})}),$.length===0?/* @__PURE__ */ b(`p`,{className:`wui-notification-center-empty`,children:T}):/* @__PURE__ */ b(`div`,{className:`wui-notification-center-list`,children:$.map(e=>/* @__PURE__ */ x(`section`,{"aria-labelledby":`${K}-${e.key}`,children:[/* @__PURE__ */ b(`h3`,{className:`wui-notification-center-day`,id:`${K}-${e.key}`,children:e.heading}),/* @__PURE__ */ b(`ul`,{className:`wui-notification-center-items`,children:e.items.map(e=>/* @__PURE__ */ b(`li`,{children:/* @__PURE__ */ b(k,{item:e,onItemClick:N,renderItem:P,linkComponent:R})},e.id))})]},e.key))}),O&&/* @__PURE__ */ b(D,{href:O,linkComponent:R})]})]})}function te(e,t){let n={all:t.allLabel,unread:t.unreadLabel,archived:t.archivedLabel};return e===!0?C.map(e=>({key:e,label:n[e]})):Array.isArray(e)?e.map(e=>(s(`AppNotificationCenter`,`tabs[].key`,e.key,C),{key:e.key,label:e.label??n[e.key]})):[]}function E(e,t){if(t===`archived`)return e.filter(e=>e.archived);let n=e.filter(e=>!e.archived);return t===`unread`?n.filter(e=>!e.read):n}function D({href:n,linkComponent:i}){let a=r(`notificationCentre`,S),o=e(i,{href:n}),s=o.Tag===`a`?void 0:e=>O(e.currentTarget);return/* @__PURE__ */ b(t,{link:o,className:`wui-notification-center-foot`,onClick:s,children:a.viewAllLabel})}function O(e){e.closest(`wui-notification-center`)?.close?.()}function k({item:n,onItemClick:i,renderItem:o,linkComponent:s}){let c=r(`notificationCentre`,S),l=`wui-notification-center-item${n.read?` wui-notification-center-item-read`:``}`,u=!n.read&&/* @__PURE__ */ b(`span`,{className:`visually-hidden wui-notification-center-unread-label`,children:`${c.unreadPrefixText} `}),f=/* @__PURE__ */ b(`span`,{className:`wui-notification-center-dot`,"aria-hidden":`true`});if(o){let e=i?e=>{let t=e.target;t instanceof Element&&!t.closest(w)&&i(n,e)}:void 0;return/* @__PURE__ */ x(`div`,{className:l,"data-id":n.id,tabIndex:-1,onClick:e,children:[f,/* @__PURE__ */ x(`span`,{className:`wui-notification-center-body`,children:[u,o(n)]})]})}let p=d(n.at),m=/* @__PURE__ */ x(y,{children:[f,n.icon&&/* @__PURE__ */ b(`span`,{className:`wui-notification-center-icon`,children:/* @__PURE__ */ b(a,{name:n.icon,size:18})}),/* @__PURE__ */ x(`span`,{className:`wui-notification-center-body`,children:[u,/* @__PURE__ */ b(`span`,{className:`wui-notification-center-item-title`,children:n.title}),n.text&&/* @__PURE__ */ b(`span`,{className:`wui-notification-center-item-text`,children:n.text}),p&&/* @__PURE__ */ b(`time`,{className:`wui-notification-center-when`,dateTime:String(n.at),children:p})]})]}),h=i?e=>i(n,e):void 0;if(n.href){let r=e(s,{href:n.href});return/* @__PURE__ */ b(t,{link:r,className:l,"data-id":n.id,onClick:e=>{i?.(n,e),r.Tag!==`a`&&O(e.currentTarget)},children:m})}return/* @__PURE__ */ b(`button`,{type:`button`,className:l,"data-id":n.id,onClick:h,children:m})}export{T as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./AppTabs.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{groupNotificationsByDay as l,notificationCountText as u,notificationTime as d,notificationTriggerLabel as f,notificationUnreadAnnouncement as p}from"@webority/ui-elements/helpers";import{useEffect as m,useId as h,useLayoutEffect as ee,useRef as g,useState as _}from"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import{NOTIFICATION_CENTRE_TEXT as x}from"@webority/ui-elements/text";var S=[`all`,`unread`,`archived`],C=`a, button, input, select, textarea`,w=[`relative`,`exact`],te=()=>import(`@webority/ui-elements/elements/notification-center`);function T(e){n(`wui-notification-center`,te);let t=r(`notificationCentre`,x),{marker:d,props:v}=i(`AppNotificationCenter`,e),{items:S,unread:C,label:T=t.label,emptyText:D=t.emptyText,loading:k=!1,error:A,dayLabels:j=`relative`,earlierHref:M,viewAllHref:N,defaultOpen:P=!1,now:F,onMarkAllRead:I,onItemClick:L,renderItem:ae,tabs:oe,onTabChange:se,onOpenChange:R,linkComponent:z,className:B=``,...V}=v;if(c(`AppNotificationCenter`,V),!Array.isArray(S))throw Error(`<AppNotificationCenter> items is required: pass the notifications, newest first.`);s(`AppNotificationCenter`,`dayLabels`,j,w);let H=ne(oe,t),[U,W]=_(H[0]?.key),G=H.some(e=>e.key===U)?U:H[0]?.key,ce=e=>{e!==G&&(W(e),se?.(e))},K=h(),q=h(),J=g(null),Y=g(R);Y.current=R,m(()=>{let e=J.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:notification-center:toggle carried no CustomEvent`);let t=e.detail;if(typeof t!=`object`||!t||!(`open`in t))throw Error(`wui:notification-center:toggle carried no open flag in its detail`);Y.current?.(!!t.open)};return e.addEventListener(`wui:notification-center:toggle`,t),()=>e.removeEventListener(`wui:notification-center:toggle`,t)},[]);let X=g(P);ee(()=>{if(!X.current)return;let e=J.current;e&&(e.setAttribute(`open`,``),e.querySelector(`.wui-notification-center-trigger`)?.setAttribute(`aria-expanded`,`true`))},[]);let Z=C??S.filter(e=>!e.read&&!e.archived).length,[le,ue]=_(``),Q=g(Z);m(()=>{Q.current!==Z&&(Q.current=Z,ue(p(Z)))},[Z]);let $=l(H.length>0?re(S,G):S,F),de=[`wui-notification-center`,B].filter(Boolean).join(` `);return/* @__PURE__ */ b(`wui-notification-center`,{ref:J,class:de,label:T,controlled:``,...d,...V,children:[/* @__PURE__ */ b(`button`,{type:`button`,className:`topbar-icon-btn wui-notification-center-trigger`,"aria-expanded":X.current?`true`:`false`,"aria-controls":K,"aria-haspopup":`dialog`,"aria-label":f(T,Z),children:[/* @__PURE__ */ y(a,{name:`notification`,size:20}),/* @__PURE__ */ y(`span`,{className:`wui-notification-center-count`,"aria-hidden":`true`,hidden:Z===0,children:u(Z)})]}),/* @__PURE__ */ y(`span`,{className:`visually-hidden wui-notification-center-live`,"aria-live":`polite`,children:le}),/* @__PURE__ */ b(`div`,{className:`wui-notification-center-panel`,popover:`auto`,id:K,role:`dialog`,"aria-labelledby":q,tabIndex:-1,children:[/* @__PURE__ */ b(`div`,{className:`wui-notification-center-head`,children:[/* @__PURE__ */ y(`h2`,{className:`wui-notification-center-title`,id:q,children:T}),I&&/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-notification-center-markall`,disabled:Z===0,onClick:I,children:t.markAllLabel})]}),G!==void 0&&/* @__PURE__ */ y(`div`,{className:`wui-notification-center-tabs`,children:/* @__PURE__ */ y(o,{tabs:H,value:G,onChange:ce,size:`sm`,fitted:!0,ariaLabel:T})}),A?/* @__PURE__ */ b(`div`,{className:`wui-notification-center-error`,role:`alert`,children:[/* @__PURE__ */ y(`p`,{className:`wui-notification-center-error-text`,children:A.text??t.errorText}),/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-notification-center-retry`,onClick:A.onRetry,children:t.retryLabel})]}):k?/* @__PURE__ */ y(`p`,{className:`wui-notification-center-loading`,role:`status`,children:t.loadingText}):$.length===0?/* @__PURE__ */ y(`p`,{className:`wui-notification-center-empty`,children:D}):/* @__PURE__ */ y(`div`,{className:`wui-notification-center-list`,children:$.map(e=>/* @__PURE__ */ b(`section`,{"aria-labelledby":`${K}-${e.key}`,children:[/* @__PURE__ */ y(`h3`,{className:`wui-notification-center-day`,id:`${K}-${e.key}`,children:j===`exact`?e.key:e.heading}),/* @__PURE__ */ y(`ul`,{className:`wui-notification-center-items`,children:e.items.map(e=>/* @__PURE__ */ y(`li`,{children:/* @__PURE__ */ y(O,{item:e,onItemClick:L,renderItem:ae,linkComponent:z})},e.id))})]},e.key))}),H.length>0&&!A&&!k&&M&&/* @__PURE__ */ y(ie,{href:M,hidden:G!==`unread`,linkComponent:z}),N&&/* @__PURE__ */ y(E,{href:N,linkComponent:z})]})]})}function ne(e,t){let n={all:t.allLabel,unread:t.unreadLabel,archived:t.archivedLabel};return e===!0?S.map(e=>({key:e,label:n[e]})):Array.isArray(e)?e.map(e=>(s(`AppNotificationCenter`,`tabs[].key`,e.key,S),{key:e.key,label:e.label??n[e.key]})):[]}function re(e,t){if(t===`archived`)return e.filter(e=>e.archived);let n=e.filter(e=>!e.archived);return t===`unread`?n.filter(e=>!e.read):n}function ie({href:n,hidden:i,linkComponent:a}){let o=r(`notificationCentre`,x),s=e(a,{href:n}),c=s.Tag===`a`?void 0:e=>D(e.currentTarget);return/* @__PURE__ */ y(t,{link:s,className:`wui-notification-center-earlier`,hidden:i,onClick:c,children:o.earlierLabel})}function E({href:n,linkComponent:i}){let a=r(`notificationCentre`,x),o=e(i,{href:n}),s=o.Tag===`a`?void 0:e=>D(e.currentTarget);return/* @__PURE__ */ y(t,{link:o,className:`wui-notification-center-foot`,onClick:s,children:a.viewAllLabel})}function D(e){e.closest(`wui-notification-center`)?.close?.()}function O({item:n,onItemClick:i,renderItem:o,linkComponent:s}){let c=r(`notificationCentre`,x),l=`wui-notification-center-item${n.read?` wui-notification-center-item-read`:``}`,u=!n.read&&/* @__PURE__ */ y(`span`,{className:`visually-hidden wui-notification-center-unread-label`,children:`${c.unreadPrefixText} `}),f=/* @__PURE__ */ y(`span`,{className:`wui-notification-center-dot`,"aria-hidden":`true`});if(o){let e=i?e=>{let t=e.target;t instanceof Element&&!t.closest(C)&&i(n,e)}:void 0;return/* @__PURE__ */ b(`div`,{className:l,"data-id":n.id,tabIndex:-1,onClick:e,children:[f,/* @__PURE__ */ b(`span`,{className:`wui-notification-center-body`,children:[u,o(n)]})]})}let p=d(n.at),m=/* @__PURE__ */ b(v,{children:[f,n.icon&&/* @__PURE__ */ y(`span`,{className:`wui-notification-center-icon`,children:/* @__PURE__ */ y(a,{name:n.icon,size:18})}),/* @__PURE__ */ b(`span`,{className:`wui-notification-center-body`,children:[u,/* @__PURE__ */ y(`span`,{className:`wui-notification-center-item-title`,children:n.title}),n.text&&/* @__PURE__ */ y(`span`,{className:`wui-notification-center-item-text`,children:n.text}),p&&/* @__PURE__ */ y(`time`,{className:`wui-notification-center-when`,dateTime:String(n.at),children:p})]})]}),h=i?e=>i(n,e):void 0;if(n.href){let r=e(s,{href:n.href});return/* @__PURE__ */ y(t,{link:r,className:l,"data-id":n.id,onClick:e=>{i?.(n,e),r.Tag!==`a`&&D(e.currentTarget)},children:m})}return/* @__PURE__ */ y(`button`,{type:`button`,className:l,"data-id":n.id,onClick:h,children:m})}export{T as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"../lib/fieldState.js";import{useFieldError as n}from"../lib/formFields.js";import{groupIndianText as r}from"../lib/indianGrouping.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import ee from"./AppIcon.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import o from"./assertValidValue.js";import re from"./warnUnknownProps.js";import{cloneElement as ie,useCallback as ae,useEffect as oe,useId as se,useLayoutEffect as ce,useRef as s,useState as c}from"react";import{Fragment as le,jsx as l,jsxs as u}from"react/jsx-runtime";import{NUMBER_INPUT_TEXT as ue}from"@webority/ui-elements/text";import{Form as d}from"react-bootstrap";var de=[`sm`,`md`,`lg`,`xl`],fe=[`none`,`indian`],f=e=>{if(e===``||e==null)return null;let t=parseFloat(e.replace(/,/g,``));return Number.isNaN(t)?null:t};function p(e,t){if(t!=null&&t!==``&&t!==!1)throw Error(`<AppNumberInput> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}var m=(e,t)=>e.slice(0,t).replace(/\D/g,``).length,h=(e,t)=>{if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/\d/.test(e.charAt(r))&&++n===t)return r+1;return e.length},g=(e,t,n)=>{let i=t>0&&typeof e==`number`&&Number.isFinite(e)?e.toFixed(t):String(e??``);return n===`indian`?r(i):i};function _({ref:_,...pe}){let{marker:v,props:me}=a(`AppNumberInput`,pe),y=i(`numberInput`,ue),{label:b,required:x=!1,optional:S=!1,error:C,helperText:w,help:T,helpLabel:he=y.helpLabel,decreaseLabel:ge=y.decreaseLabel,increaseLabel:_e=y.increaseLabel,optionalLabel:ve=y.optionalLabel,value:E,onChange:D,min:O,max:k,step:ye=1,precision:A=0,grouping:j=`none`,unit:M,size:N=`md`,id:be,name:P,className:xe=``,fieldClassName:F=``,disabled:I=!1,readOnly:L=!1,loading:R=!1,controlOnly:z=!1,defaultValue:B,...V}=me,Se=n(P),H=C??Se,U=L||R;re(`AppNumberInput`,V),o(`AppNumberInput`,`size`,N,de),o(`AppNumberInput`,`grouping`,j,fe),z&&(p(`label`,b),p(`error`,C),p(`helperText`,w),p(`help`,T),p(`optional`,S),p(`fieldClassName`,F));let Ce=se(),W=be||Ce,we=e=>{if(A===0)return Math.round(e);let t=10**A;return Math.round(e*t)/t},G=e=>{let t=e;return typeof O==`number`&&(t=Math.max(t,O)),typeof k==`number`&&(t=Math.min(t,k)),t},K=e=>g(e,A,j),[q,J]=c(()=>K(E??B)),Te=s(j);oe(()=>{let e=E??B,t=Te.current!==j;Te.current=j,J(n=>!t&&f(n)===(e??null)?n:g(t&&E===void 0?f(n):e,A,j))},[E,B,A,j]);let Y=s(null),X=s(null),[,Ee]=c(0),De=ae(e=>{Y.current=e,typeof _==`function`?_(e):_&&(_.current=e)},[_]);ce(()=>{let e=X.current,t=Y.current;if(e===null||t===null)return;X.current=null;let n=h(q,e);t.setSelectionRange(n,n)});let Z=e=>{let t=(f(q)??G(0))+e*ye,n=G(we(t));J(K(n)),D?.(n)},Q=f(q),Oe=I||L||R||Q!==null&&typeof O==`number`&&Q<=O,ke=I||L||R||Q!==null&&typeof k==`number`&&Q>=k,Ae=H&&W?`${W}-error`:void 0,je=w&&W?`${W}-hint`:void 0,Me=Ae||je,Ne=[`input`,N===`sm`?`wui-input-sm`:``,N===`lg`?`wui-input-lg`:``,N===`xl`?`wui-input-xl`:``,H?`error`:``,`num-input`,xe,R?t:``].filter(Boolean).join(` `),Pe=RegExp(`^${typeof O==`number`&&O>=0?``:`-?`}\\d*${A>0?`(\\.\\d*)?`:``}$`),Fe=(e,t)=>{let n=j===`indian`?e.replace(/,/g,``):e;if(!Pe.test(n))return;let i=j===`indian`?r(n):n;if(i!==e&&i===q){let e=h(i,t);queueMicrotask(()=>Y.current?.setSelectionRange(e,e))}else i!==e&&(X.current=t,Ee(e=>e+1));J(i);let a=f(n);n===``?D?.(null):a!==null&&D?.(a)},Ie=e=>{let t=e.target.value;Fe(t,m(t,e.target.selectionStart??t.length))},Le=e=>{if(U){V.onBlur?.(e);return}let t=f(e.target.value);if(t===null)J(``),D?.(null);else{let e=G(we(t));J(K(e)),D?.(e)}V.onBlur?.(e)},Re=e=>{if(U)V.onKeyDown?.(e);else{if(j===`indian`&&(e.key===`Backspace`||e.key===`Delete`)){let t=e.currentTarget.value,n=e.currentTarget.selectionStart;if(n!==null&&e.currentTarget.selectionEnd===n){let r=e.key===`Backspace`?n-1:n,i=e.key===`Backspace`?n-2:n+1;i>=0&&t.charAt(r)===`,`&&/\d/.test(t.charAt(i))&&(e.preventDefault(),Fe(t.slice(0,i)+t.slice(i+1),m(t,i)))}}e.ctrlKey||e.metaKey||e.altKey||(e.key===`ArrowUp`?(e.preventDefault(),Z(1)):e.key===`ArrowDown`&&(e.preventDefault(),Z(-1))),V.onKeyDown?.(e)}},ze=/* @__PURE__ */ l(d.Control,{"aria-invalid":H?`true`:`false`,...V,id:W,name:j===`indian`?void 0:P,type:`text`,inputMode:A>0?`decimal`:`numeric`,className:Ne,disabled:I,readOnly:U,"aria-busy":R||void 0,required:x,"aria-describedby":Me,value:q,ref:De,onChange:Ie,onBlur:Le,onKeyDown:Re}),Be=[`num-wrap`,N===`sm`?`wui-num-wrap-sm`:``,N===`lg`?`wui-num-wrap-lg`:``,N===`xl`?`wui-num-wrap-xl`:``].filter(Boolean).join(` `),Ve=/* @__PURE__ */ u(`div`,{className:Be,children:[/* @__PURE__ */ l(`button`,{type:`button`,className:`num-btn`,"aria-label":ge,tabIndex:-1,disabled:Oe,onClick:()=>Z(-1),children:/* @__PURE__ */ l(ee,{name:`minus`,size:16})}),ze,M&&/* @__PURE__ */ l(`span`,{className:`affix`,children:M}),/* @__PURE__ */ l(`button`,{type:`button`,className:`num-btn`,"aria-label":_e,tabIndex:-1,disabled:ke,onClick:()=>Z(1),children:/* @__PURE__ */ l(ee,{name:`plus`,size:16})})]}),$=j===`indian`&&P?/* @__PURE__ */ l(`input`,{type:`hidden`,name:P,value:q.replace(/,/g,``),disabled:I,"data-wui-number-plain":``}):null;return z?/* @__PURE__ */ u(le,{children:[ie(Ve,v),$]}):/* @__PURE__ */ u(d.Group,{...v,"data-grouping":j===`indian`?j:void 0,className:`field${F?` ${F}`:``}`,children:[b&&/* @__PURE__ */ u(d.Label,{className:`label`,htmlFor:W,children:[b,S&&!x&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${ve}`}),x&&/* @__PURE__ */ l(ne,{}),T&&/* @__PURE__ */ l(te,{label:he,children:T})]}),Ve,$,/* @__PURE__ */ l(e,{error:H,hint:w,errorId:Ae,hintId:je})]})}export{_ as default};
1
+ import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"../lib/fieldState.js";import{useFieldError as n}from"../lib/formFields.js";import{groupIndianText as r}from"../lib/indianGrouping.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import ee from"./AppInfoTip.js";import te from"./AppRequiredMark.js";import s from"./assertValidValue.js";import ne from"./warnUnknownProps.js";import{cloneElement as re,useCallback as ie,useEffect as ae,useId as oe,useLayoutEffect as se,useRef as c,useState as l}from"react";import{Fragment as ce,jsx as u,jsxs as d}from"react/jsx-runtime";import{NUMBER_INPUT_TEXT as le}from"@webority/ui-elements/text";import{Form as f}from"react-bootstrap";var ue=[`sm`,`md`,`lg`,`xl`],de=[`none`,`indian`],fe=[`underline`],p=e=>{if(e===``||e==null)return null;let t=parseFloat(e.replace(/,/g,``));return Number.isNaN(t)?null:t};function m(e,t){if(t!=null&&t!==``&&t!==!1)throw Error(`<AppNumberInput> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}var h=(e,t)=>e.slice(0,t).replace(/\D/g,``).length,g=(e,t)=>{if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/\d/.test(e.charAt(r))&&++n===t)return r+1;return e.length},_=(e,t,n)=>{let i=t>0&&typeof e==`number`&&Number.isFinite(e)?e.toFixed(t):String(e??``);return n===`indian`?r(i):i};function v({ref:v,...pe}){let{marker:me,props:he}=a(`AppNumberInput`,pe),y=i(`numberInput`,le),{label:b,required:x=!1,optional:ge=!1,error:_e,helperText:S,help:C,helpLabel:ve=y.helpLabel,decreaseLabel:ye=y.decreaseLabel,increaseLabel:be=y.increaseLabel,optionalLabel:xe=y.optionalLabel,value:w,onChange:T,min:E,max:D,step:Se=1,precision:O=0,grouping:k=`none`,unit:A,size:j=`md`,variant:M,id:Ce,name:N,className:we=``,fieldClassName:P=``,disabled:F=!1,readOnly:I=!1,loading:L=!1,steppers:R=!0,controlOnly:Te=!1,defaultValue:z,...B}=he,Ee=n(N),V=_e??Ee,H=I||L;ne(`AppNumberInput`,B),s(`AppNumberInput`,`size`,j,ue),s(`AppNumberInput`,`grouping`,k,de),s(`AppNumberInput`,`variant`,M,fe),Te&&(m(`label`,b),m(`error`,_e),m(`helperText`,S),m(`help`,C),m(`optional`,ge),m(`fieldClassName`,P));let De=oe(),U=Ce||De,Oe=e=>{if(O===0)return Math.round(e);let t=10**O;return Math.round(e*t)/t},W=e=>{let t=e;return typeof E==`number`&&(t=Math.max(t,E)),typeof D==`number`&&(t=Math.min(t,D)),t},G=e=>_(e,O,k),[K,q]=l(()=>G(w??z)),ke=c(k);ae(()=>{let e=w??z,t=ke.current!==k;ke.current=k,q(n=>!t&&p(n)===(e??null)?n:_(t&&w===void 0?p(n):e,O,k))},[w,z,O,k]);let J=c(null),Y=c(null),[,Ae]=l(0),je=ie(e=>{J.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]);se(()=>{let e=Y.current,t=J.current;if(e===null||t===null)return;Y.current=null;let n=g(K,e);t.setSelectionRange(n,n)});let X=e=>{let t=(p(K)??W(0))+e*Se,n=W(Oe(t));q(G(n)),T?.(n)},Z=p(K),Me=F||I||L||Z!==null&&typeof E==`number`&&Z<=E,Ne=F||I||L||Z!==null&&typeof D==`number`&&Z>=D,Pe=V&&U?`${U}-error`:void 0,Q=S&&U?`${U}-hint`:void 0,Fe=Pe||Q,Ie=[`input`,j===`sm`?`wui-input-sm`:``,j===`lg`?`wui-input-lg`:``,j===`xl`?`wui-input-xl`:``,V?`error`:``,`num-input`,we,L?t:``].filter(Boolean).join(` `),Le=RegExp(`^${typeof E==`number`&&E>=0?``:`-?`}\\d*${O>0?`(\\.\\d*)?`:``}$`),Re=(e,t)=>{let n=k===`indian`?e.replace(/,/g,``):e;if(!Le.test(n))return;let i=k===`indian`?r(n):n;if(i!==e&&i===K){let e=g(i,t);queueMicrotask(()=>J.current?.setSelectionRange(e,e))}else i!==e&&(Y.current=t,Ae(e=>e+1));q(i);let a=p(n);n===``?T?.(null):a!==null&&T?.(a)},ze=e=>{let t=e.target.value;Re(t,h(t,e.target.selectionStart??t.length))},Be=e=>{if(H){B.onBlur?.(e);return}let t=p(e.target.value);if(t===null)q(``),T?.(null);else{let e=W(Oe(t));q(G(e)),T?.(e)}B.onBlur?.(e)},Ve=e=>{if(H)B.onKeyDown?.(e);else{if(k===`indian`&&(e.key===`Backspace`||e.key===`Delete`)){let t=e.currentTarget.value,n=e.currentTarget.selectionStart;if(n!==null&&e.currentTarget.selectionEnd===n){let r=e.key===`Backspace`?n-1:n,i=e.key===`Backspace`?n-2:n+1;i>=0&&t.charAt(r)===`,`&&/\d/.test(t.charAt(i))&&(e.preventDefault(),Re(t.slice(0,i)+t.slice(i+1),h(t,i)))}}e.ctrlKey||e.metaKey||e.altKey||(e.key===`ArrowUp`?(e.preventDefault(),X(1)):e.key===`ArrowDown`&&(e.preventDefault(),X(-1))),B.onKeyDown?.(e)}},He=/* @__PURE__ */ u(f.Control,{"aria-invalid":V?`true`:`false`,...B,id:U,name:k===`indian`?void 0:N,type:`text`,inputMode:O>0?`decimal`:`numeric`,className:Ie,disabled:F,readOnly:H,"aria-busy":L||void 0,required:x,"aria-describedby":Fe,value:K,ref:je,onChange:ze,onBlur:Be,onKeyDown:Ve}),Ue=[`num-wrap`,j===`sm`?`wui-num-wrap-sm`:``,j===`lg`?`wui-num-wrap-lg`:``,j===`xl`?`wui-num-wrap-xl`:``,M===`underline`?`wui-input-underline`:``].filter(Boolean).join(` `),We=/* @__PURE__ */ d(`div`,{className:Ue,children:[R&&/* @__PURE__ */ u(`button`,{type:`button`,className:`num-btn`,"aria-label":ye,tabIndex:-1,disabled:Me,onClick:()=>X(-1),children:/* @__PURE__ */ u(o,{name:`minus`,size:16})}),He,A&&/* @__PURE__ */ u(`span`,{className:`affix`,children:A}),R&&/* @__PURE__ */ u(`button`,{type:`button`,className:`num-btn`,"aria-label":be,tabIndex:-1,disabled:Ne,onClick:()=>X(1),children:/* @__PURE__ */ u(o,{name:`plus`,size:16})})]}),$=k===`indian`&&N?/* @__PURE__ */ u(`input`,{type:`hidden`,name:N,value:K.replace(/,/g,``),disabled:F,"data-wui-number-plain":``}):null;return Te?/* @__PURE__ */ d(ce,{children:[re(We,me),$]}):/* @__PURE__ */ d(f.Group,{...me,"data-grouping":k===`indian`?k:void 0,className:`field${P?` ${P}`:``}`,children:[b&&/* @__PURE__ */ d(f.Label,{className:`label`,htmlFor:U,children:[b,ge&&!x&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${xe}`}),x&&/* @__PURE__ */ u(te,{}),C&&/* @__PURE__ */ u(ee,{label:ve,children:C})]}),We,$,/* @__PURE__ */ u(e,{error:V,hint:S,errorId:Pe,hintId:Q})]})}export{v as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppButton.js";import i from"./AppIcon.js";import a from"./warnUnknownProps.js";import{useEffect as o,useRef as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{OFFLINE_BANNER_TEXT as u}from"@webority/ui-elements/text";var d=()=>import(`@webority/ui-elements/elements/offline-banner`),f=`wui:offline-banner:check-again`;function p(p){e(`wui-offline-banner`,d);let{marker:m,props:h}=n(`AppOfflineBanner`,p),{offline:g,loadedAt:_,onCheckAgain:v,className:y=``,...b}=h;a(`AppOfflineBanner`,b);let x=t(`offlineBanner`,u),S=s(null);o(()=>{let e=S.current;if(e&&v)return e.addEventListener(f,v),()=>e.removeEventListener(f,v)},[v]);let C=_?x.loadedAtText.replace(`{time}`,()=>_):x.loadedText,w=[`wui-offline-banner`,y].filter(Boolean).join(` `);return/* @__PURE__ */ l(`wui-offline-banner`,{ref:S,class:w,role:`status`,hidden:!0,offline:g===void 0?void 0:String(g),...m,...b,children:[/* @__PURE__ */ c(`span`,{className:`wui-offline-banner-icon`,children:/* @__PURE__ */ c(i,{name:`wifi`,size:18})}),/* @__PURE__ */ l(`div`,{className:`wui-offline-banner-body`,children:[/* @__PURE__ */ c(`span`,{className:`wui-offline-banner-offline`,children:`${x.offlineText} ${C}`}),/* @__PURE__ */ c(`span`,{className:`wui-offline-banner-back`,children:x.backOnlineText})]}),v&&/* @__PURE__ */ c(`div`,{className:`wui-offline-banner-action`,children:/* @__PURE__ */ c(r,{className:`wui-offline-banner-check`,variant:`solid`,leftIcon:`refresh-cw`,children:x.checkAgainLabel})})]})}export{p as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import{useFieldError as ee}from"../lib/formFields.js";import n from"../lib/useElementEntry.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{cloneElement as u,useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{OTP_INPUT_TEXT as m}from"@webority/ui-elements/text";var h=[`numeric`,`alphanumeric`],g=()=>import(`@webority/ui-elements/elements/otp`);function _({ref:_,...v}){let y=n(`wui-otp`,g),{marker:b,props:x}=i(`AppOtpInput`,v),S=r(`otpInput`,m),{value:C,defaultValue:w,onChange:T,onComplete:E,length:D=6,mode:O=`numeric`,size:k=`md`,label:A,required:j=!1,optional:M=!1,optionalLabel:N=S.optionalLabel,helperText:P,help:F,helpLabel:I=S.helpLabel,error:L,disabled:R=!1,readOnly:z=!1,loading:B=!1,name:V,id:H,className:U=``,fieldClassName:W=``,...G}=x,K=ee(V),q=L??K;l(`AppOtpInput`,G),s(`AppOtpInput`,`mode`,O,h),s(`AppOtpInput`,`size`,k,t);let J=d(),Y=H||J,X=q?`${Y}-error`:void 0,Z=P?`${Y}-hint`:void 0,Q=X||Z,{setRef:te}=c({ready:y,ref:_,value:C??(w===void 0?``:void 0),onChange:T,on:{complete:e=>E?.(e.detail)}}),$=/* @__PURE__ */ f(`wui-otp`,{"aria-label":typeof A==`string`?A:void 0,ref:te,id:Y,name:V,length:String(D),mode:O,size:k===`md`?void 0:k,value:(C??w)||void 0,"aria-describedby":Q,"aria-invalid":q?`true`:void 0,disabled:R?``:void 0,readonly:z?``:void 0,loading:B?``:void 0,required:j?``:void 0,className:U||void 0,...G});return!A&&!q&&!P?u($,b):/* @__PURE__ */ p(`div`,{...b,className:`field${W?` ${W}`:``}`,children:[A&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:Y,children:[A,M&&!j&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${N}`}),j&&/* @__PURE__ */ f(o,{}),F&&/* @__PURE__ */ f(a,{label:I,children:F})]}),$,/* @__PURE__ */ f(e,{error:q,hint:P,errorId:X,hintId:Z})]})}export{_ as default};
1
+ import e from"../lib/FieldMessage.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import{useFieldError as ee}from"../lib/formFields.js";import n from"../lib/useElementEntry.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{cloneElement as u,useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{OTP_INPUT_TEXT as m}from"@webority/ui-elements/text";var h=[`numeric`,`alphanumeric`],g=[`underline`],_=()=>import(`@webority/ui-elements/elements/otp`);function v({ref:v,...y}){let b=n(`wui-otp`,_),{marker:x,props:S}=i(`AppOtpInput`,y),C=r(`otpInput`,m),{value:w,defaultValue:T,onChange:E,onComplete:D,length:O=6,mode:k=`numeric`,size:A=`md`,variant:j,label:M,required:N=!1,optional:P=!1,optionalLabel:F=C.optionalLabel,helperText:I,help:L,helpLabel:R=C.helpLabel,error:z,disabled:te=!1,readOnly:B=!1,loading:V=!1,name:H,id:U,className:W=``,fieldClassName:G=``,...K}=S,q=ee(H),J=z??q;l(`AppOtpInput`,K),s(`AppOtpInput`,`mode`,k,h),s(`AppOtpInput`,`size`,A,t),s(`AppOtpInput`,`variant`,j,g);let Y=d(),X=U||Y,Z=J?`${X}-error`:void 0,Q=I?`${X}-hint`:void 0,ne=Z||Q,{setRef:re}=c({ready:b,ref:v,value:w??(T===void 0?``:void 0),onChange:E,on:{complete:e=>D?.(e.detail)}}),ie=[j===`underline`?`wui-input-underline`:void 0,W].filter(Boolean).join(` `),$=/* @__PURE__ */ f(`wui-otp`,{"aria-label":typeof M==`string`?M:void 0,ref:re,id:X,name:H,length:String(O),mode:k,size:A===`md`?void 0:A,value:(w??T)||void 0,"aria-describedby":ne,"aria-invalid":J?`true`:void 0,disabled:te?``:void 0,readonly:B?``:void 0,loading:V?``:void 0,required:N?``:void 0,className:ie||void 0,...K});return!M&&!J&&!I?u($,x):/* @__PURE__ */ p(`div`,{...x,className:`field${G?` ${G}`:``}`,children:[M&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:X,children:[M,P&&!N&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ f(o,{}),L&&/* @__PURE__ */ f(a,{label:R,children:L})]}),$,/* @__PURE__ */ f(e,{error:J,hint:I,errorId:Z,hintId:Q})]})}export{v as default};
@@ -1 +1 @@
1
- import{devError as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import{BreadcrumbTrailContext as ee}from"./AppBreadcrumbs.js";import te from"./AppIcon.js";import a from"./assertValidValue.js";import ne from"./warnUnknownProps.js";import{formatNumber as re}from"@webority/ui-elements/helpers";import{useEffect as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{PAGE_HEADER_TEXT as u,fillText as d}from"@webority/ui-elements/text";var f=[`sm`,`md`,`lg`,`bar`],ie=[`start`,`center`],ae=[`inline`,`below`],oe=[`below`,`inline`],p=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],m=`.btn-primary`,h=()=>import(`@webority/ui-elements/elements/overflow`),g=[`views`,`tools`,`meta`,`bulk`],_={views:`tabs (app-tabs) under the header`,tools:`filters in the table toolbar (app-table-toolbar)`,meta:`facts in the header's description or a fact list below it`,bulk:`bulk actions in the table toolbar's bulk slot`},se=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},ce=e=>e!=null&&e!==!1&&e!==``;function v({children:e}){t(`wui-overflow`,h);let r=n(`pageHeader`,u);return/* @__PURE__ */ c(`wui-overflow`,{class:`wui-page-header-actions`,label:r.moreLabel,keep:m,children:/* @__PURE__ */ c(`div`,{className:`page-actions`,"data-wui-overflow-list":``,children:e})})}function y(t){let{marker:m,props:h}=i(`AppPageHeader`,t),y=n(`pageHeader`,u),{title:b,titleSlot:x,as:S=`h1`,subtitle:C,eyebrow:w,icon:T,tone:E=`primary`,status:D,breadcrumbs:O,actions:k,views:A,tools:j,meta:M,metaPlacement:N=`inline`,subtitlePlacement:P=`below`,bulkFor:F,bulk:I,size:L=`md`,align:R=`start`,divider:z=!1,sticky:B=!1,foldActions:V=!1,className:H=``,...U}=h;if(ne(`AppPageHeader`,U),a(`AppPageHeader`,`tone`,E,r.filter(e=>e!==`neutral`)),a(`AppPageHeader`,`size`,L,f),a(`AppPageHeader`,`align`,R,ie),a(`AppPageHeader`,`as`,S,p),a(`AppPageHeader`,`metaPlacement`,N,ae),a(`AppPageHeader`,`subtitlePlacement`,P,oe),L!==`bar`&&se()){let t={views:A,tools:j,meta:M,bulk:I};for(let n of g)ce(t[n])&&e(`app-page-header-${n} is drawn only when size="bar". On a ${L} header, put ${_[n]} instead.`);V&&e(`foldActions works only when size="bar". On a ${L} header it has no effect; drop it or use size="bar".`)}let W=p.includes(S)?S:`h1`,G=L===`bar`,K=G&&N===`below`,q=!G&&P===`inline`,J=[`page-header`,L&&L!==`md`?`page-header-${L}`:``,R===`center`?`page-header-center`:``,z?`page-header-divider`:``,B?`page-header-sticky`:``,E&&E!==`primary`?`tone-${E}`:``,K?`wui-page-header-meta-below`:``,q?`wui-page-header-subtitle-inline`:``,H].filter(Boolean).join(` `),[Y,le]=s(0),X=G?F:void 0;o(()=>{if(!X)return;document.getElementById(X)?.setAttribute(`data-wui-bulk-in-bar`,``);let e=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail;typeof t?.selected==`number`&&e.target instanceof Node&&document.getElementById(X)?.contains(e.target)&&le(t.selected)};return document.addEventListener(`selectionchange`,e),()=>{document.removeEventListener(`selectionchange`,e),document.getElementById(X)?.removeAttribute(`data-wui-bulk-in-bar`)}},[X]);let Z=b!=null||x!=null?/* @__PURE__ */ c(W,{className:x==null?`page-title`:`page-title wui-page-title-slot`,"aria-label":x!=null&&typeof b==`string`&&b!==``?b:void 0,children:x??b}):null;if(G)return/* @__PURE__ */ l(`header`,{className:J,"data-wui-page-header-bar":``,"data-wui-bulk-for":F||void 0,...m,...U,children:[O!=null&&/* @__PURE__ */ c(ee,{value:!0,children:/* @__PURE__ */ c(`div`,{className:`page-header-bar-crumbs`,children:O})}),Z,D!=null&&/* @__PURE__ */ c(`span`,{className:`page-status`,children:D}),A!=null&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-views`,"data-wui-bar-swap":``,hidden:F&&Y>0?!0:void 0,children:A}),/* @__PURE__ */ c(`span`,{className:`page-header-bar-spacer`,"aria-hidden":`true`}),M!=null&&!K&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-meta`,children:M}),j!=null&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-tools`,"data-wui-bar-swap":``,hidden:F&&Y>0?!0:void 0,children:j}),F?/* @__PURE__ */ l(`div`,{className:`page-header-bar-bulk`,"data-wui-bar-bulk":``,hidden:Y===0||void 0,children:[/* @__PURE__ */ c(`span`,{className:`page-header-bar-bulk-count`,"aria-live":`polite`,children:Y>0?d(y.selectedText,{count:re(Y,{decimals:0})}):``}),I]}):null,k!=null&&(V?/* @__PURE__ */ c(v,{children:k}):/* @__PURE__ */ c(`div`,{className:`page-actions`,children:k})),M!=null&&K&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-meta`,children:M})]});let Q=T==null?null:typeof T==`string`?/* @__PURE__ */ c(te,{name:T,size:20}):T,$=C==null?null:/* @__PURE__ */ c(`div`,{className:`page-subtitle`,children:C});return/* @__PURE__ */ l(`div`,{className:J,...m,...U,children:[O!=null&&/* @__PURE__ */ c(`div`,{className:`page-breadcrumbs`,children:O}),/* @__PURE__ */ l(`div`,{className:`page-header-bar`,children:[/* @__PURE__ */ l(`div`,{className:`page-header-lead`,children:[Q!=null&&/* @__PURE__ */ c(`span`,{className:`page-header-icon`,children:Q}),/* @__PURE__ */ l(`div`,{className:`page-header-titles`,children:[w!=null&&/* @__PURE__ */ c(`div`,{className:`page-eyebrow`,children:w}),/* @__PURE__ */ l(`div`,{className:`page-titlebar`,children:[Z,D!=null&&/* @__PURE__ */ c(`span`,{className:`page-status`,children:D}),q&&$]}),!q&&$]})]}),k!=null&&/* @__PURE__ */ c(`div`,{className:`page-actions`,children:k})]})]})}export{y as default};
1
+ import{devError as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import n from"../lib/useStickyLayer.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import{BreadcrumbTrailContext as te}from"./AppBreadcrumbs.js";import ne from"./AppIcon.js";import a from"./assertValidValue.js";import re from"./warnUnknownProps.js";import{formatNumber as ie}from"@webority/ui-elements/helpers";import{useEffect as ae,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{PAGE_HEADER_TEXT as u,fillText as oe}from"@webority/ui-elements/text";var se=[`sm`,`md`,`lg`,`bar`],d=[`start`,`center`],f=[`inline`,`below`],ce=[`below`,`inline`],p=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],m=`.btn-primary`,h=()=>import(`@webority/ui-elements/elements/overflow`),le=[`views`,`tools`,`meta`,`bulk`],ue={views:`tabs (app-tabs) under the header`,tools:`filters in the table toolbar (app-table-toolbar)`,meta:`facts in the header's description or a fact list below it`,bulk:`bulk actions in the table toolbar's bulk slot`},de=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},g=e=>e!=null&&e!==!1&&e!==``;function _({children:e}){t(`wui-overflow`,h);let n=r(`pageHeader`,u);return/* @__PURE__ */ c(`wui-overflow`,{class:`wui-page-header-actions`,label:n.moreLabel,keep:m,children:/* @__PURE__ */ c(`div`,{className:`page-actions`,"data-wui-overflow-list":``,children:e})})}function v(t){let{marker:m,props:h}=ee(`AppPageHeader`,t),v=r(`pageHeader`,u),{title:y,titleSlot:b,as:x=`h1`,subtitle:S,eyebrow:C,icon:w,tone:T=`primary`,status:E,breadcrumbs:D,actions:O,views:k,tools:A,meta:j,metaPlacement:M=`inline`,subtitlePlacement:N=`below`,bulkFor:P,bulk:F,size:I=`md`,align:L=`start`,divider:R=!1,sticky:z=!1,foldActions:B=!1,className:V=``,...H}=h;if(re(`AppPageHeader`,H),a(`AppPageHeader`,`tone`,T,i.filter(e=>e!==`neutral`)),a(`AppPageHeader`,`size`,I,se),a(`AppPageHeader`,`align`,L,d),a(`AppPageHeader`,`as`,x,p),a(`AppPageHeader`,`metaPlacement`,M,f),a(`AppPageHeader`,`subtitlePlacement`,N,ce),I!==`bar`&&de()){let t={views:k,tools:A,meta:j,bulk:F};for(let n of le)g(t[n])&&e(`app-page-header-${n} is drawn only when size="bar". On a ${I} header, put ${ue[n]} instead.`);B&&e(`foldActions works only when size="bar". On a ${I} header it has no effect; drop it or use size="bar".`)}let fe=p.includes(x)?x:`h1`,U=I===`bar`,W=U&&M===`below`,G=!U&&N===`inline`,K=[`page-header`,I&&I!==`md`?`page-header-${I}`:``,L===`center`?`page-header-center`:``,R?`page-header-divider`:``,z?`page-header-sticky`:``,T&&T!==`primary`?`tone-${T}`:``,W?`wui-page-header-meta-below`:``,G?`wui-page-header-subtitle-inline`:``,V].filter(Boolean).join(` `),q=o(null),J=o(null);n(q,z&&U),n(J,z&&!U);let[Y,pe]=s(0),X=U?P:void 0;ae(()=>{if(!X)return;document.getElementById(X)?.setAttribute(`data-wui-bulk-in-bar`,``);let e=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail;typeof t?.selected==`number`&&e.target instanceof Node&&document.getElementById(X)?.contains(e.target)&&pe(t.selected)};return document.addEventListener(`selectionchange`,e),()=>{document.removeEventListener(`selectionchange`,e),document.getElementById(X)?.removeAttribute(`data-wui-bulk-in-bar`)}},[X]);let Z=y!=null||b!=null?/* @__PURE__ */ c(fe,{className:b==null?`page-title`:`page-title wui-page-title-slot`,"aria-label":b!=null&&typeof y==`string`&&y!==``?y:void 0,children:b??y}):null;if(U)return/* @__PURE__ */ l(`header`,{ref:q,className:K,"data-wui-sticky-layer":z?``:void 0,"data-wui-page-header-bar":``,"data-wui-bulk-for":P||void 0,...m,...H,children:[D!=null&&/* @__PURE__ */ c(te,{value:!0,children:/* @__PURE__ */ c(`div`,{className:`page-header-bar-crumbs`,children:D})}),Z,E!=null&&/* @__PURE__ */ c(`span`,{className:`page-status`,children:E}),k!=null&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-views`,"data-wui-bar-swap":``,hidden:P&&Y>0?!0:void 0,children:k}),/* @__PURE__ */ c(`span`,{className:`page-header-bar-spacer`,"aria-hidden":`true`}),j!=null&&!W&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-meta`,children:j}),A!=null&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-tools`,"data-wui-bar-swap":``,hidden:P&&Y>0?!0:void 0,children:A}),P?/* @__PURE__ */ l(`div`,{className:`page-header-bar-bulk`,"data-wui-bar-bulk":``,hidden:Y===0||void 0,children:[/* @__PURE__ */ c(`span`,{className:`page-header-bar-bulk-count`,"aria-live":`polite`,children:Y>0?oe(v.selectedText,{count:ie(Y,{decimals:0})}):``}),F]}):null,O!=null&&(B?/* @__PURE__ */ c(_,{children:O}):/* @__PURE__ */ c(`div`,{className:`page-actions`,children:O})),j!=null&&W&&/* @__PURE__ */ c(`div`,{className:`page-header-bar-meta`,children:j})]});let Q=w==null?null:typeof w==`string`?/* @__PURE__ */ c(ne,{name:w,size:20}):w,$=S==null?null:/* @__PURE__ */ c(`div`,{className:`page-subtitle`,children:S});return/* @__PURE__ */ l(`div`,{ref:J,className:K,"data-wui-sticky-layer":z?``:void 0,...m,...H,children:[D!=null&&/* @__PURE__ */ c(`div`,{className:`page-breadcrumbs`,children:D}),/* @__PURE__ */ l(`div`,{className:`page-header-bar`,children:[/* @__PURE__ */ l(`div`,{className:`page-header-lead`,children:[Q!=null&&/* @__PURE__ */ c(`span`,{className:`page-header-icon`,children:Q}),/* @__PURE__ */ l(`div`,{className:`page-header-titles`,children:[C!=null&&/* @__PURE__ */ c(`div`,{className:`page-eyebrow`,children:C}),/* @__PURE__ */ l(`div`,{className:`page-titlebar`,children:[Z,E!=null&&/* @__PURE__ */ c(`span`,{className:`page-status`,children:E}),G&&$]}),!G&&$]})]}),O!=null&&/* @__PURE__ */ c(`div`,{className:`page-actions`,children:O})]})]})}export{v as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{FIELD_SIZES as t}from"../lib/fieldState.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import{useFieldError as r}from"../lib/formFields.js";import i from"../lib/useElementEntry.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 ee from"./useWuiControl.js";import u from"./warnUnknownProps.js";import{useEffect as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{PHONE_NUMBER_INPUT_TEXT as h}from"@webority/ui-elements/text";var g=()=>import(`@webority/ui-elements/elements/phone`);function _({ref:_,...v}){let y=i(`wui-phone`,g),{marker:b,props:x}=o(`AppPhoneNumberInput`,v),S=a(`phoneNumberInput`,h),{value:C,onChange:w,country:T,lockedCountry:E,disabled:D=!1,readOnly:O=!1,loading:k=!1,defaultValue:A,help:j,helpLabel:M=S.helpLabel,name:N,id:P,label:F=S.label,placeholder:I,required:L=!1,optional:R=!1,optionalLabel:z=S.optionalLabel,helperText:B,error:V,showFlag:H=!0,showDialCode:U=!0,size:W=`md`,fieldClassName:G=``,...K}=x,q=r(N),J=V??q;u(`AppPhoneNumberInput`,K),l(`AppPhoneNumberInput`,`size`,W,t),d(()=>{H&&n()},[H]);let Y=f(),X=P||Y,Z=J&&X?`${X}-error`:void 0,Q=!J&&B&&X?`${X}-hint`:void 0,{setRef:$}=ee({ready:y,ref:_,value:C??(A===void 0?``:void 0),defaultValue:A,onChange:w,events:[`input`,`change`]});return/* @__PURE__ */ m(`div`,{...b,className:`field app-phone-number-input${W===`sm`?` wui-phone-sm`:``}${W===`lg`?` wui-phone-lg`:``}${W===`xl`?` wui-phone-xl`:``}${G?` ${G}`:``}`,children:[F&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:X,children:[F,R&&!L&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${z}`}),L&&/* @__PURE__ */ p(c,{}),j&&/* @__PURE__ */ p(s,{label:M,children:j})]}),/* @__PURE__ */ p(`wui-phone`,{ref:$,id:X,name:N,"aria-label":typeof F==`string`?F:void 0,"aria-describedby":Z||Q,"aria-invalid":J?`true`:void 0,country:E||T,"locked-country":E||void 0,placeholder:I,required:L?``:void 0,disabled:D?``:void 0,readonly:O?``:void 0,loading:k?``:void 0,"hide-flag":H?void 0:``,"hide-dial":U?void 0:``,"external-error":``,...K}),/* @__PURE__ */ p(e,{error:J,hint:B,errorId:Z,hintId:Q})]})}export{_ as default};
1
+ import e from"../lib/FieldMessage.js";import{FIELD_SIZES as t}from"../lib/fieldState.js";import{loadFlagStyles as n}from"../lib/flagStyles.js";import{useFieldError as r}from"../lib/formFields.js";import i from"../lib/useElementEntry.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"./useWuiControl.js";import d from"./warnUnknownProps.js";import{useEffect as f,useId as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{PHONE_NUMBER_INPUT_TEXT as g}from"@webority/ui-elements/text";var _=()=>import(`@webority/ui-elements/elements/phone`),v=[`underline`];function y({ref:y,...ee}){let te=i(`wui-phone`,_),{marker:ne,props:b}=o(`AppPhoneNumberInput`,ee),x=a(`phoneNumberInput`,g),{value:S,onChange:C,country:w,lockedCountry:T,disabled:E=!1,readOnly:D=!1,loading:O=!1,defaultValue:k,help:A,helpLabel:j=x.helpLabel,name:M,id:N,label:P=x.label,placeholder:re,required:F=!1,optional:I=!1,optionalLabel:L=x.optionalLabel,helperText:R,error:z,showFlag:B=!0,showDialCode:V=!0,size:H=`md`,fieldClassName:U=``,className:W=``,valid:G=!1,variant:K,...q}=b,J=r(M),Y=z??J;d(`AppPhoneNumberInput`,q),l(`AppPhoneNumberInput`,`size`,H,t),l(`AppPhoneNumberInput`,`variant`,K,v);let X=[W,K===`underline`?`wui-input-underline`:``,G&&!Y?`wui-valid`:``].filter(Boolean).join(` `);f(()=>{B&&n()},[B]);let ie=p(),Z=N||ie,Q=Y&&Z?`${Z}-error`:void 0,$=!Y&&R&&Z?`${Z}-hint`:void 0,{setRef:ae}=u({ready:te,ref:y,value:S??(k===void 0?``:void 0),defaultValue:k,onChange:C,events:[`input`,`change`]});return/* @__PURE__ */ h(`div`,{...ne,className:`field app-phone-number-input${H===`sm`?` wui-phone-sm`:``}${H===`lg`?` wui-phone-lg`:``}${H===`xl`?` wui-phone-xl`:``}${U?` ${U}`:``}`,children:[P&&/* @__PURE__ */ h(`label`,{className:`label`,htmlFor:Z,children:[P,I&&!F&&/* @__PURE__ */ m(`span`,{className:`label-optional`,children:` ${L}`}),F&&/* @__PURE__ */ m(c,{}),A&&/* @__PURE__ */ m(s,{label:j,children:A})]}),/* @__PURE__ */ m(`wui-phone`,{ref:ae,id:Z,name:M,"aria-label":typeof P==`string`?P:void 0,"aria-describedby":Q||$,"aria-invalid":Y?`true`:void 0,country:T||w,"locked-country":T||void 0,placeholder:re,required:F?``:void 0,disabled:E?``:void 0,readonly:D?``:void 0,loading:O?``:void 0,"hide-flag":B?void 0:``,"hide-dial":V?void 0:``,className:X||void 0,"external-error":``,...q}),/* @__PURE__ */ m(e,{error:Y,hint:R,errorId:Q,hintId:$})]})}export{y as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppAccordion.js";import r from"./AppButton.js";import i from"./AppCheckbox.js";import a from"./AppProgress.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{QUEUE_BUNDLE_TEXT as d}from"@webority/ui-elements/text";var f=[`idle`,`busy`,`done`,`failed`];function p(p){let{marker:m,props:h}=t(`AppQueueBundle`,p),g=e(`queueBundle`,d),{title:_,reason:v,rows:y,onApprove:b,running:x,className:S=``,...C}=h;s(`AppQueueBundle`,C);for(let e of y)e.status!==void 0&&o(`AppQueueBundle`,`rows.status`,e.status,f);let[w,T]=c(()=>new Set(y.filter(e=>e.checked===!1).map(e=>e.key))),E={busy:g.statusBusyLabel,done:g.statusDoneLabel,failed:g.statusFailedLabel},D=e=>e.status??`idle`,O=e=>{let t=D(e);return t===`idle`||t===`failed`},k=x!==void 0,A=y.length>0&&y.every(e=>D(e)===`done`),j=y.some(e=>D(e)===`failed`),M=y.filter(e=>O(e)&&!w.has(e.key)).map(e=>e.key),N=k?`running`:A?`done`:j?`partly-failed`:`ready`,P=e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},F=(j?g.approveMoreLabel:g.approveLabel).replace(`{count}`,()=>String(M.length));return/* @__PURE__ */ u(`section`,{className:`wui-queue-bundle${S?` ${S}`:``}`,"data-state":N,...m,...C,children:[/* @__PURE__ */ u(`div`,{className:`wui-queue-bundle-head`,children:[/* @__PURE__ */ l(`h3`,{className:`wui-queue-bundle-title`,children:_}),v?/* @__PURE__ */ l(`p`,{className:`wui-queue-bundle-reason`,children:v}):null]}),A?/* @__PURE__ */ l(`p`,{className:`wui-queue-bundle-done`,children:g.allApprovedLabel}):null,!A&&y.length>0?/* @__PURE__ */ l(n,{className:`wui-queue-bundle-list`,variant:`flat`,items:[{key:`rows`,title:g.checkListLabel,count:y.length,content:/* @__PURE__ */ l(`ul`,{className:`wui-queue-bundle-rows`,children:y.map(e=>{let t=D(e);return/* @__PURE__ */ u(`li`,{className:`wui-queue-bundle-row`,children:[O(e)?/* @__PURE__ */ l(i,{checked:!w.has(e.key),disabled:k,onChange:()=>P(e.key),label:/* @__PURE__ */ u(`span`,{className:`wui-queue-bundle-text`,children:[/* @__PURE__ */ l(`span`,{className:`wui-queue-bundle-primary`,children:e.primary}),e.secondary?/* @__PURE__ */ l(`span`,{className:`wui-queue-bundle-secondary`,children:e.secondary}):null]})}):/* @__PURE__ */ u(`span`,{className:`wui-queue-bundle-text`,children:[/* @__PURE__ */ l(`span`,{className:`wui-queue-bundle-primary`,children:e.primary}),e.secondary?/* @__PURE__ */ l(`span`,{className:`wui-queue-bundle-secondary`,children:e.secondary}):null]}),e.trailing?/* @__PURE__ */ l(`span`,{className:`wui-queue-bundle-trailing`,children:e.trailing}):null,t===`idle`?null:/* @__PURE__ */ l(`span`,{className:`wui-queue-bundle-status wui-queue-bundle-status-${t}`,children:E[t]})]},e.key)})})}]}):null,k?/* @__PURE__ */ l(a,{value:x.done,max:x.total,label:g.runningLabel.replace(`{done}`,()=>String(x.done)).replace(`{total}`,()=>String(x.total)),showLabel:!0}):null,A?null:/* @__PURE__ */ l(r,{tone:`primary`,loading:k,disabled:k||M.length===0,onClick:()=>b(M),children:F})]})}export{p as default};
@@ -0,0 +1 @@
1
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppCopyButton.js";import r from"./assertValidValue.js";import i from"./renderIconProp.js";import a from"./warnUnknownProps.js";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{RESULT_BLOCK_TEXT as c}from"@webority/ui-elements/text";var l=[`danger`,`warning`,`info`,`secondary`],u={danger:`alert-circle`,warning:`alert-triangle`,info:`info`,secondary:void 0};function d(d){let{marker:f,props:p}=t(`AppResultBlock`,d),m=e(`resultBlock`,c),{tone:h=`danger`,icon:g,title:_,headingLevel:v=2,children:y,field:b,actions:x,reference:S,referenceLabel:C=m.referenceLabel,copyLabel:w=m.copyLabel,copiedLabel:T=m.copiedLabel,facts:E,className:D=``,...O}=p;a(`AppResultBlock`,O),r(`AppResultBlock`,`tone`,h,l),r(`AppResultBlock`,`headingLevel`,v,[1,2,3]);let k=v===1?`h1`:v===3?`h3`:`h2`,A=g??u[h],j=[`wui-result-block`,`wui-result-block-${h}`,D].filter(Boolean).join(` `);return/* @__PURE__ */ s(`div`,{className:j,...f,...O,children:[A?/* @__PURE__ */ o(`div`,{className:`wui-result-block-icon`,"aria-hidden":`true`,children:i(A,{size:20})}):null,/* @__PURE__ */ s(`div`,{className:`wui-result-block-body`,children:[/* @__PURE__ */ o(k,{className:`wui-result-block-title`,children:_}),y!=null&&/* @__PURE__ */ o(`div`,{className:`wui-result-block-sentence`,children:y}),E&&E.length>0&&/* @__PURE__ */ o(`dl`,{className:`wui-result-block-facts`,children:E.map(e=>/* @__PURE__ */ s(`div`,{className:`wui-result-block-fact`,children:[/* @__PURE__ */ o(`dt`,{children:e.label}),/* @__PURE__ */ o(`dd`,{children:e.value})]},e.key))}),b!=null&&/* @__PURE__ */ o(`div`,{className:`wui-result-block-field`,children:b}),x!=null&&/* @__PURE__ */ o(`div`,{className:`wui-result-block-actions`,children:x}),S!=null&&/* @__PURE__ */ s(`div`,{className:`wui-result-block-reference`,children:[/* @__PURE__ */ s(`span`,{className:`wui-result-block-reference-text`,children:[C,` `,/* @__PURE__ */ o(`code`,{className:`wui-result-block-code`,children:S})]}),/* @__PURE__ */ o(n,{text:S,label:w,copiedLabel:T,size:`sm`})]})]})]})}export{d as default};
@@ -1 +1 @@
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
+ import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppCopyButton.js";import i from"./AppResult.js";import a from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{formatDate as o}from"@webority/ui-elements/helpers";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{ROUTE_ERROR_TEXT as u,fillText as d}from"@webority/ui-elements/text";var f=[`error`,`stale-build`,`not-found`,`forbidden`,`signed-out`,`maintenance`,`offline`],te=()=>window.location.reload();function p(p){let{marker:m,props:h}=t(`AppRouteError`,p),g=e(`routeError`,u),{kind:_=`error`,homeHref:v=`/`,onRetry:y=te,brand:b,fullPage:x=!0,reference:S,expectedBack:C,requestAccessHref:w,homeLabel:T=g.homeLabel,reloadLabel:E=g.reloadLabel,retryLabel:D=g.retryLabel,staleTitle:O=g.staleTitle,staleText:k=g.staleText,notFoundTitle:A=g.notFoundTitle,notFoundText:j=g.notFoundText,errorTitle:M=g.errorTitle,errorText:N=g.errorText,forbiddenTitle:P=g.forbiddenTitle,forbiddenText:F=g.forbiddenText,signedOutTitle:ne=g.signedOutTitle,signedOutText:I=g.signedOutText,signInLabel:L=g.signInLabel,maintenanceTitle:R=g.maintenanceTitle,maintenanceText:z=g.maintenanceText,checkAgainLabel:B=g.checkAgainLabel,offlineTitle:V=g.offlineTitle,offlineText:H=g.offlineText,referenceLabel:U=g.referenceLabel,copyReferenceLabel:W=g.copyReferenceLabel,requestAccessLabel:G=g.requestAccessLabel,children:K,className:q=``,...J}=h;if(ee(`AppRouteError`,J),a(`AppRouteError`,`kind`,_,f),C!==void 0&&_!==`maintenance`)throw RangeError(`[@webority/ui-react] <AppRouteError> received expectedBack with kind="${_}". Pass it with kind="maintenance".`);if(w!==void 0&&_!==`forbidden`)throw RangeError(`[@webority/ui-react] <AppRouteError> received requestAccessHref with kind="${_}". Pass it with kind="forbidden".`);let Y=e=>/* @__PURE__ */ c(n,{variant:e,leftIcon:`home`,href:v,children:T}),X=C===void 0?z:`${z} ${d(g.maintenanceBackBy,{time:o(C,{pattern:`time`})})}`,Z=w===void 0?Y(`solid`):/* @__PURE__ */ l(s,{children:[Y(`solid`),/* @__PURE__ */ c(n,{variant:`outline`,href:w,children:G})]}),Q=S?/* @__PURE__ */ l(`p`,{className:`small text-body-secondary mb-0 mt-3`,children:[/* @__PURE__ */ l(`span`,{children:[U,`: `]}),/* @__PURE__ */ c(`code`,{className:`user-select-all`,children:S}),` `,/* @__PURE__ */ c(r,{text:S,label:W,size:`sm`,variant:`link`})]}):null,$;switch(_){case`stale-build`:$=/* @__PURE__ */ l(i,{status:`info`,icon:`refresh-cw`,title:O,subtitle:k,actions:/* @__PURE__ */ c(n,{leftIcon:`refresh-cw`,onClick:y,children:E}),children:[Q,K]});break;case`not-found`:$=/* @__PURE__ */ l(i,{status:`404`,title:A,subtitle:j,actions:Y(`solid`),children:[Q,K]});break;case`forbidden`:$=/* @__PURE__ */ l(i,{status:`403`,title:P,subtitle:F,actions:Z,children:[Q,K]});break;case`signed-out`:$=/* @__PURE__ */ l(i,{status:`info`,icon:`login`,title:ne,subtitle:I,actions:/* @__PURE__ */ c(n,{onClick:y,children:L}),children:[Q,K]});break;case`maintenance`:$=/* @__PURE__ */ l(i,{status:`warning`,icon:`settings`,title:R,subtitle:X,actions:/* @__PURE__ */ c(n,{leftIcon:`refresh-cw`,onClick:y,children:B}),children:[Q,K]});break;case`offline`:$=/* @__PURE__ */ l(i,{status:`warning`,icon:`cloud-cross`,title:V,subtitle:H,actions:/* @__PURE__ */ c(n,{leftIcon:`refresh-cw`,onClick:y,children:D}),children:[Q,K]});break;case`error`:$=/* @__PURE__ */ l(i,{status:`500`,title:M,subtitle:N,actions:/* @__PURE__ */ l(s,{children:[/* @__PURE__ */ c(n,{leftIcon:`refresh-cw`,onClick:y,children:D}),Y(`outline`)]}),children:[Q,K]});break;default:throw RangeError(`[@webority/ui-react] <AppRouteError> has no screen for kind="${String(_)}".`)}return/* @__PURE__ */ l(`div`,{className:[x?`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`,q].filter(Boolean).join(` `),...m,...J,children:[b&&/* @__PURE__ */ c(`div`,{className:`mb-4`,children:b}),/* @__PURE__ */ c(`div`,{className:`col-12 col-md-8 col-lg-6`,children:$})]})}export{p as default};
@@ -1 +1 @@
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,readOnly:M,className:N=``,form:P,onKeyDown:F,...I}=v;a(`AppSearch`,I),i(`AppSearch`,`size`,O,e);let L=D??18,[R,z]=u(x??``),B=b===void 0?R:b,[V,H]=u(!!B),U=l(null),W=l(null),G=!A||V||!!B,K=s(()=>{H(!0),requestAnimationFrame(()=>U.current?.focus())},[]),q=()=>{z(``),d(()=>S?.(``)),U.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)===W.current&&(e.preventDefault(),K())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A,K]);let J=[`search-wrap`,B?`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&&!G?`is-collapsed`:``,N].filter(Boolean).join(` `),Y=D==null?void 0:{"--wui-search-icon-size":`${D}px`};return/* @__PURE__ */ p(`div`,{..._,className:J,style:Y,ref:W,onBlur:e=>{A&&!e.currentTarget.contains(e.relatedTarget)&&!B&&H(!1)},children:[A&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":w||C||E,"aria-expanded":G?`true`:`false`,onClick:K,children:/* @__PURE__ */ f(r,{name:`search`,size:L})}),k&&/* @__PURE__ */ f(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ f(r,{name:`search`,size:L,className:`search-icon`}),/* @__PURE__ */ f(h.Control,{ref:U,type:`search`,className:`input search-input`,placeholder:C,value:B,onChange:e=>{z(e.target.value),S?.(e.target.value)},onKeyDown:e=>{F?.(e),A&&e.key===`Escape`&&!B&&H(!1)},"aria-label":w,form:P,disabled:j,...M===void 0?null:{readOnly:M},...I}),!j&&!M&&/* @__PURE__ */ f(`button`,{type:`button`,className:`search-clear`,"aria-label":T,onClick:q,hidden:!B,children:/* @__PURE__ */ f(r,{name:`x`,size:16})})]})}export{g 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";var g=[`underline`];function _(_){let{marker:v,props:y}=n(`AppSearch`,_),b=t(`search`,m),{value:x,defaultValue:S,onChange:C,placeholder:w=b.placeholder,ariaLabel:T,clearLabel:E=b.clearLabel,searchLabel:D=b.searchLabel,iconSize:O,size:k,loading:A=!1,collapsible:j=!1,disabled:M=!1,readOnly:N,className:P=``,form:F,onKeyDown:I,variant:L,...R}=y;a(`AppSearch`,R),i(`AppSearch`,`size`,k,e),i(`AppSearch`,`variant`,L,g);let z=O??18,[B,V]=u(S??``),H=x===void 0?B:x,[U,W]=u(!!H),G=l(null),K=l(null),q=!j||U||!!H,J=s(()=>{W(!0),requestAnimationFrame(()=>G.current?.focus())},[]),Y=()=>{V(``),d(()=>C?.(``)),G.current?.form?.requestSubmit()};c(()=>{if(!j)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)===K.current&&(e.preventDefault(),J())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[j,J]);let X=[`search-wrap`,H?`has-value`:``,k===`sm`?`wui-search-sm`:k===`lg`?`wui-search-lg`:k===`xl`?`wui-search-xl`:``,A?`is-loading`:``,j?`wui-search-collapsible`:``,j&&!q?`is-collapsed`:``,P].filter(Boolean).join(` `),Z=O==null?void 0:{"--wui-search-icon-size":`${O}px`};return/* @__PURE__ */ p(`div`,{...v,className:X,style:Z,ref:K,onBlur:e=>{j&&!e.currentTarget.contains(e.relatedTarget)&&!H&&W(!1)},children:[j&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":T||w||D,"aria-expanded":q?`true`:`false`,onClick:J,children:/* @__PURE__ */ f(r,{name:`search`,size:z})}),A&&/* @__PURE__ */ f(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ f(r,{name:`search`,size:z,className:`search-icon`}),/* @__PURE__ */ f(h.Control,{ref:G,type:`search`,className:L===`underline`?`input search-input wui-input-underline`:`input search-input`,placeholder:w,value:H,onChange:e=>{V(e.target.value),C?.(e.target.value)},onKeyDown:e=>{I?.(e),j&&e.key===`Escape`&&!H&&W(!1)},"aria-label":T,form:F,disabled:M,...N===void 0?null:{readOnly:N},...R}),!M&&!N&&/* @__PURE__ */ f(`button`,{type:`button`,className:`search-clear`,"aria-label":E,onClick:Y,hidden:!H,children:/* @__PURE__ */ f(r,{name:`x`,size:16})})]})}export{_ as default};