@webority/ui-react 0.164.0 → 0.165.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +1 -1
  2. package/dist/canvas-kit/kit.js +206 -206
  3. package/dist/canvas-kit/manifest.json +1086 -406
  4. package/dist/canvas-kit/release.json +6 -6
  5. package/dist/components/AppAsyncBlock.js +1 -1
  6. package/dist/components/AppColorField.js +1 -1
  7. package/dist/components/AppDataTable.js +1 -1
  8. package/dist/components/AppDatePicker.js +1 -1
  9. package/dist/components/AppDateRangePicker.js +1 -1
  10. package/dist/components/AppDescriptions.js +1 -1
  11. package/dist/components/AppDropZone.js +1 -1
  12. package/dist/components/AppDropdown.js +1 -1
  13. package/dist/components/AppEntryGrid.js +1 -0
  14. package/dist/components/AppFileAttachment.js +1 -1
  15. package/dist/components/AppFilePicker.js +1 -1
  16. package/dist/components/AppFilterBar.js +1 -1
  17. package/dist/components/AppForm.js +1 -1
  18. package/dist/components/AppFormulaSteps.js +1 -0
  19. package/dist/components/AppImagePicker.js +1 -1
  20. package/dist/components/AppInput.js +1 -1
  21. package/dist/components/AppMentionInput.js +1 -1
  22. package/dist/components/AppMetricStrip.js +1 -1
  23. package/dist/components/AppModal.js +1 -1
  24. package/dist/components/AppNumberInput.js +1 -1
  25. package/dist/components/AppOtpInput.js +1 -1
  26. package/dist/components/AppPhoneNumberInput.js +1 -1
  27. package/dist/components/AppPopover.js +1 -1
  28. package/dist/components/AppRadioGroup.js +1 -1
  29. package/dist/components/AppRating.js +1 -1
  30. package/dist/components/AppRichText.js +1 -1
  31. package/dist/components/AppRowActions.js +1 -0
  32. package/dist/components/AppScoreScale.js +1 -1
  33. package/dist/components/AppSectionFeatures.js +1 -1
  34. package/dist/components/AppSectionLogos.js +1 -1
  35. package/dist/components/AppSelect.js +1 -1
  36. package/dist/components/AppShell.js +1 -1
  37. package/dist/components/AppSlider.js +1 -1
  38. package/dist/components/AppTextarea.js +1 -1
  39. package/dist/components/AppTimePicker.js +1 -1
  40. package/dist/components/AppToast.js +1 -1
  41. package/dist/guidance.json +212 -137
  42. package/dist/hookForm/index.js +1 -0
  43. package/dist/lib/CheckField.js +1 -1
  44. package/dist/lib/formFields.js +1 -0
  45. package/dist/lib/unsavedText.js +1 -0
  46. package/dist/types/components/AppAsyncBlock.d.ts +3 -3
  47. package/dist/types/components/AppChart.d.ts +12 -4
  48. package/dist/types/components/AppDataTable.d.ts +29 -2
  49. package/dist/types/components/AppDateRangePicker.d.ts +4 -0
  50. package/dist/types/components/AppDescriptions.d.ts +6 -0
  51. package/dist/types/components/AppEntryGrid.d.ts +122 -0
  52. package/dist/types/components/AppFilterBar.d.ts +12 -1
  53. package/dist/types/components/AppForm.d.ts +18 -0
  54. package/dist/types/components/AppFormulaSteps.d.ts +64 -0
  55. package/dist/types/components/AppMetricStrip.d.ts +5 -0
  56. package/dist/types/components/AppModal.d.ts +5 -0
  57. package/dist/types/components/AppRowActions.d.ts +40 -0
  58. package/dist/types/components/AppSectionFeatures.d.ts +5 -1
  59. package/dist/types/components/AppSectionLogos.d.ts +1 -0
  60. package/dist/types/components/AppShell.d.ts +2 -0
  61. package/dist/types/components/AppSlider.d.ts +5 -0
  62. package/dist/types/components/AppToast.d.ts +5 -0
  63. package/dist/types/hookForm/index.d.ts +14 -0
  64. package/dist/types/index.d.ts +7 -5
  65. package/dist/types/lib/formFields.d.ts +12 -0
  66. package/dist/types/lib/unsavedText.d.ts +5 -0
  67. package/dist/ui-react.js +1 -1
  68. package/dist/web-core/dist/errors/extractApiError.js +2 -0
  69. package/dist/web-core/dist/errors/requestPlatform.js +1 -0
  70. package/package.json +20 -9
  71. package/dist/components/AppResizable.js +0 -1
  72. package/dist/components/AppResizableHandle.js +0 -1
  73. package/dist/components/AppResizablePanel.js +0 -1
  74. package/dist/components/AppRollingNumber.js +0 -1
  75. package/dist/components/AppRowSwitch.js +0 -1
  76. package/dist/types/components/AppResizable.d.ts +0 -37
  77. package/dist/types/components/AppResizableHandle.d.ts +0 -14
  78. package/dist/types/components/AppResizablePanel.d.ts +0 -14
  79. package/dist/types/components/AppRollingNumber.d.ts +0 -30
  80. package/dist/types/components/AppRowSwitch.d.ts +0 -18
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{useOverlayRoot as t}from"../lib/useOverlayRoot.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import{TOAST_ANIMATIONS as a,TOAST_SHAPES as o,TOAST_SURFACES as s,adoptToast as c,dismissToast as l,subscribeToasts as u}from"./toastStore.js";import d from"./warnUnknownProps.js";import{raisePopover as f}from"@webority/ui-elements/helpers";import{useEffect as p,useRef as m,useState as h}from"react";import{createPortal as g}from"react-dom";import{jsx as _,jsxs as v}from"react/jsx-runtime";var y={success:{icon:`check-circle`,assertive:!1},info:{icon:`info`,assertive:!1},warning:{icon:`alert-triangle`,assertive:!0},danger:{icon:`alert-circle`,assertive:!0}},b=e=>Object.keys(y).includes(e),x={"top-start":`top-0 start-0`,"top-center":`top-0 start-50 translate-middle-x`,"top-end":`top-0 end-0`,"middle-center":`top-50 start-50 translate-middle`,"bottom-start":`bottom-0 start-0`,"bottom-center":`bottom-0 start-50 translate-middle-x`,"bottom-end":`bottom-0 end-0`},S=64;function C(r){let{marker:c,props:l}=n(`AppToast`,r),{position:y=`bottom-end`,maxVisible:b=4,animation:S=`rise`,shape:C=`rounded`,surface:T=`auto`,offset:E,className:D=``,...O}=l;d(`AppToast`,O),i(`AppToast`,`position`,y,Object.keys(x)),i(`AppToast`,`animation`,S,a),i(`AppToast`,`shape`,C,o),i(`AppToast`,`surface`,T,s);let[k,A]=h([]);p(()=>u(A),[]);let j=t(),M=m(null);p(()=>{let e=M.current;j&&e&&k.length!==0&&f(e)},[k,j]);let N=typeof E==`number`&&Number.isFinite(E)&&E>=0;p(()=>{E==null||N||e(`[@webority/ui-react] <AppToast> received offset="${String(E)}", which must be a number of pixels, 0 or more. The default offset is used instead.`)},[E,N]);let{style:P,...F}=O,I={"--wui-toast-offset":`${E}px`},L=N?{...I,...P}:P,R=Math.max(0,k.length-b),z=R?k.slice(R):k,B=x[y]??x[`bottom-end`];return j?g(/* @__PURE__ */ v(`div`,{...c,...F,ref:M,popover:`manual`,style:L,className:`wui-toast-container toast-container position-fixed ${B} p-3 ${D}`.trim(),children:[R>0&&/* @__PURE__ */ v(`div`,{className:`wui-toast-more`,"aria-hidden":`true`,children:[`+`,R,` more`]}),z.map(e=>/* @__PURE__ */ _(w,{toast:e,defaultAnimation:S,defaultShape:C,defaultSurface:T},e.id))]}),j):null}function w({toast:e,defaultAnimation:t=`rise`,defaultShape:n=`rounded`,defaultSurface:i=`auto`}){if(!b(e.variant))throw Error(`<AppToast> has no tone for the variant "${e.variant}".`);let a=y[e.variant],o=e.animation??t,s=e.shape??n,u=e.surface??i,d=(o===`rise`?``:` wui-toast--anim-${o}`)+(s===`rounded`?``:` wui-toast--shape-${s}`)+(u===`inverse`?` wui-toast--surface-inverse`:``),f=e.duration===0,[g,x]=h(0),[C,w]=h(!1),T=m(null),E=()=>l(e.id),D=m(null);p(()=>{if(e.duration===0)return;c(e.id);let t=D.current,n=t==null?``:getComputedStyle(t).animationName;if(t!=null&&(typeof t.getAnimations==`function`?t.getAnimations().length>0:n!==``&&n!==`none`))return;let r=setTimeout(()=>l(e.id),e.duration);return()=>clearTimeout(r)},[e.id,e.duration]);let O=e=>{if(e.button===0){if(!(e.target instanceof Element))throw Error(`<AppToast> received a pointer event whose target is not an element.`);e.target.closest(`button`)||(T.current=e.clientX,w(!0),e.currentTarget.setPointerCapture?.(e.pointerId))}},k=e=>{T.current!==null&&x(e.clientX-T.current)},A=()=>{T.current=null,w(!1),x(0)},j=e=>{if(T.current===null)return;let t=e.clientX-T.current;Math.abs(t)>S?E():A()},M=g?{transform:`translateX(${g}px)`,opacity:Math.max(0,1-Math.abs(g)/200)}:void 0,N=e.message;return/* @__PURE__ */ v(`div`,{className:`toast show wui-toast wui-toast--${e.variant}${d}${C?` wui-toast--dragging`:``}`,role:a.assertive?`alert`:`status`,"aria-live":a.assertive?`assertive`:`polite`,"aria-atomic":`true`,style:M,onPointerDown:O,onPointerMove:k,onPointerUp:j,onPointerCancel:A,children:[/* @__PURE__ */ _(`span`,{className:`wui-toast-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ _(r,{name:a.icon,size:20})}),/* @__PURE__ */ v(`div`,{className:`wui-toast-content`,children:[e.title&&/* @__PURE__ */ _(`div`,{className:`wui-toast-title`,children:e.title}),/* @__PURE__ */ _(`div`,{className:`wui-toast-message`,children:N}),typeof e.progress==`number`&&/* @__PURE__ */ v(`div`,{className:`wui-toast-task`,children:[/* @__PURE__ */ _(`div`,{className:`wui-toast-track`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.progress),children:/* @__PURE__ */ _(`div`,{className:`wui-toast-track-fill`,style:{width:`${e.progress}%`}})}),/* @__PURE__ */ v(`span`,{className:`wui-toast-track-pct`,"aria-hidden":`true`,children:[Math.round(e.progress),`%`]})]}),e.action&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-toast-action`,onClick:()=>{e.action?.onClick?.(),E()},children:e.action.label})]}),/* @__PURE__ */ _(`button`,{type:`button`,className:`btn-close wui-toast-close`,"aria-label":`Close`,onClick:E}),!f&&/* @__PURE__ */ _(`div`,{ref:D,className:`wui-toast-progress`,style:{animationDuration:`${e.duration}ms`},onAnimationEnd:E})]})}export{C as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{useOverlayRoot as t}from"../lib/useOverlayRoot.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import{TOAST_ANIMATIONS as a,TOAST_SHAPES as o,TOAST_SURFACES as s,adoptToast as c,dismissToast as l,subscribeToasts as u}from"./toastStore.js";import d from"./warnUnknownProps.js";import{raisePopover as f}from"@webority/ui-elements/helpers";import{useEffect as p,useRef as m,useState as h}from"react";import{createPortal as g}from"react-dom";import{jsx as _,jsxs as v}from"react/jsx-runtime";var y={success:{icon:`check-circle`,assertive:!1},info:{icon:`info`,assertive:!1},warning:{icon:`alert-triangle`,assertive:!0},danger:{icon:`alert-circle`,assertive:!0}},b=e=>Object.keys(y).includes(e),x={"top-start":`top-0 start-0`,"top-center":`top-0 start-50 translate-middle-x`,"top-end":`top-0 end-0`,"middle-center":`top-50 start-50 translate-middle`,"bottom-start":`bottom-0 start-0`,"bottom-center":`bottom-0 start-50 translate-middle-x`,"bottom-end":`bottom-0 end-0`},S=64;function C(r){let{marker:c,props:l}=n(`AppToast`,r),{position:y=`bottom-end`,maxVisible:b=4,animation:S=`rise`,shape:C=`rounded`,surface:T=`auto`,offset:E,closeLabel:D=`Close`,className:O=``,...k}=l;d(`AppToast`,k),i(`AppToast`,`position`,y,Object.keys(x)),i(`AppToast`,`animation`,S,a),i(`AppToast`,`shape`,C,o),i(`AppToast`,`surface`,T,s);let[A,j]=h([]);p(()=>u(j),[]);let M=t(),N=m(null);p(()=>{let e=N.current;M&&e&&A.length!==0&&e.isConnected&&f(e)},[A,M]);let P=typeof E==`number`&&Number.isFinite(E)&&E>=0;p(()=>{E==null||P||e(`[@webority/ui-react] <AppToast> received offset="${String(E)}", which must be a number of pixels, 0 or more. The default offset is used instead.`)},[E,P]);let{style:F,...I}=k,L={"--wui-toast-offset":`${E}px`},R=P?{...L,...F}:F,z=Math.max(0,A.length-b),B=z?A.slice(z):A,V=x[y]??x[`bottom-end`];return M?g(/* @__PURE__ */ v(`div`,{...c,...I,ref:N,popover:`manual`,style:R,className:`wui-toast-container toast-container position-fixed ${V} p-3 ${O}`.trim(),children:[z>0&&/* @__PURE__ */ v(`div`,{className:`wui-toast-more`,"aria-hidden":`true`,children:[`+`,z,` more`]}),B.map(e=>/* @__PURE__ */ _(w,{toast:e,defaultAnimation:S,defaultShape:C,defaultSurface:T,closeLabel:D},e.id))]}),M):null}function w({toast:e,defaultAnimation:t=`rise`,defaultShape:n=`rounded`,defaultSurface:i=`auto`,closeLabel:a=`Close`}){if(!b(e.variant))throw Error(`<AppToast> has no tone for the variant "${e.variant}".`);let o=y[e.variant],s=e.animation??t,u=e.shape??n,d=e.surface??i,f=(s===`rise`?``:` wui-toast--anim-${s}`)+(u===`rounded`?``:` wui-toast--shape-${u}`)+(d===`inverse`?` wui-toast--surface-inverse`:``),g=e.duration===0,[x,C]=h(0),[w,T]=h(!1),E=m(null),D=()=>l(e.id),O=m(null);p(()=>{if(e.duration===0)return;c(e.id);let t=O.current,n=t==null?``:getComputedStyle(t).animationName;if(t!=null&&(typeof t.getAnimations==`function`?t.getAnimations().length>0:n!==``&&n!==`none`))return;let r=setTimeout(()=>l(e.id),e.duration);return()=>clearTimeout(r)},[e.id,e.duration]);let k=e=>{if(e.button===0){if(!(e.target instanceof Element))throw Error(`<AppToast> received a pointer event whose target is not an element.`);e.target.closest(`button`)||(E.current=e.clientX,T(!0),e.currentTarget.setPointerCapture?.(e.pointerId))}},A=e=>{E.current!==null&&C(e.clientX-E.current)},j=()=>{E.current=null,T(!1),C(0)},M=e=>{if(E.current===null)return;let t=e.clientX-E.current;Math.abs(t)>S?D():j()},N=x?{transform:`translateX(${x}px)`,opacity:Math.max(0,1-Math.abs(x)/200)}:void 0,P=e.message;return/* @__PURE__ */ v(`div`,{className:`toast show wui-toast wui-toast--${e.variant}${f}${w?` wui-toast--dragging`:``}`,role:o.assertive?`alert`:`status`,"aria-live":o.assertive?`assertive`:`polite`,"aria-atomic":`true`,style:N,onPointerDown:k,onPointerMove:A,onPointerUp:M,onPointerCancel:j,children:[/* @__PURE__ */ _(`span`,{className:`wui-toast-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ _(r,{name:o.icon,size:20})}),/* @__PURE__ */ v(`div`,{className:`wui-toast-content`,children:[e.title&&/* @__PURE__ */ _(`div`,{className:`wui-toast-title`,children:e.title}),/* @__PURE__ */ _(`div`,{className:`wui-toast-message`,children:P}),typeof e.progress==`number`&&/* @__PURE__ */ v(`div`,{className:`wui-toast-task`,children:[/* @__PURE__ */ _(`div`,{className:`wui-toast-track`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.progress),children:/* @__PURE__ */ _(`div`,{className:`wui-toast-track-fill`,style:{width:`${e.progress}%`}})}),/* @__PURE__ */ v(`span`,{className:`wui-toast-track-pct`,"aria-hidden":`true`,children:[Math.round(e.progress),`%`]})]}),e.action&&/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-toast-action`,onClick:()=>{e.action?.onClick?.(),D()},children:e.action.label})]}),/* @__PURE__ */ _(`button`,{type:`button`,className:`btn-close wui-toast-close`,"aria-label":a,onClick:D}),!g&&/* @__PURE__ */ _(`div`,{ref:O,className:`wui-toast-progress`,style:{animationDuration:`${e.duration}ms`},onAnimationEnd:D})]})}export{C as default};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-guidance/1",
3
3
  "package": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.164.0"
5
+ "version": "0.165.0"
6
6
  },
7
7
  "components": [
8
8
  {
@@ -467,7 +467,7 @@
467
467
  "a11y": [
468
468
  "Each drawn state is marked with a data-state attribute on the wrapper: loading, error, empty or data. Idle draws no wrapper.",
469
469
  "With no skeleton, the loading state is an indeterminate progress bar labelled Loading.",
470
- "The error state is an empty state with a Retry button that calls the state's retry.",
470
+ "The error state is an empty state with a Try again button that calls the state's retry.",
471
471
  "The component sets no aria attributes of its own."
472
472
  ]
473
473
  }
@@ -3462,6 +3462,118 @@
3462
3462
  ]
3463
3463
  }
3464
3464
  },
3465
+ {
3466
+ "name": "AppEntryGrid",
3467
+ "usage": {
3468
+ "when": [
3469
+ "A person enters or corrects several lines of figures in one table, one line at a time.",
3470
+ "Each line is saved on its own, and the person moves through the lines with the keyboard."
3471
+ ],
3472
+ "whenNot": [
3473
+ {
3474
+ "text": "The table only shows records and nothing is typed into it.",
3475
+ "instead": "AppDataTable"
3476
+ },
3477
+ {
3478
+ "text": "One field on a record is edited in place.",
3479
+ "instead": "AppInlineEdit"
3480
+ }
3481
+ ],
3482
+ "do": [
3483
+ {
3484
+ "title": "Save each line as the person leaves it",
3485
+ "note": "Enter saves the line and moves to the next one, so the person never reaches for a save button per line.",
3486
+ "example": [
3487
+ {
3488
+ "component": "AppEntryGrid",
3489
+ "props": {
3490
+ "columns": [
3491
+ {
3492
+ "key": "item",
3493
+ "label": "Item"
3494
+ },
3495
+ {
3496
+ "key": "units",
3497
+ "label": "Units",
3498
+ "kind": "number"
3499
+ }
3500
+ ],
3501
+ "rows": [
3502
+ {
3503
+ "id": "L1",
3504
+ "item": "Blue pens",
3505
+ "units": 48
3506
+ }
3507
+ ]
3508
+ }
3509
+ }
3510
+ ]
3511
+ }
3512
+ ],
3513
+ "dont": [
3514
+ {
3515
+ "title": "Save each line as the person leaves it",
3516
+ "note": "A read-only table with no save path leaves the person's typing with nowhere to go.",
3517
+ "example": [
3518
+ {
3519
+ "component": "AppDataTable",
3520
+ "props": {
3521
+ "columns": [
3522
+ {
3523
+ "key": "item",
3524
+ "label": "Item"
3525
+ },
3526
+ {
3527
+ "key": "units",
3528
+ "label": "Units"
3529
+ }
3530
+ ],
3531
+ "rows": [
3532
+ {
3533
+ "id": "L1",
3534
+ "item": "Blue pens",
3535
+ "units": 48
3536
+ }
3537
+ ]
3538
+ }
3539
+ }
3540
+ ]
3541
+ }
3542
+ ],
3543
+ "a11y": [
3544
+ "The table is named by label, and the active line carries aria-current.",
3545
+ "Each status is a glyph with a visually hidden word, so a saving, saved or failed line is not shown by colour alone.",
3546
+ "A failed line shows its error in an alert region under the line."
3547
+ ],
3548
+ "keyboard": [
3549
+ {
3550
+ "key": "Enter",
3551
+ "does": "Saves the line; the page moves to the next line once the save succeeds.",
3552
+ "notes": "Does nothing inside a text area, a button, or an open menu."
3553
+ },
3554
+ {
3555
+ "key": "Ctrl+S",
3556
+ "does": "Saves the line and keeps the focus on it.",
3557
+ "notes": "Meta+S does the same on a Mac."
3558
+ },
3559
+ {
3560
+ "key": "Escape",
3561
+ "does": "Discards the changes on the line and restores its last saved values.",
3562
+ "notes": "Does nothing inside an open menu."
3563
+ },
3564
+ {
3565
+ "key": "Ctrl+ArrowUp and Ctrl+ArrowDown",
3566
+ "does": "Moves the active line up or down.",
3567
+ "notes": "Does nothing at the first or last line."
3568
+ },
3569
+ {
3570
+ "key": "Tab and Shift+Tab",
3571
+ "does": "Move between the fields of a line in page order.",
3572
+ "notes": "Never intercepted, so the person can always tab out of the grid."
3573
+ }
3574
+ ]
3575
+ }
3576
+ },
3465
3577
  {
3466
3578
  "name": "AppErrorBoundary",
3467
3579
  "usage": {
@@ -4007,6 +4119,94 @@
4007
4119
  ]
4008
4120
  }
4009
4121
  },
4122
+ {
4123
+ "name": "AppFormulaSteps",
4124
+ "usage": {
4125
+ "when": [
4126
+ "Show how a figure on the page is reached, line by line, with the real numbers.",
4127
+ "The server computes the figure and the page only shows it: the lines display that result, and the page does no arithmetic of its own."
4128
+ ],
4129
+ "whenNot": [
4130
+ {
4131
+ "text": "The figures are many rows the user scans, sorts or edits.",
4132
+ "instead": "AppDataTable"
4133
+ },
4134
+ {
4135
+ "text": "The figures are a trend or a comparison shown as a picture.",
4136
+ "instead": "AppChart"
4137
+ },
4138
+ {
4139
+ "text": "The figure is a single value with no working to show.",
4140
+ "instead": "a plain value in the page text"
4141
+ }
4142
+ ],
4143
+ "do": [
4144
+ {
4145
+ "title": "End with the result line",
4146
+ "note": "Give each line the amount it stands for, and end with one equal line for the result.",
4147
+ "example": [
4148
+ {
4149
+ "component": "AppFormulaSteps",
4150
+ "props": {
4151
+ "label": "TDS on a bill",
4152
+ "steps": [
4153
+ {
4154
+ "key": "a",
4155
+ "label": "Bill amount",
4156
+ "result": "₹10,00,000.00"
4157
+ },
4158
+ {
4159
+ "key": "b",
4160
+ "sign": "minus",
4161
+ "label": "TDS",
4162
+ "result": "₹1,000.00"
4163
+ },
4164
+ {
4165
+ "key": "c",
4166
+ "sign": "equal",
4167
+ "label": "Net payable",
4168
+ "result": "₹9,99,000.00"
4169
+ }
4170
+ ]
4171
+ }
4172
+ }
4173
+ ]
4174
+ }
4175
+ ],
4176
+ "dont": [
4177
+ {
4178
+ "title": "End with the result line",
4179
+ "note": "A list of amounts with no equal line leaves the reader to add them up and find the total.",
4180
+ "example": [
4181
+ {
4182
+ "component": "AppFormulaSteps",
4183
+ "props": {
4184
+ "label": "TDS on a bill",
4185
+ "steps": [
4186
+ {
4187
+ "key": "a",
4188
+ "label": "Bill amount",
4189
+ "result": "₹10,00,000.00"
4190
+ },
4191
+ {
4192
+ "key": "b",
4193
+ "sign": "minus",
4194
+ "label": "TDS",
4195
+ "result": "₹1,000.00"
4196
+ }
4197
+ ]
4198
+ }
4199
+ }
4200
+ ]
4201
+ }
4202
+ ],
4203
+ "a11y": [
4204
+ "The lines are an ordered list with an accessible name, so a screen reader announces the count and reads each line in order.",
4205
+ "A screen reader reads each operator as its word, such as minus or times, taken from the sign-word props.",
4206
+ "Each operator glyph is hidden from assistive tech, so the symbol itself is never read out."
4207
+ ]
4208
+ }
4209
+ },
4010
4210
  {
4011
4211
  "name": "AppHoverCard",
4012
4212
  "usage": {
@@ -6330,70 +6530,6 @@
6330
6530
  ]
6331
6531
  }
6332
6532
  },
6333
- {
6334
- "name": "AppResizable",
6335
- "usage": {
6336
- "when": [
6337
- "A reading pane, editor or preview whose ideal size depends on the person and the task.",
6338
- "Layouts a person returns to: add a storageKey."
6339
- ],
6340
- "whenNot": [
6341
- {
6342
- "text": "A fixed list beside an open item that stacks on phones.",
6343
- "instead": "AppSplitView"
6344
- },
6345
- {
6346
- "text": "Collapsing a region rather than sizing it.",
6347
- "instead": "AppAccordion"
6348
- }
6349
- ],
6350
- "do": [],
6351
- "dont": [],
6352
- "a11y": [
6353
- "Each handle is a keyboard-focusable separator named by its label.",
6354
- "Arrow keys along the axis move it 5%, with Shift 20%; Home and End take the panel before it to its minimum or maximum; a double click restores the default sizes.",
6355
- "The group writes each handle's current size and limits as aria-valuenow, aria-valuemin and aria-valuemax."
6356
- ]
6357
- }
6358
- },
6359
- {
6360
- "name": "AppResizableHandle",
6361
- "usage": {
6362
- "when": [
6363
- "Between two AppResizablePanels inside an AppResizable, as the divider the person drags."
6364
- ],
6365
- "whenNot": [
6366
- {
6367
- "text": "Outside an AppResizable group: there are no panels for it to resize.",
6368
- "instead": "AppResizable"
6369
- }
6370
- ],
6371
- "do": [],
6372
- "dont": [],
6373
- "a11y": [
6374
- "It is a focusable separator (role separator, one tab stop) named by its label.",
6375
- "Arrow keys, Home and End resize the panel before it against the panel after it, and its current size and limits are announced."
6376
- ]
6377
- }
6378
- },
6379
- {
6380
- "name": "AppResizablePanel",
6381
- "usage": {
6382
- "when": [
6383
- "Inside an AppResizable, one for each region whose size the person can change."
6384
- ],
6385
- "whenNot": [
6386
- {
6387
- "text": "Content that must keep a fixed size beside a resizable region. Place it outside the group."
6388
- }
6389
- ],
6390
- "do": [],
6391
- "dont": [],
6392
- "a11y": [
6393
- "The panel is a plain div with no role or aria attributes; the content inside carries its own semantics."
6394
- ]
6395
- }
6396
- },
6397
6533
  {
6398
6534
  "name": "AppResourceCard",
6399
6535
  "usage": {
@@ -6553,31 +6689,6 @@
6553
6689
  ]
6554
6690
  }
6555
6691
  },
6556
- {
6557
- "name": "AppRollingNumber",
6558
- "usage": {
6559
- "when": [
6560
- "A total or count that changes while the person is looking: a cart, a dashboard tile, a live counter."
6561
- ],
6562
- "whenNot": [
6563
- {
6564
- "text": "A figure that is set once on load, or a table cell in a long list.",
6565
- "instead": "plain text"
6566
- },
6567
- {
6568
- "text": "A KPI with a label, trend and sparkline.",
6569
- "instead": "AppKpiTile"
6570
- }
6571
- ],
6572
- "do": [],
6573
- "dont": [],
6574
- "a11y": [
6575
- "The rolling digits are hidden from assistive technology, and the final value sits next to them as plain text.",
6576
- "A change is not announced on every roll: wrap the figure in your own live region where a change should be announced.",
6577
- "Under reduced motion the figure just changes."
6578
- ]
6579
- }
6580
- },
6581
6692
  {
6582
6693
  "name": "AppRouteError",
6583
6694
  "usage": {
@@ -6642,63 +6753,27 @@
6642
6753
  }
6643
6754
  },
6644
6755
  {
6645
- "name": "AppRowSwitch",
6756
+ "name": "AppRowActions",
6646
6757
  "usage": {
6647
6758
  "when": [
6648
- "A setting on one row of a table that saves on its own, such as portal access or auto-reminders.",
6649
- "Each row has its own state and the change must reach the server before the row shows it."
6759
+ "The actions at the end of a table or list row, one list that shows as icon buttons from sm up and as one menu on a phone."
6650
6760
  ],
6651
6761
  "whenNot": [
6652
6762
  {
6653
- "text": "The switch is a page-level setting with no table row.",
6654
- "instead": "AppSwitch"
6655
- },
6656
- {
6657
- "text": "The row action opens several choices.",
6763
+ "text": "A menu that is not a row's own actions.",
6658
6764
  "instead": "AppDropdown"
6659
6765
  },
6660
6766
  {
6661
- "text": "The user submits several rows of settings together.",
6662
- "instead": "AppCheckbox"
6663
- }
6664
- ],
6665
- "do": [
6666
- {
6667
- "title": "Wait for the save before flipping",
6668
- "note": "The row keeps its saved state. The switch shows the next state only after the save resolves.",
6669
- "example": [
6670
- {
6671
- "component": "AppRowSwitch",
6672
- "props": {
6673
- "label": "Portal access",
6674
- "checked": true
6675
- },
6676
- "handlers": [
6677
- "onToggle"
6678
- ]
6679
- }
6680
- ]
6681
- }
6682
- ],
6683
- "dont": [
6684
- {
6685
- "title": "Wait for the save before flipping",
6686
- "note": "A page-level switch in a row has no busy state, so a second flip can race the first save.",
6687
- "example": [
6688
- {
6689
- "component": "AppSwitch",
6690
- "props": {
6691
- "label": "Portal access",
6692
- "defaultChecked": true
6693
- }
6694
- }
6695
- ]
6767
+ "text": "Bulk actions on the selected rows.",
6768
+ "instead": "AppTableToolbar"
6696
6769
  }
6697
6770
  ],
6771
+ "do": [],
6772
+ "dont": [],
6698
6773
  "a11y": [
6699
- "The control is a button with role switch and aria-checked, so a screen reader reads its state.",
6700
- "label is the accessible name, read out with the state.",
6701
- "While a save is pending the switch is busy and disabled, so a second flip cannot race the first."
6774
+ "Each icon button is named by its label and shows it as a tooltip; a disabled one names its disabledReason too.",
6775
+ "The menu trigger is named by menuLabel; Enter or Space opens the menu, arrows move through its rows, and Escape closes it and returns focus to the trigger.",
6776
+ "Below sm only the menu is shown, so every action is reachable by a touch target and by the keyboard."
6702
6777
  ]
6703
6778
  }
6704
6779
  },
@@ -0,0 +1 @@
1
+ import{extractApiError as e}from"../web-core/dist/errors/extractApiError.js";import{useState as t}from"react";var n=e=>e.length>0,r=(e,t,n)=>{if(typeof e==`object`&&e){if(`type`in e&&typeof e.type==`string`)n[t]=`message`in e&&typeof e.message==`string`?e.message:``;else for(let[i,a]of Object.entries(e))r(a,t===``?i:`${t}.${i}`,n)}};function i(i,a){let[o,s]=t([]),c={};return r(i.formState.errors,``,c),{onSubmit:async(t,r)=>{s([]);let o=!1;return await i.handleSubmit(async t=>{try{await a.onSubmit(t,r)}catch(t){let r=e(t);if(r.offline){s([r.message]);return}if(r.status>0){let e=Object.entries(r.fieldErrors);e.length===0&&s([r.message]);for(let[t,r]of e)n(t)&&i.setError(t,{type:`server`,message:r});return}throw t}i.reset(i.getValues()),o=!0})(t),o},fieldErrors:c,formErrors:o,noValidate:!0}}export{i as useHookForm};
@@ -1 +1 @@
1
- import e from"./FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"./fieldState.js";import{forwardRef as n,useId as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";var o=()=>{},s=n(function({label:n,id:s,name:c,error:l,hint:u,className:d=``,rest:f={},inputType:p,wrapperClass:m,rootProps:h,readOnly:g=!1,loading:_=!1,size:v=`md`,controlOnly:y=!1},b){let x=r(),S=s||x,C=l?`${S}-error`:void 0,w=u?`${S}-hint`:void 0,T=v===`sm`?` form-check-sm`:v===`lg`?` form-check-lg`:``,{onClick:E,...D}=f;(g||_)&&D.checked!==void 0&&D.onChange===void 0&&(D.onChange=o);let O=_?`form-check-input ${t}`:`form-check-input`,k=y&&d?`${O} ${d}`:O,A=/* @__PURE__ */ i(`input`,{...y?h:void 0,type:p,className:k,id:S,name:c,ref:b,"aria-invalid":l?`true`:`false`,"aria-describedby":C||w,"aria-readonly":g||void 0,"aria-busy":_||void 0,onClick:e=>{g||_?e.preventDefault():E?.(e)},...D});return y?A:/* @__PURE__ */ a(`div`,{className:`${m}${T}${d?` ${d}`:``}`,...h,children:[A,n!=null&&/* @__PURE__ */ i(`label`,{className:`form-check-label`,htmlFor:S,children:n}),/* @__PURE__ */ i(e,{error:l,hint:u,errorId:C,hintId:w})]})});export{s as default};
1
+ import e from"./FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"./fieldState.js";import{useFieldError as n}from"./formFields.js";import{forwardRef as r,useId as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=()=>{},c=r(function({label:r,id:c,name:l,error:u,hint:d,className:f=``,rest:p={},inputType:m,wrapperClass:h,rootProps:g,readOnly:_=!1,loading:v=!1,size:y=`md`,controlOnly:b=!1},x){let S=n(l),C=b?u:u??S,w=i(),T=c||w,E=C?`${T}-error`:void 0,D=d?`${T}-hint`:void 0,O=y===`sm`?` form-check-sm`:y===`lg`?` form-check-lg`:``,{onClick:k,...A}=p;(_||v)&&A.checked!==void 0&&A.onChange===void 0&&(A.onChange=s);let j=v?`form-check-input ${t}`:`form-check-input`,M=b&&f?`${j} ${f}`:j,N=/* @__PURE__ */ a(`input`,{...b?g:void 0,type:m,className:M,id:T,name:l,ref:x,"aria-invalid":C?`true`:`false`,"aria-describedby":E||D,"aria-readonly":_||void 0,"aria-busy":v||void 0,onClick:e=>{_||v?e.preventDefault():k?.(e)},...A});return b?N:/* @__PURE__ */ o(`div`,{className:`${h}${O}${f?` ${f}`:``}`,...g,children:[N,r!=null&&/* @__PURE__ */ a(`label`,{className:`form-check-label`,htmlFor:T,children:r}),/* @__PURE__ */ a(e,{error:C,hint:d,errorId:E,hintId:D})]})});export{c as default};
@@ -0,0 +1 @@
1
+ import{createContext as e,useContext as t,useEffect as n}from"react";var r=e(null);function i(e){let i=t(r),o=e?a(e):void 0,s=i?.claim;return n(()=>{if(o!==void 0&&s!==void 0)return s(o)},[s,o]),o!==void 0&&i?i.errorOf(o):void 0}function a(e){return e.replace(/\[(\w+)\]/g,`.$1`).replace(/^\./,``)}export{r as FormFieldsContext,a as toFieldName,i as useFieldError};
@@ -0,0 +1 @@
1
+ var e=Object.freeze({title:`Leave without saving?`,message:`Your changes on this page are not saved. If you leave now, they are lost.`,leaveLabel:`Leave`});export{e as UNSAVED_TEXT};
@@ -21,17 +21,17 @@ export interface AppAsyncBlockProps<T> extends Omit<ComponentPropsWithoutRef<"di
21
21
  loadingLabel?: string | undefined;
22
22
  /**
23
23
  * Replaces the built-in English text, for other languages.
24
- * @default "Something went wrong"
24
+ * @default "That didn't load"
25
25
  */
26
26
  errorTitle?: string | undefined;
27
27
  /**
28
28
  * Replaces the built-in English text, for other languages.
29
- * @default "Retry"
29
+ * @default "Try again"
30
30
  */
31
31
  retryLabel?: string | undefined;
32
32
  /**
33
33
  * Replaces the built-in English text, for other languages.
34
- * @default "Nothing to show yet"
34
+ * @default "Nothing here yet"
35
35
  */
36
36
  emptyTitle?: string | undefined;
37
37
  }
@@ -1,6 +1,14 @@
1
1
  import type { ComponentPropsWithoutRef, CSSProperties } from "react";
2
2
  export type ChartType = "line" | "area" | "column" | "bar" | "donut" | "heatmap" | "calendar" | "funnel" | "gauge" | "waterfall" | "treemap" | "sankey" | "scatter" | "bubble" | "multiples";
3
3
  export type ChartStack = "none" | "stacked" | "percent";
4
+ /** How a value prints. Every part is optional: a part left out reads as its default. */
5
+ export interface ChartFormat {
6
+ style?: "number" | "currency" | "percent" | "compact" | "duration" | "date" | undefined;
7
+ currency?: string | undefined;
8
+ unit?: "rupees" | "paise" | "ms" | "s" | "min" | "h" | undefined;
9
+ decimals?: number | undefined;
10
+ pattern?: "day" | "month" | "year" | "datetime" | "time" | undefined;
11
+ }
4
12
  export type ChartState = "ready" | "loading" | "empty" | "error";
5
13
  export type ChartRenderer = "auto" | "svg" | "canvas";
6
14
  export type ChartView = "chart" | "table";
@@ -31,7 +39,7 @@ export interface AppChartProps extends Omit<ComponentPropsWithoutRef<"div">, "on
31
39
  x: {
32
40
  key: string;
33
41
  kind?: "category" | "time" | "value" | undefined;
34
- format?: Record<string, unknown> | undefined;
42
+ format?: ChartFormat | undefined;
35
43
  label?: string | undefined;
36
44
  labelFit?: "auto" | "all" | "rotate" | "ellipsis" | undefined;
37
45
  };
@@ -39,7 +47,7 @@ export interface AppChartProps extends Omit<ComponentPropsWithoutRef<"div">, "on
39
47
  series: {
40
48
  key: string;
41
49
  label: string;
42
- format?: Record<string, unknown> | undefined;
50
+ format?: ChartFormat | undefined;
43
51
  }[];
44
52
  /** The second dimension: a heatmap's rows, a treemap's parents, a scatter or bubble's colour groups (at most 3). Required for a heatmap and a treemap. */
45
53
  group?: {
@@ -55,7 +63,7 @@ export interface AppChartProps extends Omit<ComponentPropsWithoutRef<"div">, "on
55
63
  size?: {
56
64
  key: string;
57
65
  label?: string | undefined;
58
- format?: Record<string, unknown> | undefined;
66
+ format?: ChartFormat | undefined;
59
67
  } | undefined;
60
68
  /** A scatter or bubble's straight trend line through the visible points. */
61
69
  trend?: boolean | undefined;
@@ -74,7 +82,7 @@ export interface AppChartProps extends Omit<ComponentPropsWithoutRef<"div">, "on
74
82
  /** The one value axis. There is no second axis: show another measure as its own chart. */
75
83
  y?: {
76
84
  label?: string | undefined;
77
- format?: Record<string, unknown> | undefined;
85
+ format?: ChartFormat | undefined;
78
86
  min?: number | undefined;
79
87
  max?: number | undefined;
80
88
  wholeNumbers?: boolean | undefined;
@@ -1,4 +1,6 @@
1
1
  import { type ComponentPropsWithoutRef, type CSSProperties, type JSX, type ReactNode } from "react";
2
+ import type { AppLinkComponent } from "../lib/linkTarget.ts";
3
+ import { type AppRowActionEntry } from "./AppRowActions.tsx";
2
4
  /** A row's identity as `rowKey` returns it. */
3
5
  export type AppDataTableKey = string | number;
4
6
  export type AppDataTableAlign = "end" | "num" | "center";
@@ -27,6 +29,8 @@ export interface AppDataTablePagination {
27
29
  export interface AppDataTableColumn<Row> {
28
30
  key: string;
29
31
  label: ReactNode;
32
+ /** Help shown in an AppInfoTip beside the header label. */
33
+ help?: ReactNode | undefined;
30
34
  sortable?: boolean | undefined;
31
35
  align?: AppDataTableAlign | undefined;
32
36
  width?: string | number | undefined;
@@ -58,6 +62,11 @@ export interface AppDataTableProps<Row> extends Omit<ComponentPropsWithoutRef<"d
58
62
  * @default false
59
63
  */
60
64
  loading?: boolean | undefined;
65
+ /**
66
+ * Keeps the current rows on screen, dimmed and marked busy, while new rows load. Has no effect with no rows; loading shows skeleton rows instead.
67
+ * @default false
68
+ */
69
+ refreshing?: boolean | undefined;
61
70
  /**
62
71
  * How many skeleton rows to draw while loading.
63
72
  * @default 5
@@ -72,7 +81,10 @@ export interface AppDataTableProps<Row> extends Omit<ComponentPropsWithoutRef<"d
72
81
  emptyFiltered?: ReactNode | undefined;
73
82
  /** The number of rows before filtering. 0 means the source is empty and empty shows; unset means the table was filtered. */
74
83
  sourceCount?: number | undefined;
75
- rowActions?: ((row: Row) => ReactNode) | undefined;
84
+ /** The row's actions as a list: icon buttons from sm up, one "more" menu below it. Leave an action out of the list to hide it for a row. */
85
+ rowActions?: ((row: Row) => readonly AppRowActionEntry[]) | undefined;
86
+ /** The product's router link, for actions that carry `to`. */
87
+ linkComponent?: AppLinkComponent | undefined;
76
88
  /** The heading text of the trailing actions column. */
77
89
  rowActionsLabel?: string | undefined;
78
90
  /** The footer's state, usually straight from usePagination. The footer shows once total is above the smallest page size and stays in place while loading. */
@@ -136,10 +148,20 @@ export interface AppDataTableProps<Row> extends Omit<ComponentPropsWithoutRef<"d
136
148
  */
137
149
  stickyFirstColumn?: boolean | undefined;
138
150
  /**
139
- * Pins the last column, where rowActions render, to the end edge while a wide table scrolls sideways, so a row's actions stay in view in a narrow box.
151
+ * Pins the last column, where the rowActions list renders, to the end edge while a wide table scrolls sideways, so a row's actions stay in view in a narrow box.
140
152
  * @default false
141
153
  */
142
154
  stickyActions?: boolean | undefined;
155
+ /**
156
+ * Gives every labelled button in the row actions column the same width, so the column lines up from row to row. Icon-only actions are not widened.
157
+ * @default false
158
+ */
159
+ equalActions?: boolean | undefined;
160
+ /**
161
+ * Draws the first column's name as a link. Needs rowHref or onRowClick.
162
+ * @default false
163
+ */
164
+ linkFirstColumn?: boolean | undefined;
143
165
  /**
144
166
  * Makes the whole row open this URL on click or Enter (Ctrl/Cmd or middle click opens a new tab).
145
167
  * Checkboxes, buttons, links and menus in the row keep their own behaviour. Razor: `data-href` on the <tr>.
@@ -185,6 +207,11 @@ export interface AppDataTableProps<Row> extends Omit<ComponentPropsWithoutRef<"d
185
207
  * beneath it.
186
208
  */
187
209
  renderExpanded?: ((row: Row) => ReactNode) | undefined;
210
+ /**
211
+ * With renderExpanded, opening a row closes the one that was open, so at most one row is expanded.
212
+ * @default false
213
+ */
214
+ singleExpand?: boolean | undefined;
188
215
  /**
189
216
  * Each column but the last gets a handle on its end edge: drag it, or focus it and press the arrow keys. The table then keeps fixed widths measured from its rows, and the last column takes the rest.
190
217
  * @default false
@@ -19,6 +19,10 @@ export interface AppDateRangePickerProps extends Omit<React.HTMLAttributes<HTMLE
19
19
  /** The starting end date of an uncontrolled field. */
20
20
  defaultEnd?: string | undefined;
21
21
  onChange?: ((range: DateRangeValue) => void) | undefined;
22
+ /** Opens (true) or closes (false) the calendar from outside. Pair it with onOpenChange; leave it unset for a field that opens itself. */
23
+ open?: boolean | undefined;
24
+ /** Called with the new state when the calendar opens or closes, from a click, Escape or an outside press. */
25
+ onOpenChange?: ((open: boolean) => void) | undefined;
22
26
  /** The field label, shown above the control and used as its accessible name. */
23
27
  label?: React.ReactNode | undefined;
24
28
  /** The content of the info-tip beside the label, opened by a button. */
@@ -7,6 +7,12 @@ interface AppDescriptionItemBase {
7
7
  multiline?: boolean | undefined;
8
8
  icon?: string | React.ReactNode | undefined;
9
9
  href?: string | undefined;
10
+ /** Set on the item's root, so a link can jump to the row. */
11
+ id?: string | undefined;
12
+ /** Set on the item's root: 0 or -1 makes the row focusable. */
13
+ tabIndex?: number | undefined;
14
+ /** Any `data-*` attribute lands on the item's root. */
15
+ [attribute: `data-${string}`]: unknown;
10
16
  }
11
17
  /** A text label may leave `key` out (the row is keyed by its label); any other label needs a `key`, so the row's React key is never "[object Object]". */
12
18
  export type AppDescriptionItem = AppDescriptionItemBase & ({