@webority/ui-react 0.141.0 → 0.143.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.
@@ -2,7 +2,7 @@
2
2
  "kind": "WeborityWeb",
3
3
  "library": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.141.0"
5
+ "version": "0.143.0"
6
6
  },
7
7
  "rendererProtocolVersion": 13,
8
8
  "platform": "Web",
@@ -6336,8 +6336,8 @@
6336
6336
  "name": "staticBackdrop",
6337
6337
  "type": "boolean",
6338
6338
  "required": false,
6339
- "description": "Passed to AppModal: when true, a backdrop click and Escape no longer close the dialog.",
6340
- "default": false
6339
+ "description": "The dialog closes only through its own Cancel or Confirm by default. false lets Escape and an outside click close it.",
6340
+ "default": true
6341
6341
  },
6342
6342
  {
6343
6343
  "name": "title",
@@ -6454,7 +6454,7 @@
6454
6454
  }
6455
6455
  ],
6456
6456
  "a11y": [
6457
- "The dialog is built on AppModal, so it traps focus, closes on Escape and restores focus.",
6457
+ "The dialog is built on AppModal, so it traps focus, closes on Escape only when staticBackdrop is false, and restores focus.",
6458
6458
  "The title is an h3 that takes focus when the dialog opens.",
6459
6459
  "A custom image is hidden from assistive technology with an empty alt, so the title and message carry the meaning.",
6460
6460
  "The confirm-phrase field is named \"Type <phrase> to confirm\", and Confirm stays disabled until the phrase matches.",
@@ -8435,8 +8435,8 @@
8435
8435
  "name": "staticBackdrop",
8436
8436
  "type": "boolean",
8437
8437
  "required": false,
8438
- "description": "The backdrop, Escape and a drag down no longer close it; only the close button or open can.",
8439
- "default": false
8438
+ "description": "The drawer closes only through its own Close or Cancel by default. false lets Escape and an outside click close it.",
8439
+ "default": true
8440
8440
  },
8441
8441
  {
8442
8442
  "name": "style",
@@ -8493,7 +8493,7 @@
8493
8493
  "a11y": [
8494
8494
  "The panel has role dialog with aria-modal and is named by ariaLabel, else by the title.",
8495
8495
  "The sheet handle is a vertical slider labelled Sheet height, and the close button is labelled Close.",
8496
- "Focus moves in on open, Tab stays inside, Escape closes, and focus returns to what opened it."
8496
+ "Focus moves in on open, Tab stays inside, Escape leaves it open unless staticBackdrop is false, and focus returns to what opened it."
8497
8497
  ]
8498
8498
  }
8499
8499
  },
@@ -9916,7 +9916,7 @@
9916
9916
  "sm"
9917
9917
  ],
9918
9918
  "required": false,
9919
- "description": "The control height: sm, md or lg.",
9919
+ "description": "The control height: sm, md or lg. The button form takes it too; an unset size keeps the small button.",
9920
9920
  "default": "md"
9921
9921
  },
9922
9922
  {
@@ -13518,7 +13518,7 @@
13518
13518
  {
13519
13519
  "component": "AppLink",
13520
13520
  "props": {
13521
- "href": "#best",
13521
+ "href": "#guidance",
13522
13522
  "rightIcon": "arrow-right"
13523
13523
  },
13524
13524
  "children": "See pricing"
@@ -13534,7 +13534,7 @@
13534
13534
  {
13535
13535
  "component": "AppLink",
13536
13536
  "props": {
13537
- "href": "#best",
13537
+ "href": "#guidance",
13538
13538
  "animation": "glow"
13539
13539
  },
13540
13540
  "children": "Click here"
@@ -14205,8 +14205,8 @@
14205
14205
  "name": "staticBackdrop",
14206
14206
  "type": "boolean",
14207
14207
  "required": false,
14208
- "description": "When true, a backdrop click and the Escape key no longer close the dialog.",
14209
- "default": false
14208
+ "description": "The pop-up closes only through its own Close or Cancel by default. false lets Escape and an outside click close it.",
14209
+ "default": true
14210
14210
  },
14211
14211
  {
14212
14212
  "name": "subtitle",
@@ -14263,7 +14263,7 @@
14263
14263
  "do": [
14264
14264
  {
14265
14265
  "title": "One trigger, one dialog",
14266
- "note": "A clear trigger opens a single-purpose dialog; open/onClose stay controlled so Escape and the backdrop always work.",
14266
+ "note": "A clear trigger opens a single-purpose dialog; open and onClose stay controlled so the close control always works.",
14267
14267
  "example": [
14268
14268
  {
14269
14269
  "component": "AppButton",
@@ -14341,7 +14341,7 @@
14341
14341
  "a11y": [
14342
14342
  "Focus stays inside the dialog: Tab and Shift+Tab wrap between its first and last control.",
14343
14343
  "The page behind an open dialog is made inert, and the dialog is named by a plain-text title or by ariaLabel; a headerless dialog with neither warns in development.",
14344
- "Escape and a backdrop click close it, unless staticBackdrop is set."
14344
+ "Escape and an outside click leave it open by default; set staticBackdrop to false to let them close it."
14345
14345
  ]
14346
14346
  }
14347
14347
  },
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.141.0",
3
+ "version": "0.143.0",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 13,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.141.0"
9
+ "version": "0.143.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "c9ce4e4b0e653a042672a9bf03b6011f817227f2d1121d3dfd4963967640144b",
14
- "bytes": 979840
13
+ "sha256": "32474ae24aa2d0aa3bb06794d47e6b44f43134c27d7a2e789a844d4361320d34",
14
+ "bytes": 980118
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "fd5c98c34713394ef840d78662a18b4beaeecacad04ff983211e0a06a54357a1",
18
- "bytes": 11171914
17
+ "sha256": "5a0a9ce56843757a1b1c11fd82e0bed2aeae239c2c8c3d5e21f64bdae0c8cfda",
18
+ "bytes": 11172384
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
@@ -1 +1 @@
1
- import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppModal.js";import a from"./AppSpinner.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import{matchSegments as c}from"@webority/ui-elements/helpers";import{Fragment as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import"@webority/ui-elements/elements/command-palette";var _=`lg`;function v(e){let{marker:t,props:r}=n(`AppCommandPalette`,e),{open:a,onClose:o,query:c=``,onQueryChange:l,placeholder:u=`Search…`,groups:f=[],path:p=[],onPathChange:m,rootLabel:g,backLabel:v=`Back`,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C=!1,emptyText:w=`No results`,footer:T,ariaLabel:E=`Search`,resultsLabel:D=`Results`,highlight:O=!0,groupFilter:k=!1,id:A,className:j=``,...M}=r;s(`AppCommandPalette`,M);let N=d(),P=A||N;return/* @__PURE__ */ h(i,{...t,open:a,onClose:o,hideHeader:!0,placement:`top`,size:_,ariaLabel:E,className:`wui-cmd-card${j?` ${j}`:``}`,children:/* @__PURE__ */ h(y,{baseId:P,query:c,onQueryChange:l,placeholder:u,groups:f,path:p,onPathChange:m,rootLabel:g,backLabel:v,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C,emptyText:w,footer:T,ariaLabel:E,resultsLabel:D,highlight:O,groupFilter:k,onClose:o,rest:M})})}function y({baseId:n,query:i,onQueryChange:s,placeholder:c,groups:l,path:d,onPathChange:_,rootLabel:v,backLabel:y,recentsKey:C,recentsLimit:w,recentsLabel:T,loading:E,emptyText:D,footer:O,ariaLabel:k,resultsLabel:A,highlight:j,groupFilter:M,onClose:N,rest:P}){let F=p(null),I=`${n}-list`,L=l.filter(e=>e.items?.length),R=!E&&i.trim()!==``&&L.length===0,[z,B]=m({query:i,key:null}),V=z.query===i&&L.some(e=>String(e.key)===z.key)?z.key:null,H=M&&V!=null?L.filter(e=>String(e.key)===V):L,U=M&&L.length>0,W=e=>B({query:i,key:e}),G=e=>{if(!U||e.key!==`Tab`)return;e.preventDefault();let t=[x,...L.map(e=>String(e.key))],n=t[(Math.max(0,t.indexOf(V??x))+(e.shiftKey?-1:1)+t.length)%t.length];W(n===x?null:n)};return f(()=>{F.current?.refresh?.()}),u(()=>{let e=F.current,t=e=>{let t=l.find(t=>String(t.key)===e.detail.groupKey)?.items?.find(t=>String(t.key)===e.detail.key);t&&(e.preventDefault(),t.page?(s?.(``),_?.([...d,{key:t.page.key,label:t.page.label}])):(t.onSelect?.(),N?.()))},n=e=>{e.preventDefault(),s?.(``),_?.(e.detail.path)};return e.addEventListener(`wui-command-palette:select`,t),e.addEventListener(`wui-command-palette:navigate`,n),()=>{e.removeEventListener(`wui-command-palette:select`,t),e.removeEventListener(`wui-command-palette:navigate`,n)}},[l,d,N,s,_]),/* @__PURE__ */ g(`wui-command-palette`,{ref:F,path:JSON.stringify(d),"root-label":v,"recents-key":C,"recents-limit":w,"recents-label":T,...P,children:[/* @__PURE__ */ g(`div`,{className:`wui-cmd-search`,children:[/* @__PURE__ */ h(`span`,{className:`wui-cmd-search-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ h(r,{name:`search`,size:18})}),/* @__PURE__ */ h(`input`,{className:`wui-cmd-input`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":I,"aria-autocomplete":`list`,"aria-label":k,placeholder:c,autoComplete:`off`,spellCheck:!1,"data-autofocus":``,value:i,onChange:e=>s?.(e.target.value),onKeyDown:G}),E&&/* @__PURE__ */ h(a,{size:`sm`,className:`wui-cmd-spinner`})]}),U&&/* @__PURE__ */ h(`div`,{className:`wui-cmd-tabs app-tabs app-tabs-pills app-tabs-sm`,role:`tablist`,"aria-label":`Result groups`,children:[{key:``,label:`All (${L.reduce((e,t)=>e+t.items.length,0)})`},...L.map(e=>({key:String(e.key),label:`${e.label} (${e.items.length})`}))].map(e=>{let t=(V??``)===e.key;return/* @__PURE__ */ h(`button`,{type:`button`,className:t?`app-tab active`:`app-tab`,role:`tab`,"aria-selected":t?`true`:`false`,tabIndex:-1,"data-group-tab":e.key,onClick:()=>W(e.key===``?null:e.key),children:/* @__PURE__ */ h(`span`,{className:`wui-tab-label`,children:e.label})},e.key||x)})}),/* @__PURE__ */ g(`div`,{className:`wui-cmd-crumbs`,hidden:!0,children:[/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-cmd-back`,"aria-label":y,children:/* @__PURE__ */ h(r,{name:`chevron-left`,size:16})}),/* @__PURE__ */ h(`ol`,{className:`wui-cmd-trail`})]}),/* @__PURE__ */ g(`div`,{className:`wui-cmd-list`,role:`listbox`,id:I,"aria-label":A,"aria-busy":E?`true`:void 0,hidden:L.length===0,children:[/* @__PURE__ */ h(`div`,{className:`wui-cmd-recents`}),H.map(a=>{let s=`${n}-${S(a.key)}`;return/* @__PURE__ */ g(`div`,{className:`wui-cmd-group`,role:`group`,"aria-labelledby":s,children:[/* @__PURE__ */ h(`div`,{className:`wui-cmd-group-label`,role:`presentation`,id:s,children:a.label}),a.items.map(n=>{let c=`${s}-${S(n.key)}`,l=n.description==null?null:`${c}-desc`,u=n.meta==null?null:`${c}-meta`;return/* @__PURE__ */ g(`div`,{className:`wui-cmd-item`,role:`option`,id:c,"data-group-key":String(a.key),"data-key":String(n.key),"data-opens":n.page?String(n.page.key):void 0,"data-keywords":n.keywords?.length?n.keywords.join(` `):void 0,"aria-label":n.ariaLabel||(typeof n.label==`string`?n.label:``)||void 0,"aria-describedby":[l,u].filter(Boolean).join(` `)||void 0,"aria-disabled":n.disabled?`true`:void 0,"aria-keyshortcuts":e(n.shortcut),children:[n.icon!=null&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-icon`,"aria-hidden":`true`,children:o(n.icon,{size:18})}),/* @__PURE__ */ g(`span`,{className:`wui-cmd-item-text`,children:[/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-label`,children:j?b(n.label,i):n.label}),l&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-desc`,id:l,children:n.description})]}),u&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-meta`,id:u,children:n.meta}),t(n.shortcut),n.page&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-chevron`,"aria-hidden":`true`,children:/* @__PURE__ */ h(r,{name:`chevron-right`,size:16})})]},n.key)})]},a.key)})]}),/* @__PURE__ */ h(`div`,{className:`wui-cmd-empty`,role:`status`,children:R?D:null}),O!=null&&/* @__PURE__ */ h(`div`,{className:`wui-cmd-footer`,children:O})]})}function b(e,t){if(typeof e!=`string`)return e;let n=c(e,t);if(n.length===1&&!n[0].match)return e;let r=0;return n.map(e=>{let t=r;return r+=e.text.length,e.match?/* @__PURE__ */ h(`mark`,{className:`wui-cmd-mark`,children:e.text},t):/* @__PURE__ */ h(l,{children:e.text},t)})}var x=`__all__`;function S(e){return String(e).replace(/\s+/g,`_`)}export{v as default};
1
+ import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppModal.js";import a from"./AppSpinner.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import{matchSegments as c}from"@webority/ui-elements/helpers";import{Fragment as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import"@webority/ui-elements/elements/command-palette";var _=`lg`;function v(e){let{marker:t,props:r}=n(`AppCommandPalette`,e),{open:a,onClose:o,query:c=``,onQueryChange:l,placeholder:u=`Search…`,groups:f=[],path:p=[],onPathChange:m,rootLabel:g,backLabel:v=`Back`,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C=!1,emptyText:w=`No results`,footer:T,ariaLabel:E=`Search`,resultsLabel:D=`Results`,highlight:O=!0,groupFilter:k=!1,id:A,className:j=``,...M}=r;s(`AppCommandPalette`,M);let N=d(),P=A||N;return/* @__PURE__ */ h(i,{...t,open:a,onClose:o,staticBackdrop:!1,hideHeader:!0,placement:`top`,size:_,ariaLabel:E,className:`wui-cmd-card${j?` ${j}`:``}`,children:/* @__PURE__ */ h(y,{baseId:P,query:c,onQueryChange:l,placeholder:u,groups:f,path:p,onPathChange:m,rootLabel:g,backLabel:v,recentsKey:b,recentsLimit:x,recentsLabel:S,loading:C,emptyText:w,footer:T,ariaLabel:E,resultsLabel:D,highlight:O,groupFilter:k,onClose:o,rest:M})})}function y({baseId:n,query:i,onQueryChange:s,placeholder:c,groups:l,path:d,onPathChange:_,rootLabel:v,backLabel:y,recentsKey:C,recentsLimit:w,recentsLabel:T,loading:E,emptyText:D,footer:O,ariaLabel:k,resultsLabel:A,highlight:j,groupFilter:M,onClose:N,rest:P}){let F=p(null),I=`${n}-list`,L=l.filter(e=>e.items?.length),R=!E&&i.trim()!==``&&L.length===0,[z,B]=m({query:i,key:null}),V=z.query===i&&L.some(e=>String(e.key)===z.key)?z.key:null,H=M&&V!=null?L.filter(e=>String(e.key)===V):L,U=M&&L.length>0,W=e=>B({query:i,key:e}),G=e=>{if(!U||e.key!==`Tab`)return;e.preventDefault();let t=[x,...L.map(e=>String(e.key))],n=t[(Math.max(0,t.indexOf(V??x))+(e.shiftKey?-1:1)+t.length)%t.length];W(n===x?null:n)};return f(()=>{F.current?.refresh?.()}),u(()=>{let e=F.current,t=e=>{let t=l.find(t=>String(t.key)===e.detail.groupKey)?.items?.find(t=>String(t.key)===e.detail.key);t&&(e.preventDefault(),t.page?(s?.(``),_?.([...d,{key:t.page.key,label:t.page.label}])):(t.onSelect?.(),N?.()))},n=e=>{e.preventDefault(),s?.(``),_?.(e.detail.path)};return e.addEventListener(`wui-command-palette:select`,t),e.addEventListener(`wui-command-palette:navigate`,n),()=>{e.removeEventListener(`wui-command-palette:select`,t),e.removeEventListener(`wui-command-palette:navigate`,n)}},[l,d,N,s,_]),/* @__PURE__ */ g(`wui-command-palette`,{ref:F,path:JSON.stringify(d),"root-label":v,"recents-key":C,"recents-limit":w,"recents-label":T,...P,children:[/* @__PURE__ */ g(`div`,{className:`wui-cmd-search`,children:[/* @__PURE__ */ h(`span`,{className:`wui-cmd-search-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ h(r,{name:`search`,size:18})}),/* @__PURE__ */ h(`input`,{className:`wui-cmd-input`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":I,"aria-autocomplete":`list`,"aria-label":k,placeholder:c,autoComplete:`off`,spellCheck:!1,"data-autofocus":``,value:i,onChange:e=>s?.(e.target.value),onKeyDown:G}),E&&/* @__PURE__ */ h(a,{size:`sm`,className:`wui-cmd-spinner`})]}),U&&/* @__PURE__ */ h(`div`,{className:`wui-cmd-tabs app-tabs app-tabs-pills app-tabs-sm`,role:`tablist`,"aria-label":`Result groups`,children:[{key:``,label:`All (${L.reduce((e,t)=>e+t.items.length,0)})`},...L.map(e=>({key:String(e.key),label:`${e.label} (${e.items.length})`}))].map(e=>{let t=(V??``)===e.key;return/* @__PURE__ */ h(`button`,{type:`button`,className:t?`app-tab active`:`app-tab`,role:`tab`,"aria-selected":t?`true`:`false`,tabIndex:-1,"data-group-tab":e.key,onClick:()=>W(e.key===``?null:e.key),children:/* @__PURE__ */ h(`span`,{className:`wui-tab-label`,children:e.label})},e.key||x)})}),/* @__PURE__ */ g(`div`,{className:`wui-cmd-crumbs`,hidden:!0,children:[/* @__PURE__ */ h(`button`,{type:`button`,className:`wui-cmd-back`,"aria-label":y,children:/* @__PURE__ */ h(r,{name:`chevron-left`,size:16})}),/* @__PURE__ */ h(`ol`,{className:`wui-cmd-trail`})]}),/* @__PURE__ */ g(`div`,{className:`wui-cmd-list`,role:`listbox`,id:I,"aria-label":A,"aria-busy":E?`true`:void 0,hidden:L.length===0,children:[/* @__PURE__ */ h(`div`,{className:`wui-cmd-recents`}),H.map(a=>{let s=`${n}-${S(a.key)}`;return/* @__PURE__ */ g(`div`,{className:`wui-cmd-group`,role:`group`,"aria-labelledby":s,children:[/* @__PURE__ */ h(`div`,{className:`wui-cmd-group-label`,role:`presentation`,id:s,children:a.label}),a.items.map(n=>{let c=`${s}-${S(n.key)}`,l=n.description==null?null:`${c}-desc`,u=n.meta==null?null:`${c}-meta`;return/* @__PURE__ */ g(`div`,{className:`wui-cmd-item`,role:`option`,id:c,"data-group-key":String(a.key),"data-key":String(n.key),"data-opens":n.page?String(n.page.key):void 0,"data-keywords":n.keywords?.length?n.keywords.join(` `):void 0,"aria-label":n.ariaLabel||(typeof n.label==`string`?n.label:``)||void 0,"aria-describedby":[l,u].filter(Boolean).join(` `)||void 0,"aria-disabled":n.disabled?`true`:void 0,"aria-keyshortcuts":e(n.shortcut),children:[n.icon!=null&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-icon`,"aria-hidden":`true`,children:o(n.icon,{size:18})}),/* @__PURE__ */ g(`span`,{className:`wui-cmd-item-text`,children:[/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-label`,children:j?b(n.label,i):n.label}),l&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-desc`,id:l,children:n.description})]}),u&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-meta`,id:u,children:n.meta}),t(n.shortcut),n.page&&/* @__PURE__ */ h(`span`,{className:`wui-cmd-item-chevron`,"aria-hidden":`true`,children:/* @__PURE__ */ h(r,{name:`chevron-right`,size:16})})]},n.key)})]},a.key)})]}),/* @__PURE__ */ h(`div`,{className:`wui-cmd-empty`,role:`status`,children:R?D:null}),O!=null&&/* @__PURE__ */ h(`div`,{className:`wui-cmd-footer`,children:O})]})}function b(e,t){if(typeof e!=`string`)return e;let n=c(e,t);if(n.length===1&&!n[0].match)return e;let r=0;return n.map(e=>{let t=r;return r+=e.text.length,e.match?/* @__PURE__ */ h(`mark`,{className:`wui-cmd-mark`,children:e.text},t):/* @__PURE__ */ h(l,{children:e.text},t)})}var x=`__all__`;function S(e){return String(e).replace(/\s+/g,`_`)}export{v as default};
@@ -1 +1 @@
1
- import e from"../lib/fillLabel.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import i from"./AppInput.js";import a from"./AppModal.js";import{MODAL_ICONS as o}from"./ModalIcons.js";import s from"./warnInvalidValue.js";import c from"./warnUnknownProps.js";import{useEffect as l,useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`,`xl`],h=[`default`,`plain`],g=[`success`,`danger`,`warning`,`info`,`primary`];function _(_){let{marker:v,props:y}=t(`AppConfirmDialog`,_),{open:b,title:x,variant:S=`default`,description:C,confirmLabel:w=`Confirm`,cancelLabel:T=`Cancel`,typePhraseLabel:E=`Type {phrase} to confirm`,tone:D,image:O,icon:k,iconSize:A,confirmPhrase:j,onConfirm:M,onClose:N,loading:P=!1,staticBackdrop:F=!1,placement:I=`center`,size:L=`md`,className:R=``,children:z,...B}=y;c(`AppConfirmDialog`,B),s(`AppConfirmDialog`,`tone`,D,g),s(`AppConfirmDialog`,`size`,typeof L==`string`?L:null,m),s(`AppConfirmDialog`,`variant`,S,h);let[V,H]=u(``);if(l(()=>{b||H(``)},[b]),!b)return null;let U=!!j&&V.trim()!==j,[W,...G]=E.split(`{phrase}`),K=G.join(j),q=S===`plain`,J=q?`sm`:`md`,Y=q||O||k?null:o[D===`danger`?`delete`:D??`info`],X=A>0?{"--wui-confirm-icon-size":`${A}px`}:void 0,Z=()=>{P||N?.()};return/* @__PURE__ */ f(a,{...v,...B,open:b,hideHeader:!0,title:x,onClose:Z,staticBackdrop:F,placement:I,size:L,className:[`wui-confirm`,q&&`wui-confirm-plain`,R].filter(Boolean).join(` `),footer:/* @__PURE__ */ p(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ f(n,{...q?{tone:`neutral`}:{variant:`soft`},size:J,disabled:P,onClick:Z,children:T}),/* @__PURE__ */ f(n,{tone:D===`danger`?`danger`:void 0,size:J,disabled:U,loading:P,onClick:M,children:w})]}),children:/* @__PURE__ */ p(`div`,{className:`wui-confirm-content`,children:[!q&&O?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(`img`,{src:O,alt:``,"aria-hidden":`true`})}):!q&&k?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:typeof k==`string`?/* @__PURE__ */ f(r,{name:k,size:80}):k}):Y&&/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(Y,{size:120})}),/* @__PURE__ */ f(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:x}),C&&/* @__PURE__ */ f(`p`,{className:`wui-confirm-msg`,children:C}),z!=null&&z!==!1&&/* @__PURE__ */ f(`div`,{className:`wui-confirm-body`,children:z}),j&&/* @__PURE__ */ f(i,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ p(d,{children:[W,/* @__PURE__ */ f(`strong`,{children:j}),K]}),value:V,onChange:e=>H(e.target.value),"aria-label":e(E,{phrase:j}),disabled:P})]})})}export{_ as default};
1
+ import e from"../lib/fillLabel.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import i from"./AppInput.js";import a from"./AppModal.js";import{MODAL_ICONS as o}from"./ModalIcons.js";import s from"./warnInvalidValue.js";import c from"./warnUnknownProps.js";import{useEffect as l,useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`,`xl`],h=[`default`,`plain`],g=[`success`,`danger`,`warning`,`info`,`primary`];function _(_){let{marker:v,props:y}=t(`AppConfirmDialog`,_),{open:b,title:x,variant:S=`default`,description:C,confirmLabel:w=`Confirm`,cancelLabel:T=`Cancel`,typePhraseLabel:E=`Type {phrase} to confirm`,tone:D,image:O,icon:k,iconSize:A,confirmPhrase:j,onConfirm:M,onClose:N,loading:P=!1,staticBackdrop:F=!0,placement:I=`center`,size:L=`md`,className:R=``,children:z,...B}=y;c(`AppConfirmDialog`,B),s(`AppConfirmDialog`,`tone`,D,g),s(`AppConfirmDialog`,`size`,typeof L==`string`?L:null,m),s(`AppConfirmDialog`,`variant`,S,h);let[V,H]=u(``);if(l(()=>{b||H(``)},[b]),!b)return null;let U=!!j&&V.trim()!==j,[W,...G]=E.split(`{phrase}`),K=G.join(j),q=S===`plain`,J=q?`sm`:`md`,Y=q||O||k?null:o[D===`danger`?`delete`:D??`info`],X=A>0?{"--wui-confirm-icon-size":`${A}px`}:void 0,Z=()=>{P||N?.()};return/* @__PURE__ */ f(a,{...v,...B,open:b,hideHeader:!0,title:x,onClose:Z,staticBackdrop:F,placement:I,size:L,className:[`wui-confirm`,q&&`wui-confirm-plain`,R].filter(Boolean).join(` `),footer:/* @__PURE__ */ p(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ f(n,{...q?{tone:`neutral`}:{variant:`soft`},size:J,disabled:P,onClick:Z,children:T}),/* @__PURE__ */ f(n,{tone:D===`danger`?`danger`:void 0,size:J,disabled:U,loading:P,onClick:M,children:w})]}),children:/* @__PURE__ */ p(`div`,{className:`wui-confirm-content`,children:[!q&&O?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(`img`,{src:O,alt:``,"aria-hidden":`true`})}):!q&&k?/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:typeof k==`string`?/* @__PURE__ */ f(r,{name:k,size:80}):k}):Y&&/* @__PURE__ */ f(`span`,{className:`wui-confirm-icon`,style:X,children:/* @__PURE__ */ f(Y,{size:120})}),/* @__PURE__ */ f(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:x}),C&&/* @__PURE__ */ f(`p`,{className:`wui-confirm-msg`,children:C}),z!=null&&z!==!1&&/* @__PURE__ */ f(`div`,{className:`wui-confirm-body`,children:z}),j&&/* @__PURE__ */ f(i,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ p(d,{children:[W,/* @__PURE__ */ f(`strong`,{children:j}),K]}),value:V,onChange:e=>H(e.target.value),"aria-label":e(E,{phrase:j}),disabled:P})]})})}export{_ as default};
@@ -1 +1 @@
1
- import e from"../lib/DiscardPrompt.js";import{lockPageScroll as t}from"../lib/pageScrollLock.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./warnInvalidValue.js";import a from"./warnUnknownProps.js";import{useEffect as o,useRef as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/drawer";var d=[`end`,`start`],f=[`sm`,`md`,`lg`,`xl`],p=[50,90],m=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function h(h){let{marker:g,props:_}=n(`AppDrawer`,h),{open:v=!1,onClose:y,title:b,titleIcon:x,header:S,subtitle:C,ariaLabel:w,side:T=`end`,size:E=`md`,width:D,maxWidth:O,snapPoints:k=p,defaultSnap:A=0,sheet:j=!0,onSnapChange:M,onOpened:N,onClosed:P,dismissible:F=!0,closeLabel:I=`Close`,sheetHeightLabel:L=`Sheet height`,staticBackdrop:R=!1,confirmDiscard:z,dirty:B=!1,headerClassName:V=``,bodyClassName:H=``,footer:U,className:W=``,style:G,children:K,...q}=_;a(`AppDrawer`,q),i(`AppDrawer`,`side`,T,d),i(`AppDrawer`,`size`,E,f),i(`AppDrawer`,`snapPoints`,m(k)?void 0:JSON.stringify(k),[`an array of numbers from 10 to 100`]);let J=s(null),Y=s(null),X=s(null),[Z,Q]=c(!1);Y.current={onClose:y,onSnapChange:M,onOpened:N,onClosed:P,confirmDiscard:z,dirty:B},o(()=>{v||Q(!1)},[v]),o(()=>{Z&&X.current?.focus()},[Z]),o(()=>{if(v)return t()},[v]),o(()=>{let e=J.current;if(!e)return;let t=t=>{t.target===e&&(t.preventDefault(),Y.current.confirmDiscard&&Y.current.dirty?Q(!0):Y.current.onClose?.())},n=t=>{t.target===e&&Y.current.onSnapChange?.(t.detail.index,t.detail.percent)},r=t=>{t.target===e&&Y.current.onOpened?.()},i=t=>{t.target===e&&Y.current.onClosed?.()},a=n=>{n.target.closest?.(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),e.addEventListener(`click`,a),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i),e.removeEventListener(`click`,a)}},[]);let $=()=>{Q(!1),J.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),Y.current.onClose?.()},ee=m(k)?k:p,te={...D&&{"--wui-drawer-width":D},...O&&{"--wui-drawer-max-width":O},...G};return/* @__PURE__ */ u(`wui-drawer`,{ref:J,...g,...q,class:[`wui-drawer`,W].filter(Boolean).join(` `),side:T,size:E,"snap-points":ee.join(`,`),"default-snap":String(A),static:R?``:void 0,"no-sheet":j?void 0:``,"no-dismiss":F?void 0:``,"confirm-discard":z||void 0,open:v?``:void 0,style:te,children:[/* @__PURE__ */ l(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),/* @__PURE__ */ u(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":w||b||void 0,tabIndex:-1,children:[j&&/* @__PURE__ */ l(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:/* @__PURE__ */ l(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":L})}),S===void 0?/* @__PURE__ */ u(`div`,{className:[`wui-drawer-header`,V].filter(Boolean).join(` `),"data-wui-drawer-grip":j?``:void 0,children:[/* @__PURE__ */ u(`div`,{className:`wui-drawer-headtext`,children:[b&&/* @__PURE__ */ u(`div`,{className:`wui-drawer-title`,children:[x&&/* @__PURE__ */ l(`span`,{className:`wui-drawer-title-ic`,children:/* @__PURE__ */ l(r,{name:x,size:18})}),b]}),C&&/* @__PURE__ */ l(`div`,{className:`wui-drawer-subtitle`,children:C})]}),F&&/* @__PURE__ */ l(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":I,children:/* @__PURE__ */ l(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ l(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):S,/* @__PURE__ */ l(`div`,{className:[`wui-drawer-body`,H].filter(Boolean).join(` `),children:K}),(U||Z)&&/* @__PURE__ */ u(`div`,{className:Z?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[Z&&/* @__PURE__ */ l(e,{text:z,confirmRef:X,onDiscard:$,onKeep:()=>Q(!1)}),U]})]})]})}export{h as default};
1
+ import e from"../lib/DiscardPrompt.js";import{lockPageScroll as t}from"../lib/pageScrollLock.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./warnInvalidValue.js";import a from"./warnUnknownProps.js";import{useEffect as o,useRef as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/drawer";var d=[`end`,`start`],f=[`sm`,`md`,`lg`,`xl`],p=[50,90],m=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Number.isFinite(e)&&e>=10&&e<=100);function h(h){let{marker:g,props:_}=n(`AppDrawer`,h),{open:v=!1,onClose:y,title:b,titleIcon:x,header:S,subtitle:C,ariaLabel:w,side:T=`end`,size:E=`md`,width:D,maxWidth:O,snapPoints:k=p,defaultSnap:A=0,sheet:j=!0,onSnapChange:M,onOpened:N,onClosed:P,dismissible:F=!0,closeLabel:I=`Close`,sheetHeightLabel:L=`Sheet height`,staticBackdrop:R=!0,confirmDiscard:z,dirty:B=!1,headerClassName:V=``,bodyClassName:H=``,footer:U,className:W=``,style:G,children:K,...q}=_;a(`AppDrawer`,q),i(`AppDrawer`,`side`,T,d),i(`AppDrawer`,`size`,E,f),i(`AppDrawer`,`snapPoints`,m(k)?void 0:JSON.stringify(k),[`an array of numbers from 10 to 100`]);let J=s(null),Y=s(null),X=s(null),[Z,Q]=c(!1);Y.current={onClose:y,onSnapChange:M,onOpened:N,onClosed:P,confirmDiscard:z,dirty:B},o(()=>{v||Q(!1)},[v]),o(()=>{Z&&X.current?.focus()},[Z]),o(()=>{if(v)return t()},[v]),o(()=>{let e=J.current;if(!e)return;let t=t=>{t.target===e&&(t.preventDefault(),Y.current.confirmDiscard&&Y.current.dirty?Q(!0):Y.current.onClose?.())},n=t=>{t.target===e&&Y.current.onSnapChange?.(t.detail.index,t.detail.percent)},r=t=>{t.target===e&&Y.current.onOpened?.()},i=t=>{t.target===e&&Y.current.onClosed?.()},a=n=>{n.target.closest?.(`[data-wui-dismiss]`)&&t({target:e,preventDefault(){}})};return e.addEventListener(`wui-drawer-close`,t),e.addEventListener(`wui-drawer-snap`,n),e.addEventListener(`wui-drawer-opened`,r),e.addEventListener(`wui-drawer-closed`,i),e.addEventListener(`click`,a),()=>{e.removeEventListener(`wui-drawer-close`,t),e.removeEventListener(`wui-drawer-snap`,n),e.removeEventListener(`wui-drawer-opened`,r),e.removeEventListener(`wui-drawer-closed`,i),e.removeEventListener(`click`,a)}},[]);let $=()=>{Q(!1),J.current?.dispatchEvent(new CustomEvent(`wui:drawer:discard`,{bubbles:!0})),Y.current.onClose?.()},ee=m(k)?k:p,te={...D&&{"--wui-drawer-width":D},...O&&{"--wui-drawer-max-width":O},...G};return/* @__PURE__ */ u(`wui-drawer`,{ref:J,...g,...q,class:[`wui-drawer`,W].filter(Boolean).join(` `),side:T,size:E,"snap-points":ee.join(`,`),"default-snap":String(A),static:R?``:void 0,"no-sheet":j?void 0:``,"no-dismiss":F?void 0:``,"confirm-discard":z||void 0,open:v?``:void 0,style:te,children:[/* @__PURE__ */ l(`div`,{className:`wui-drawer-backdrop`,"data-wui-drawer-backdrop":``,"aria-hidden":`true`}),/* @__PURE__ */ u(`div`,{className:`wui-drawer-panel`,role:`dialog`,"aria-modal":`true`,"aria-label":w||b||void 0,tabIndex:-1,children:[j&&/* @__PURE__ */ l(`div`,{className:`wui-drawer-grip`,"data-wui-drawer-grip":``,children:/* @__PURE__ */ l(`div`,{className:`wui-drawer-handle`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":L})}),S===void 0?/* @__PURE__ */ u(`div`,{className:[`wui-drawer-header`,V].filter(Boolean).join(` `),"data-wui-drawer-grip":j?``:void 0,children:[/* @__PURE__ */ u(`div`,{className:`wui-drawer-headtext`,children:[b&&/* @__PURE__ */ u(`div`,{className:`wui-drawer-title`,children:[x&&/* @__PURE__ */ l(`span`,{className:`wui-drawer-title-ic`,children:/* @__PURE__ */ l(r,{name:x,size:18})}),b]}),C&&/* @__PURE__ */ l(`div`,{className:`wui-drawer-subtitle`,children:C})]}),F&&/* @__PURE__ */ l(`button`,{type:`button`,className:`wui-drawer-close`,"data-wui-drawer-close":``,"aria-label":I,children:/* @__PURE__ */ l(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ l(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}):S,/* @__PURE__ */ l(`div`,{className:[`wui-drawer-body`,H].filter(Boolean).join(` `),children:K}),(U||Z)&&/* @__PURE__ */ u(`div`,{className:Z?`wui-drawer-footer wui-drawer-discarding`:`wui-drawer-footer`,children:[Z&&/* @__PURE__ */ l(e,{text:z,confirmRef:X,onDiscard:$,onKeep:()=>Q(!1)}),U]})]})]})}export{h as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{FIELD_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import a from"../lib/fillLabel.js";import o from"../lib/useFileDrop.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import re from"./AppSpinner.js";import ie from"./warnInvalidValue.js";import ae from"./warnUnknownProps.js";import oe from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as se,acceptDroppedFiles as ce,acceptLabel as c,isImageFile as l,isImageOnlyAccept as le,isPdfFile as ue}from"@webority/ui-elements/helpers";import{useEffect as u,useId as de,useRef as fe,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var pe=[`dropzone`,`button`],me={sm:` input-sm`,md:``,lg:` input-lg`};function m(m){let{marker:he,props:ge}=ee(`AppFilePicker`,m),{label:h,value:g,name:_e,id:ve,onChange:_,multiple:v=!1,variant:y=`dropzone`,buttonLabel:ye=`Add file`,browseLabel:be=`Click to upload`,dropLabel:xe=`or drag & drop`,maxSizeText:Se=`up to {size} MB`,optionalLabel:Ce=`(optional)`,changeImageLabel:we=`Change image`,changeFileLabel:Te=`Change file`,maxFilesText:Ee=`Up to {count} files.`,removeFileLabel:De=`Remove {name}`,maxFiles:b,accept:x=`.jpg,.jpeg,.png`,maxSizeMb:S=se,required:C,optional:Oe=!1,error:ke,helperText:w,help:T,helpLabel:Ae=`More information`,loading:E=!1,readOnly:D=!1,size:O=`md`,disabled:k=!1,className:A=``,fieldClassName:j=``,style:M,...N}=ge;ae(`AppFilePicker`,N),ie(`AppFilePicker`,`variant`,y,pe),ie(`AppFilePicker`,`size`,O,r);let P=me[O]??``,F=D?{"aria-readonly":`true`,"data-wui-readonly":``}:null,[je,I]=d(null),[Me,L]=d(null),[Ne,R]=d(``),z=fe(null),Pe=de(),B=ve||Pe,V=k||E;u(()=>{if(!v&&g instanceof File&&l(g)){let e=URL.createObjectURL(g);return I(e),()=>URL.revokeObjectURL(e)}I(null)},[g,v]);let H=!v&&g&&!l(g)&&ue(g)?g instanceof File?g:g.url:null;u(()=>{if(!H){L(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof H==`string`?{url:H}:H)).then(e=>{t&&(n=URL.createObjectURL(e),L(n))}).catch(t=>e(`[AppFilePicker] the PDF preview failed:`,t?.message)),()=>{t=!1,L(null),n&&URL.revokeObjectURL(n)}},[H]);let U=v?Array.isArray(g)?g:g?[g]:[]:[],W=ke||Ne,G=W?`${B}-error`:void 0,K=w&&!W?`${B}-hint`:void 0,Fe=G||K,q=le(x),Ie=y===`button`,Le=!v&&!!g,J=Le&&(g instanceof File?l(g):q||l(g)),Re=g?.name,ze=J?g?.url||je:Me,Y=J?`image`:`file`,Be=h?`Change ${h}`:`Change ${Y}`,X=h?`Remove ${h}`:`Remove ${Y}`,Ve=h?`${h} preview`:`Selected ${Y} preview`,He={accept:x,maxSizeMb:S,multiple:v},Ue=e=>{if(R(``),!v){_(e[0]);return}let t=Array.isArray(g)?g:g?[g]:[],n=new Set(t.map(i)),r=[];for(let t of e)n.has(i(t))||(n.add(i(t)),r.push(t));let o=t.concat(r);b&&o.length>b&&(o=o.slice(0,b),R(a(Ee,{count:b}))),_(o)},Z=e=>R(e.message),{dragOver:We,dropProps:Ge}=o({...He,disabled:V||D,onFiles:Ue,onReject:Z}),Ke=e=>{if(D)return;let{files:t,rejections:n}=ce(e,He);t.length&&Ue(t),n.length&&Z(n[0])},qe=e=>Ke(e.target.files),Je=e=>{D||(R(``),_(U.filter((t,n)=>n!==e)))},Ye=()=>{D||z.current?.click()},Q=E?/* @__PURE__ */ f(`span`,{className:`wui-file-busy`,children:/* @__PURE__ */ f(re,{size:`sm`})}):null,$=/* @__PURE__ */ f(`input`,{id:B,name:_e,ref:z,type:`file`,"aria-describedby":Fe,accept:x,multiple:v||void 0,disabled:V||void 0,className:`visually-hidden`,onClick:e=>{D?e.preventDefault():e.currentTarget.value=``},onChange:qe,...N});return/* @__PURE__ */ p(`div`,{...he,className:`field${j?` ${j}`:``}`,children:[/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:B,children:[h,Oe&&!C&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${Ce}`}),C&&/* @__PURE__ */ f(ne,{}),T&&/* @__PURE__ */ f(te,{label:Ae,children:T})]}),Ie?/* @__PURE__ */ p(`div`,{className:`file-input wui-file-input-button-field${P}${W?` error`:``}${A?` ${A}`:``}`,style:M,"aria-busy":E||void 0,...F,children:[/* @__PURE__ */ p(`label`,{htmlFor:B,className:`btn btn-outline-primary btn-sm`,children:[/* @__PURE__ */ f(s,{name:`paperclip`,size:16}),ye]}),$,Q]}):Le?/* @__PURE__ */ p(`div`,{className:`file-preview${P}${W?` error`:``}${A?` ${A}`:``}`,style:M,"aria-busy":E||void 0,...F,children:[/* @__PURE__ */ p(`button`,{type:`button`,className:`file-preview-open`,"aria-label":Be,onClick:Ye,disabled:V||D,children:[ze?/* @__PURE__ */ f(`img`,{src:ze,alt:Ve,className:`file-preview-img`}):/* @__PURE__ */ p(`span`,{className:`file-preview-file`,children:[/* @__PURE__ */ f(s,{name:`file-text`,size:28}),/* @__PURE__ */ f(`span`,{className:`file-preview-file-name`,children:Re})]}),/* @__PURE__ */ f(`span`,{className:`file-preview-overlay`,children:/* @__PURE__ */ p(`span`,{className:`file-preview-cta`,children:[/* @__PURE__ */ f(s,{name:J?`image`:`file-text`,size:16}),` `,J?we:Te]})})]}),oe(/* @__PURE__ */ f(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":X,onClick:()=>_(null),disabled:V||D,children:/* @__PURE__ */ f(s,{name:`x`,size:16})}),X),$,Q]}):/* @__PURE__ */ p(`div`,{className:`file-input file-input-tall${P}${We?` dragging`:``}${W?` error`:``}${v&&U.length>0?` has-files`:``}${A?` ${A}`:``}`,style:M,"aria-busy":E||void 0,"aria-disabled":k||void 0,...F,...Ge,children:[/* @__PURE__ */ p(`label`,{htmlFor:B,className:`file-input-zone-label`,children:[/* @__PURE__ */ f(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ f(s,{name:`upload`,size:24})}),/* @__PURE__ */ p(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ f(`span`,{className:`browse`,children:be}),` ${xe}`]}),/* @__PURE__ */ f(`span`,{className:`file-input-text`,children:S>0?`${c(x)}, ${a(Se,{size:S})}`:c(x)})]}),$,Q,v&&U.length>0&&/* @__PURE__ */ f(`div`,{className:`attach-list`,children:U.map((e,t)=>/* @__PURE__ */ f(n,{item:e,isImage:e instanceof File?l(e):q||l(e),noun:`file`,removeFileLabel:De,readOnly:D,onRemove:()=>Je(t)},i(e)))})]}),/* @__PURE__ */ f(t,{error:W,hint:w,errorId:G,hintId:K})]})}export{m as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{FIELD_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import a from"../lib/fillLabel.js";import o from"../lib/useFileDrop.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import re from"./AppSpinner.js";import ie from"./warnInvalidValue.js";import ae from"./warnUnknownProps.js";import oe from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as se,acceptDroppedFiles as ce,acceptLabel as c,isImageFile as l,isImageOnlyAccept as le,isPdfFile as ue}from"@webority/ui-elements/helpers";import{useEffect as u,useId as de,useRef as fe,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var pe=[`dropzone`,`button`],me={sm:` input-sm`,md:``,lg:` input-lg`},he={md:``,lg:` btn-lg`};function m(m){let{marker:ge,props:_e}=ee(`AppFilePicker`,m),{label:h,value:g,name:ve,id:ye,onChange:_,multiple:v=!1,variant:y=`dropzone`,buttonLabel:be=`Add file`,browseLabel:xe=`Click to upload`,dropLabel:Se=`or drag & drop`,maxSizeText:Ce=`up to {size} MB`,optionalLabel:we=`(optional)`,changeImageLabel:Te=`Change image`,changeFileLabel:Ee=`Change file`,maxFilesText:De=`Up to {count} files.`,removeFileLabel:Oe=`Remove {name}`,maxFiles:b,accept:x=`.jpg,.jpeg,.png`,maxSizeMb:S=se,required:C,optional:ke=!1,error:Ae,helperText:w,help:T,helpLabel:je=`More information`,loading:E=!1,readOnly:D=!1,size:O,disabled:k=!1,className:A=``,fieldClassName:j=``,style:M,...N}=_e;ae(`AppFilePicker`,N),ie(`AppFilePicker`,`variant`,y,pe),ie(`AppFilePicker`,`size`,O,r);let P=me[O]??``,F=D?{"aria-readonly":`true`,"data-wui-readonly":``}:null,[Me,I]=d(null),[Ne,L]=d(null),[Pe,R]=d(``),z=fe(null),Fe=de(),B=ye||Fe,V=k||E;u(()=>{if(!v&&g instanceof File&&l(g)){let e=URL.createObjectURL(g);return I(e),()=>URL.revokeObjectURL(e)}I(null)},[g,v]);let H=!v&&g&&!l(g)&&ue(g)?g instanceof File?g:g.url:null;u(()=>{if(!H){L(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof H==`string`?{url:H}:H)).then(e=>{t&&(n=URL.createObjectURL(e),L(n))}).catch(t=>e(`[AppFilePicker] the PDF preview failed:`,t?.message)),()=>{t=!1,L(null),n&&URL.revokeObjectURL(n)}},[H]);let U=v?Array.isArray(g)?g:g?[g]:[]:[],W=Ae||Pe,G=W?`${B}-error`:void 0,K=w&&!W?`${B}-hint`:void 0,Ie=G||K,q=le(x),Le=y===`button`,Re=`btn btn-outline-primary${he[O]??` btn-sm`}`,ze=!v&&!!g,J=ze&&(g instanceof File?l(g):q||l(g)),Be=g?.name,Ve=J?g?.url||Me:Ne,Y=J?`image`:`file`,He=h?`Change ${h}`:`Change ${Y}`,Ue=h?`Remove ${h}`:`Remove ${Y}`,We=h?`${h} preview`:`Selected ${Y} preview`,X={accept:x,maxSizeMb:S,multiple:v},Ge=e=>{if(R(``),!v){_(e[0]);return}let t=Array.isArray(g)?g:g?[g]:[],n=new Set(t.map(i)),r=[];for(let t of e)n.has(i(t))||(n.add(i(t)),r.push(t));let o=t.concat(r);b&&o.length>b&&(o=o.slice(0,b),R(a(De,{count:b}))),_(o)},Z=e=>R(e.message),{dragOver:Ke,dropProps:qe}=o({...X,disabled:V||D,onFiles:Ge,onReject:Z}),Je=e=>{if(D)return;let{files:t,rejections:n}=ce(e,X);t.length&&Ge(t),n.length&&Z(n[0])},Ye=e=>Je(e.target.files),Xe=e=>{D||(R(``),_(U.filter((t,n)=>n!==e)))},Ze=()=>{D||z.current?.click()},Q=E?/* @__PURE__ */ f(`span`,{className:`wui-file-busy`,children:/* @__PURE__ */ f(re,{size:`sm`})}):null,$=/* @__PURE__ */ f(`input`,{id:B,name:ve,ref:z,type:`file`,"aria-describedby":Ie,accept:x,multiple:v||void 0,disabled:V||void 0,className:`visually-hidden`,onClick:e=>{D?e.preventDefault():e.currentTarget.value=``},onChange:Ye,...N});return/* @__PURE__ */ p(`div`,{...ge,className:`field${j?` ${j}`:``}`,children:[h?/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:B,children:[h,ke&&!C&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${we}`}),C&&/* @__PURE__ */ f(ne,{}),T&&/* @__PURE__ */ f(te,{label:je,children:T})]}):null,Le?/* @__PURE__ */ p(`div`,{className:`file-input wui-file-input-button-field${P}${W?` error`:``}${A?` ${A}`:``}`,style:M,"aria-busy":E||void 0,...F,children:[/* @__PURE__ */ p(`label`,{htmlFor:B,className:Re,children:[/* @__PURE__ */ f(s,{name:`paperclip`,size:16}),be]}),$,Q]}):ze?/* @__PURE__ */ p(`div`,{className:`file-preview${P}${W?` error`:``}${A?` ${A}`:``}`,style:M,"aria-busy":E||void 0,...F,children:[/* @__PURE__ */ p(`button`,{type:`button`,className:`file-preview-open`,"aria-label":He,onClick:Ze,disabled:V||D,children:[Ve?/* @__PURE__ */ f(`img`,{src:Ve,alt:We,className:`file-preview-img`}):/* @__PURE__ */ p(`span`,{className:`file-preview-file`,children:[/* @__PURE__ */ f(s,{name:`file-text`,size:28}),/* @__PURE__ */ f(`span`,{className:`file-preview-file-name`,children:Be})]}),/* @__PURE__ */ f(`span`,{className:`file-preview-overlay`,children:/* @__PURE__ */ p(`span`,{className:`file-preview-cta`,children:[/* @__PURE__ */ f(s,{name:J?`image`:`file-text`,size:16}),` `,J?Te:Ee]})})]}),oe(/* @__PURE__ */ f(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":Ue,onClick:()=>_(null),disabled:V||D,children:/* @__PURE__ */ f(s,{name:`x`,size:16})}),Ue),$,Q]}):/* @__PURE__ */ p(`div`,{className:`file-input file-input-tall${P}${Ke?` dragging`:``}${W?` error`:``}${v&&U.length>0?` has-files`:``}${A?` ${A}`:``}`,style:M,"aria-busy":E||void 0,"aria-disabled":k||void 0,...F,...qe,children:[/* @__PURE__ */ p(`label`,{htmlFor:B,className:`file-input-zone-label`,children:[/* @__PURE__ */ f(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ f(s,{name:`upload`,size:24})}),/* @__PURE__ */ p(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ f(`span`,{className:`browse`,children:xe}),` ${Se}`]}),/* @__PURE__ */ f(`span`,{className:`file-input-text`,children:S>0?`${c(x)}, ${a(Ce,{size:S})}`:c(x)})]}),$,Q,v&&U.length>0&&/* @__PURE__ */ f(`div`,{className:`attach-list`,children:U.map((e,t)=>/* @__PURE__ */ f(n,{item:e,isImage:e instanceof File?l(e):q||l(e),noun:`file`,removeFileLabel:Oe,readOnly:D,onRemove:()=>Xe(t)},i(e)))})]}),/* @__PURE__ */ f(t,{error:W,hint:w,errorId:G,hintId:K})]})}export{m as default};
@@ -1 +1 @@
1
- import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import{lockPageScroll as n}from"../lib/pageScrollLock.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./warnInvalidValue.js";import o from"./warnUnknownProps.js";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{Modal as ee}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var te=[`neutral`,`danger`,`success`,`warning`],p=[`center`,`top`],m=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,h={sm:380,md:440,lg:640,xl:880},ne=`wui-modal-fullscreen`,g=!1;function _(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}e&&!g&&(g=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name: pass `ariaLabel` (or a string `title`)."))}function re(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(m));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function ie(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function ae(){return typeof document<`u`&&document.querySelector(`wui-drawer[open], .offcanvas.show`)!==null}function v(t){let{marker:g,props:v}=r(`AppModal`,t),{open:y,eyebrow:b,title:x,subtitle:S,headerIcon:C,tone:w=`neutral`,dismissible:oe=!0,onClose:T,onBack:E,backLabel:D=`Back`,headerActions:O,footer:k,size:A=`md`,placement:j=`center`,hideHeader:M=!1,staticBackdrop:N=!1,confirmDiscard:P,dirty:se=!1,ariaLabel:F,closeLabel:ce=`Close`,className:le=``,children:I,...L}=v;o(`AppModal`,L),a(`AppModal`,`tone`,w,te),a(`AppModal`,`placement`,j,p),a(`AppModal`,`size`,typeof A==`string`?A:null,[...Object.keys(h),`fullscreen`]);let{style:R,ref:z,"data-wui":B,"data-wui-props":V,...H}=L,U=B?{"data-wui":B,"data-wui-props":V}:g,W=U[`data-wui`],G=U[`data-wui-props`];M&&!F&&typeof x!=`string`&&_();let K=l(null),q=l(null),[J,Y]=u(!1);c(()=>{y||Y(!1)},[y]),c(()=>{J&&q.current?.focus()},[J]),c(()=>{if(y)return n()},[y]),c(()=>{let e=K.current?.closest(`.modal`);e&&(P?e.setAttribute(`confirm-discard`,P):e.removeAttribute(`confirm-discard`))},[y,P]);let X=l(null),ue=s(e=>{X.current=e,typeof z==`function`?z(e):z&&(z.current=e)},[z]);c(()=>{let e=X.current?.dialog;e&&(e.setAttribute(`data-wui`,W),G===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,G))},[y,W,G]),c(()=>{if(!y)return;let e=K.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(m));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`)&&!e.classList.contains(`wui-modal-back`))||t()[0]||e).focus?.();let n=e.closest(`.modal`),r=ie(),i=e=>re(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[y]);let Z=()=>{P&&se?Y(!0):T?.()},de=()=>{Y(!1),T?.()},fe=()=>{Y(!1),(K.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},Q=A===`fullscreen`,pe=typeof A==`number`?A:h[A]??h.md,me=[`wui-modal`,w===`neutral`?``:`tone-${w}`,le].filter(Boolean).join(` `),$=y&&ae(),he=[`wui-modal-shell`,Q&&ne,$&&`wui-modal-stacked`].filter(Boolean).join(` `);return/* @__PURE__ */ f(ee,{...H,ref:ue,show:y,onHide:Z,backdrop:!N||`static`,keyboard:!N,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:j!==`top`,className:he,style:Q?R:{"--wui-modal-max-width":`${pe}px`,...R},dialogClassName:`wui-rb-dialog`,contentClassName:me,backdropClassName:$?`wui-modal-dim wui-modal-backdrop-stacked`:`wui-modal-dim`,"aria-label":F||(typeof x==`string`?x:void 0),children:[!M&&/* @__PURE__ */ f(`div`,{className:`wui-modal-header`,children:[E&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-back`,onClick:E,"aria-label":D,children:/* @__PURE__ */ d(i,{name:`arrow-left`,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-heading`,children:[C&&/* @__PURE__ */ d(`span`,{className:`wui-modal-headicon`,children:/* @__PURE__ */ d(i,{name:C,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-headtext`,children:[b&&/* @__PURE__ */ d(`div`,{className:`wui-modal-eyebrow`,children:b}),/* @__PURE__ */ d(`div`,{className:`wui-modal-title`,children:x}),S&&/* @__PURE__ */ d(`div`,{className:`wui-modal-subtitle`,children:S})]})]}),O&&/* @__PURE__ */ d(`div`,{className:`wui-modal-header-actions`,children:O}),oe&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-close`,onClick:Z,"aria-label":ce,children:/* @__PURE__ */ d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),/* @__PURE__ */ d(`div`,{className:`wui-modal-body`,ref:K,children:I}),(k||J)&&/* @__PURE__ */ f(`div`,{className:J?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[J&&/* @__PURE__ */ d(e,{text:P,confirmRef:q,onDiscard:de,onKeep:fe}),k]})]})}export{v as default};
1
+ import e from"../lib/DiscardPrompt.js";import{devWarn as t}from"../lib/devWarn.js";import{lockPageScroll as n}from"../lib/pageScrollLock.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./warnInvalidValue.js";import o from"./warnUnknownProps.js";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{Modal as ee}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var te=[`neutral`,`danger`,`success`,`warning`],ne=[`center`,`top`],p=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,m={sm:380,md:440,lg:640,xl:880},re=`wui-modal-fullscreen`,h=!1;function ie(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}e&&!h&&(h=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name: pass `ariaLabel` (or a string `title`)."))}function g(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(p));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function ae(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function oe(){return typeof document<`u`&&document.querySelector(`wui-drawer[open], .offcanvas.show`)!==null}function _(t){let{marker:h,props:_}=r(`AppModal`,t),{open:v,eyebrow:y,title:b,subtitle:x,headerIcon:S,tone:C=`neutral`,dismissible:w=!0,onClose:T,onBack:E,backLabel:D=`Back`,headerActions:O,footer:k,size:A=`md`,placement:j=`center`,hideHeader:M=!1,staticBackdrop:N=!0,confirmDiscard:P,dirty:se=!1,ariaLabel:F,closeLabel:ce=`Close`,className:le=``,children:ue,...I}=_;o(`AppModal`,I),a(`AppModal`,`tone`,C,te),a(`AppModal`,`placement`,j,ne),a(`AppModal`,`size`,typeof A==`string`?A:null,[...Object.keys(m),`fullscreen`]);let{style:L,ref:R,"data-wui":z,"data-wui-props":B,...V}=I,H=z?{"data-wui":z,"data-wui-props":B}:h,U=H[`data-wui`],W=H[`data-wui-props`];M&&!F&&typeof b!=`string`&&ie();let G=l(null),K=l(null),[q,J]=u(!1);c(()=>{v||J(!1)},[v]),c(()=>{q&&K.current?.focus()},[q]),c(()=>{if(v)return n()},[v]),c(()=>{let e=G.current?.closest(`.modal`);e&&(P?e.setAttribute(`confirm-discard`,P):e.removeAttribute(`confirm-discard`))},[v,P]);let Y=l(null),de=s(e=>{Y.current=e,typeof R==`function`?R(e):R&&(R.current=e)},[R]);c(()=>{let e=Y.current?.dialog;e&&(e.setAttribute(`data-wui`,U),W===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,W))},[v,U,W]),c(()=>{if(!v)return;let e=G.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(p));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`)&&!e.classList.contains(`wui-modal-back`))||t()[0]||e).focus?.();let n=e.closest(`.modal`),r=ae(),i=e=>g(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[v]);let X=()=>{P&&se?J(!0):T?.()},Z=e=>{e.target.closest?.(`[data-wui-dismiss]`)&&X()},fe=()=>{J(!1),T?.()},pe=()=>{J(!1),(G.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},Q=A===`fullscreen`,me=typeof A==`number`?A:m[A]??m.md,he=[`wui-modal`,C===`neutral`?``:`tone-${C}`,le].filter(Boolean).join(` `),$=v&&oe(),ge=[`wui-modal-shell`,Q&&re,$&&`wui-modal-stacked`].filter(Boolean).join(` `);return/* @__PURE__ */ f(ee,{...V,ref:de,show:v,onHide:X,backdrop:!N||`static`,keyboard:!N,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:j!==`top`,className:ge,style:Q?L:{"--wui-modal-max-width":`${me}px`,...L},dialogClassName:`wui-rb-dialog`,contentClassName:he,backdropClassName:$?`wui-modal-dim wui-modal-backdrop-stacked`:`wui-modal-dim`,"aria-label":F||(typeof b==`string`?b:void 0),children:[!M&&/* @__PURE__ */ f(`div`,{className:`wui-modal-header`,children:[E&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-back`,onClick:E,"aria-label":D,children:/* @__PURE__ */ d(i,{name:`arrow-left`,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-heading`,children:[S&&/* @__PURE__ */ d(`span`,{className:`wui-modal-headicon`,children:/* @__PURE__ */ d(i,{name:S,size:18})}),/* @__PURE__ */ f(`div`,{className:`wui-modal-headtext`,children:[y&&/* @__PURE__ */ d(`div`,{className:`wui-modal-eyebrow`,children:y}),/* @__PURE__ */ d(`div`,{className:`wui-modal-title`,children:b}),x&&/* @__PURE__ */ d(`div`,{className:`wui-modal-subtitle`,children:x})]})]}),O&&/* @__PURE__ */ d(`div`,{className:`wui-modal-header-actions`,children:O}),w&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-modal-close`,onClick:X,"aria-label":ce,children:/* @__PURE__ */ d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),/* @__PURE__ */ d(`div`,{className:`wui-modal-body`,ref:G,onClick:Z,children:ue}),(k||q)&&/* @__PURE__ */ f(`div`,{className:q?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,onClick:Z,children:[q&&/* @__PURE__ */ d(e,{text:P,confirmRef:K,onDiscard:fe,onKeep:pe}),k]})]})}export{_ as default};
@@ -2,7 +2,7 @@
2
2
  "format": "webority-guidance/1",
3
3
  "package": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.141.0"
5
+ "version": "0.143.0"
6
6
  },
7
7
  "components": [
8
8
  {
@@ -2461,7 +2461,7 @@
2461
2461
  }
2462
2462
  ],
2463
2463
  "a11y": [
2464
- "The dialog is built on AppModal, so it traps focus, closes on Escape and restores focus.",
2464
+ "The dialog is built on AppModal, so it traps focus, closes on Escape only when staticBackdrop is false, and restores focus.",
2465
2465
  "The title is an h3 that takes focus when the dialog opens.",
2466
2466
  "A custom image is hidden from assistive technology with an empty alt, so the title and message carry the meaning.",
2467
2467
  "The confirm-phrase field is named \"Type <phrase> to confirm\", and Confirm stays disabled until the phrase matches.",
@@ -3041,7 +3041,7 @@
3041
3041
  "a11y": [
3042
3042
  "The panel has role dialog with aria-modal and is named by ariaLabel, else by the title.",
3043
3043
  "The sheet handle is a vertical slider labelled Sheet height, and the close button is labelled Close.",
3044
- "Focus moves in on open, Tab stays inside, Escape closes, and focus returns to what opened it."
3044
+ "Focus moves in on open, Tab stays inside, Escape leaves it open unless staticBackdrop is false, and focus returns to what opened it."
3045
3045
  ]
3046
3046
  }
3047
3047
  },
@@ -4666,7 +4666,7 @@
4666
4666
  {
4667
4667
  "component": "AppLink",
4668
4668
  "props": {
4669
- "href": "#best",
4669
+ "href": "#guidance",
4670
4670
  "rightIcon": "arrow-right"
4671
4671
  },
4672
4672
  "children": "See pricing"
@@ -4682,7 +4682,7 @@
4682
4682
  {
4683
4683
  "component": "AppLink",
4684
4684
  "props": {
4685
- "href": "#best",
4685
+ "href": "#guidance",
4686
4686
  "animation": "glow"
4687
4687
  },
4688
4688
  "children": "Click here"
@@ -4874,7 +4874,7 @@
4874
4874
  "do": [
4875
4875
  {
4876
4876
  "title": "One trigger, one dialog",
4877
- "note": "A clear trigger opens a single-purpose dialog; open/onClose stay controlled so Escape and the backdrop always work.",
4877
+ "note": "A clear trigger opens a single-purpose dialog; open and onClose stay controlled so the close control always works.",
4878
4878
  "example": [
4879
4879
  {
4880
4880
  "component": "AppButton",
@@ -4952,7 +4952,7 @@
4952
4952
  "a11y": [
4953
4953
  "Focus stays inside the dialog: Tab and Shift+Tab wrap between its first and last control.",
4954
4954
  "The page behind an open dialog is made inert, and the dialog is named by a plain-text title or by ariaLabel; a headerless dialog with neither warns in development.",
4955
- "Escape and a backdrop click close it, unless staticBackdrop is set."
4955
+ "Escape and an outside click leave it open by default; set staticBackdrop to false to let them close it."
4956
4956
  ]
4957
4957
  }
4958
4958
  },
@@ -18,7 +18,7 @@
18
18
  * @param {() => void} props.onConfirm Runs when Confirm is pressed.
19
19
  * @param {() => void} [props.onClose] Runs when the dialog is dismissed through Cancel, the backdrop or Escape, unless `loading` blocks it.
20
20
  * @param {boolean} [props.loading]
21
- * @param {boolean} [props.staticBackdrop]
21
+ * @param {boolean} [props.staticBackdrop] Defaults to true: Escape and an outside click leave the dialog open. Pass false to let them close it.
22
22
  * @param {'center'|'top'} [props.placement]
23
23
  * @param {'sm'|'md'|'lg'|'xl'|number} [props.size]
24
24
  * @param {string} [props.className]
@@ -69,8 +69,8 @@ export default function AppConfirmDialog(props: {
69
69
  */
70
70
  loading?: boolean;
71
71
  /**
72
- * Passed to AppModal: when true, a backdrop click and Escape no longer close the dialog.
73
- * @default false
72
+ * The dialog closes only through its own Cancel or Confirm by default. false lets Escape and an outside click close it.
73
+ * @default true
74
74
  */
75
75
  staticBackdrop?: boolean;
76
76
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Mount once near the root. A descendant calls `useConfirm()` and awaits the result:
3
3
  * `const confirm = useConfirm(); if (!(await confirm({ title: "Delete?", tone: "danger" }))) return;`
4
- * The promise resolves true on confirm, and false on Cancel, Escape, the backdrop or unmount.
4
+ * The promise resolves true on confirm, and false on Cancel or unmount; the dialog is static, so Escape and the backdrop leave it open.
5
5
  *
6
6
  * @param {{ children: import('react').ReactNode }} props
7
7
  */
@@ -31,7 +31,7 @@ import "@webority/ui-elements/elements/drawer";
31
31
  * @param {boolean} [props.dismissible] Default true. false hides the close button and also blocks Escape, backdrop and drag dismissal, so only the screen's own actions close it.
32
32
  * @param {string} [props.closeLabel] Default "Close".
33
33
  * @param {string} [props.sheetHeightLabel] Default "Sheet height".
34
- * @param {boolean} [props.staticBackdrop]
34
+ * @param {boolean} [props.staticBackdrop] Defaults to true: Escape and an outside click leave the drawer open. Pass false to let them close it.
35
35
  * @param {string} [props.confirmDiscard]
36
36
  * @param {boolean} [props.dirty]
37
37
  * @param {import('react').ReactNode} [props.footer]
@@ -106,8 +106,8 @@ export default function AppDrawer(props: {
106
106
  */
107
107
  sheetHeightLabel?: string;
108
108
  /**
109
- * The backdrop, Escape and a drag down no longer close it; only the close button or open can.
110
- * @default false
109
+ * The drawer closes only through its own Close or Cancel by default. false lets Escape and an outside click close it.
110
+ * @default true
111
111
  */
112
112
  staticBackdrop?: boolean;
113
113
  /** Ask before closing while dirty: this text, with Discard and Keep editing in the footer. */
@@ -10,7 +10,7 @@
10
10
  * lazily loaded viewer entry; the icon stays if the page cannot be drawn.
11
11
  *
12
12
  * @param {object} props
13
- * @param {string} [props.label]
13
+ * @param {string} [props.label] The visible label. Without it no label element is drawn, so the required mark, the optional text and the info-tip are not drawn either.
14
14
  * @param {File|{ url: string, name?: string }|Array<File|{ url: string, name?: string }>|null} [props.value]
15
15
  * @param {string} [props.name]
16
16
  * @param {string} [props.id]
@@ -35,7 +35,7 @@
35
35
  * @param {string} [props.helperText]
36
36
  * @param {boolean} [props.loading]
37
37
  * @param {boolean} [props.readOnly] Shows the value but blocks picking, dropping, changing and removing. The control takes aria-readonly.
38
- * @param {"sm"|"md"|"lg"} [props.size] The control height: sm, md or lg.
38
+ * @param {"sm"|"md"|"lg"} [props.size] The control height: sm, md or lg. The button form takes it too; an unset size keeps the small button.
39
39
  * @param {boolean} [props.disabled] Locks the picker and keeps it out of the form post.
40
40
  * @param {import('react').ReactNode} [props.help] The content of the info-tip beside the label.
41
41
  * @param {string} [props.helpLabel] The accessible name of the info-tip button.
@@ -145,7 +145,7 @@ export default function AppFilePicker(props: {
145
145
  */
146
146
  readOnly?: boolean;
147
147
  /**
148
- * The control height: sm, md or lg.
148
+ * The control height: sm, md or lg. The button form takes it too; an unset size keeps the small button.
149
149
  * @default "md"
150
150
  */
151
151
  size?: "sm" | "md" | "lg";
@@ -13,13 +13,13 @@
13
13
  * @param {() => void} [props.onBack] Shows a back arrow before the title and runs this when it is pressed.
14
14
  * @param {string} [props.backLabel] The back arrow's accessible name.
15
15
  * @param {import('react').ReactNode} [props.headerActions] Actions drawn beside the title, before the close button; not drawn while the header is hidden.
16
- * @param {import('react').ReactNode} [props.footer]
16
+ * @param {import('react').ReactNode} [props.footer] A footer control marked `data-wui-dismiss` (a Cancel button) closes the modal the way the close disc does: it asks first while `dirty` and `confirmDiscard` are set, then calls onClose. Give such a control no onClick of its own.
17
17
  * @param {'sm'|'md'|'lg'|'xl'|'fullscreen'|number} [props.size]
18
18
  * @param {'center'|'top'} [props.placement]
19
19
  * @param {boolean} [props.hideHeader]
20
20
  * @param {string} [props.ariaLabel]
21
21
  * @param {string} [props.closeLabel] Default "Close".
22
- * @param {boolean} [props.staticBackdrop]
22
+ * @param {boolean} [props.staticBackdrop] Defaults to true: Escape and an outside click leave the modal open. Pass false to let them close it.
23
23
  * @param {string} [props.confirmDiscard]
24
24
  * @param {boolean} [props.dirty]
25
25
  * @param {string} [props.className]
@@ -80,8 +80,8 @@ export default function AppModal(props: {
80
80
  */
81
81
  closeLabel?: string;
82
82
  /**
83
- * When true, a backdrop click and the Escape key no longer close the dialog.
84
- * @default false
83
+ * The pop-up closes only through its own Close or Cancel by default. false lets Escape and an outside click close it.
84
+ * @default true
85
85
  */
86
86
  staticBackdrop?: boolean;
87
87
  /** Asks before closing while dirty, with this text and Discard and Keep editing in the footer. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.141.0",
3
+ "version": "0.143.0",
4
4
  "description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -29,10 +29,10 @@
29
29
  },
30
30
  "sideEffects": false,
31
31
  "dependencies": {
32
- "@webority/markdown-core": "0.141.0",
33
- "@webority/theme": "0.141.0",
34
- "@webority/ui-elements": "0.141.0",
35
- "@webority/web-core": "0.141.0"
32
+ "@webority/markdown-core": "0.143.0",
33
+ "@webority/theme": "0.143.0",
34
+ "@webority/ui-elements": "0.143.0",
35
+ "@webority/web-core": "0.143.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@webority/analytics": "^0.35.0",
@@ -50,8 +50,8 @@
50
50
  "@vitejs/plugin-react": "^6.0.1",
51
51
  "@vitest/coverage-v8": "5.0.1",
52
52
  "@webority/analytics": "0.35.1",
53
- "@webority/canvas-kit": "0.141.0",
54
- "@webority/tokens": "0.141.0",
53
+ "@webority/canvas-kit": "0.143.0",
54
+ "@webority/tokens": "0.143.0",
55
55
  "bootstrap": "5.3.3",
56
56
  "jsdom": "30.1.1",
57
57
  "react": "^19.2.6",