@tempots/beatui 0.67.0 → 0.69.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 (30) hide show
  1. package/dist/auth/index.cjs.js +1 -1
  2. package/dist/auth/index.es.js +2 -2
  3. package/dist/{index-CWuw5oBV.cjs → index-B7lXSIXm.cjs} +4 -2
  4. package/dist/{index-BaNgZ2Pb.js → index-CzuXAuLZ.js} +575 -570
  5. package/dist/{index-CdyjO-u1.js → index-GLoRnI6r.js} +1 -1
  6. package/dist/{index-CmNppgrA.cjs → index-gSTSk9KZ.cjs} +1 -1
  7. package/dist/index.cjs.js +2 -2
  8. package/dist/index.es.js +122 -119
  9. package/dist/json-schema/index.cjs.js +4 -4
  10. package/dist/json-schema/index.es.js +2495 -2507
  11. package/dist/{modal-D9LzHK9g.js → modal-DJWj5M5e.js} +1 -1
  12. package/dist/{modal-BFmCVPI6.cjs → modal-D_paG9Sr.cjs} +1 -1
  13. package/dist/{notice-BuSRMaZb.cjs → notice-CgT9ma2m.cjs} +2 -2
  14. package/dist/{notice-CTONCH2t.js → notice-Um1LwKBF.js} +52 -55
  15. package/dist/prosemirror/index.cjs.js +1 -1
  16. package/dist/prosemirror/index.es.js +1 -1
  17. package/dist/types/components/form/controller/union-controller.d.ts +1 -1
  18. package/dist/types/components/form/use-form.d.ts +2 -2
  19. package/dist/types/components/json-schema/controls/generic-control.d.ts +2 -1
  20. package/dist/types/components/json-schema/controls/shared-utils.d.ts +17 -1
  21. package/dist/types/components/json-schema/index.d.ts +1 -0
  22. package/dist/types/components/json-schema/json-schema-form.d.ts +5 -2
  23. package/dist/types/components/json-schema/schema-context.d.ts +3 -0
  24. package/dist/types/components/json-schema/widgets/widget-customization.d.ts +55 -0
  25. package/dist/types/index.d.ts +1 -0
  26. package/dist/widget-customization-BcbRhAAR.cjs +1 -0
  27. package/dist/widget-customization-D6Y_Qm7o.js +2788 -0
  28. package/package.json +1 -1
  29. package/dist/utils-BbvrUmvw.js +0 -2554
  30. package/dist/utils-CIHYei1q.cjs +0 -1
@@ -1,6 +1,6 @@
1
1
  import { WithElement as S, OnDispose as z, prop as R, computedOf as w, Fragment as M, attr as g, WithBrowserCtx as J, Value as U, render as Q, html as k, dataAttr as B, aria as V, on as X, When as q, Use as H, coalesce as I } from "@tempots/dom";
2
2
  import { g as $, T as _ } from "./timer-DzWb416P.js";
3
- import { s as Y, C as Z } from "./notice-CTONCH2t.js";
3
+ import { s as Y, C as Z } from "./notice-Um1LwKBF.js";
4
4
  import { a as K, B as P } from "./translations-BUTBIDsS.js";
5
5
  const ee = [
6
6
  "a[href]",
@@ -1 +1 @@
1
- "use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./notice-BuSRMaZb.cjs"),O=require("./translations-hMQlZmD4.cjs"),_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function P(o){return Array.from(o.querySelectorAll(_)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(o={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:n,returnFocus:a,clickOutsideDeactivates:i=!1,onClickOutside:d}=o;return r.WithElement(p=>{let f=t,h=null,c=[];typeof document<"u"&&(h=document.activeElement);const v=()=>{c=P(p)},b=u=>{if(f){if(s&&u.key==="Escape"){u.preventDefault(),e?.();return}if(u.key==="Tab"){if(v(),c.length===0){u.preventDefault();return}const l=c.indexOf(document.activeElement);u.shiftKey?l<=0&&(u.preventDefault(),c[c.length-1]?.focus()):l>=c.length-1&&(u.preventDefault(),c[0]?.focus())}}},g=u=>{if(!f||!i)return;const l=u.target;p.contains(l)||d?.()},y=()=>{if(!f)return;v();let u=null;typeof n=="function"?u=n():n?u=n:c.length>0&&(u=c[0]),u&&setTimeout(()=>{u?.focus()},50),document.addEventListener("keydown",b,!0),i&&document.addEventListener("click",g,!0)},A=()=>{f=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",g,!0);let u=null;typeof a=="function"?u=a():a?u=a:h&&(u=h),u&&document.body.contains(u)&&setTimeout(()=>{u?.focus()},0)};return setTimeout(()=>y(),0),r.OnDispose(()=>{A()})})}function U(o={}){return{activate:()=>V({...o,active:!0}),deactivate:()=>V({...o,active:!1})}}function B({initialStatus:o="closed",openedAfter:t,closedAfter:s}){const e=r.prop(o),n=()=>{e.set("start-opening")},a=()=>{e.set("start-closing")},i=e.map(l=>l!=="closed"&&l!=="start-closing"&&l!=="closing"),d=l=>{l?n():a()},p=()=>{d(!i.value)},f=[],h=l=>{f.push(e.on(x=>{x==="closed"&&l()}))};let c=()=>{};e.on(l=>{switch(c(),l){case"start-opening":c=w.g(()=>e.set("opening"));break;case"opening":c=t(()=>e.set("opened"));break;case"start-closing":c=w.g(()=>e.set("closing"));break;case"closing":c=s(()=>e.set("closed"));break;case"closed":c=()=>{};break}}),e.onDispose(()=>{f.forEach(l=>l()),c()});const v=e.map(l=>l==="closed"),b=e.map(l=>l==="start-opening"),g=e.map(l=>l==="opening"),y=e.map(l=>l==="opened"),A=e.map(l=>l==="closing"),u=e.map(l=>l==="start-closing");return{status:e,open:n,close:a,toggle:p,setOpen:d,display:i,isClosed:v,isStartOpening:b,isOpening:g,isOpened:y,isClosing:A,isStartClosing:u,dispose:()=>e.dispose(),listenOnClosed:h}}function z({initialStatus:o="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return B({initialStatus:o,openedAfter:n=>w.T(n,s),closedAfter:n=>w.T(n,e)})}function M(o,t){let s=!1,e=null;function n(){s||(s=!0,o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i),e&&(clearTimeout(e),e=null),t())}function a(f){f.target===o&&n()}function i(f){f.target===o&&n()}const d=()=>{if(typeof o.getAnimations>"u"){e=setTimeout(n,16);return}o.addEventListener("transitionend",a),o.addEventListener("animationend",i),o.getAnimations().length===0&&(e=setTimeout(n,1e3))},p=w.g(d);return()=>{s=!0,p(),e&&(clearTimeout(e),e=null),o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i)}}function F({initialStatus:o="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...B({initialStatus:o,openedAfter:e=>s==null?(e(),()=>{}):M(s,e),closedAfter:e=>s==null?(e(),()=>{}):M(s,e)})}}function R(o){if(o==null)return"";const t=[];return o.fade&&t.push("fade"),o.slide&&t.push(`slide-${o.slide}`),o.scale!=null&&t.push("scale"),t.length>0?t.join(" "):"none"}function H(o){if(o==null)return"";const t=[];return o.scale!=null&&typeof o.scale=="number"&&t.push(`--scale-factor: ${o.scale}`),o.transformOrigin!=null&&t.push(`--transform-origin: ${o.transformOrigin}`),o.duration!=null&&t.push(`--animation-duration: ${o.duration}ms`),o.easing!=null&&t.push(`--animation-easing: ${o.easing}`),t.join("; ")}function D({animation:o,status:t}){const s=r.computedOf(o,t)((n,a)=>{if(n==null)return`bc-animated-toggle bc-animated-toggle--${a}`;const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,`bc-animated-toggle bc-animated-toggle--${R(d)} bc-animated-toggle--${a}`}),e=r.computedOf(o,t)((n,a)=>{if(n==null)return"";const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,H(d)});return r.Fragment(r.attr.class(s),r.attr.style(e))}function K({initialStatus:o="closed",animation:t},s){return r.WithElement(e=>{const{setElement:n,dispose:a,...i}=F({initialStatus:o,element:e});return n(e),r.Fragment(D({status:i.status,animation:t}),r.OnDispose(a),s(i))})}function j(o){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=o.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(n=>({message:n.message,path:n.path}))}},types:void 0},safeParse:s=>{const e=o.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(n=>({message:n.message,path:n.path?.map(a=>typeof a=="object"&&"key"in a?a.key.toString():a.toString())||[]}))}}}}}class k{optional(){return new N(this)}default(t){return new G(this,t)}schema(){return j(this)}}class T extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const n=e(t);n&&s.push({message:n})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new T;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length<t?s:null),e}max(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length>t?s:null),e}regex(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>t.test(n)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,n=>s.test(n)?null:t],e}refine(t){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class C extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new C;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const n=e.validate.bind(e);return e.validate=a=>{const i=n(a);return i.success?t(i.data)?i:{success:!1,errors:[{message:s}]}:i},e}literal(t,s){const e=new C;return e.mustBeTrue=!0,e.trueMessage=s,e}}class N extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class G extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class $ extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},n=[];for(const[a,i]of Object.entries(this.shape)){const d=i.validate(s[a]);if(d.success)e[a]=d.data;else for(const p of d.errors)n.push({message:p.message,path:[a,...p.path||[]]})}return n.length>0?{success:!1,errors:n}:{success:!0,data:e}}refine(t,s){const e=new $(this.shape),n=e.validate.bind(e);return e.validate=a=>{const i=n(a);if(!i.success)return i;const d=t(i.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:i.data}},e}}const J=()=>new T,Q=()=>new C,X=o=>new $(o);function I(o){return r.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(a=>a());return o(({effect:a="opaque",mode:i="capturing",onClickOutside:d,onEscape:p,content:f,container:h="body"})=>{h==="body"&&(t=t.makePortal("body"));const c=F();c.listenOnClosed(e);let v=()=>{},b=()=>{};const g=E=>{E.key==="Escape"&&(p?.(),c.close())},y=()=>{d?.(),c.close()},A=E=>{v(),b(),E==="capturing"?(document.addEventListener("keydown",g),v=()=>document.removeEventListener("keydown",g),t.element.addEventListener("mousedown",y),b=()=>t.element.removeEventListener("mousedown",y)):(v=()=>{},b=()=>{})},u=r.Value.on(i,A);s.push(u),s.push(()=>{c.dispose(),v(),b()});const l=()=>{const E=new Set;for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))m.hasAttribute("inert")?E.add(m):m.setAttribute("inert","");return s.push(()=>{for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(m)||m.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),r.html.div(r.WithElement(m=>c.setElement(m)),r.dataAttr.status(c.status.map(String)),r.dataAttr.overlay("true"),r.attr.class(r.computedOf(a??"opaque",i)((m,L)=>`bc-overlay bc-overlay--effect-${m} bc-overlay--mode-${L}`)),f)},x=r.render(l(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(x),w.g(()=>c.open())},e)})}function W(o,t){const{size:s="md",dismissable:e=!0,showCloseButton:n=!0,onClose:a,overlayEffect:i="opaque",container:d="body",position:p="center"}=o;return I((f,h)=>{let c=()=>{};return t(g=>{c=h;const y=r.prop("capturing");r.Value.on(e,m=>{y.set(m?"capturing":"non-capturing")});const A=r.computedOf(g.header!=null,n)((m,L)=>m||L),u=q.sessionId("modal"),l=`${u}-header`,x=`${u}-body`,E=r.html.div(r.attr.class(r.computedOf(s,p)((m,L)=>`bc-modal bc-modal--size-${m} bc-modal--container-${d} bc-modal--position-${L}`)),r.attr.role("dialog"),r.aria.modal(!0),...g.header?[r.aria.labelledby(l)]:[],r.aria.describedby(x),r.attr.tabindex(-1),r.attr.id(u),r.dataAttr.focusTrap("true"),r.on.mousedown(m=>m.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const m=document.getElementById(u);if(!m)return null;const L=m.querySelector('[aria-label="Close modal"]');if(L)return L;const S=m.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||m}}),r.html.div(r.attr.class("bc-modal__content"),r.When(A,()=>r.html.div(r.attr.class("bc-modal__header"),r.html.div(r.attr.class("bc-modal__title"),...g.header?[r.attr.id(l)]:[],g.header),r.When(n,()=>r.Use(O.BeatUII18n,m=>q.CloseButton({size:"sm",label:m.$.closeModal,onClick:()=>{c(),h()}}))))),r.html.div(r.attr.class("bc-modal__body"),r.attr.id(x),g.body),g.footer&&r.html.div(r.attr.class("bc-modal__footer"),g.footer)));f({mode:y,effect:i??"opaque",container:d,content:E,onClickOutside:()=>{a?.(),h()},onEscape:()=>{a?.(),h()}})},()=>{c(),h()})})}function Y(o,t){const{confirmText:s,cancelText:e,onConfirm:n,onCancel:a,...i}=o;return r.Use(O.BeatUII18n,d=>W({showCloseButton:!1,...i},(p,f)=>{const h=()=>{n?.(),f()},c=()=>{a?.(),f()};return t(b=>{p({body:b,footer:r.Fragment(r.attr.class("bc-modal__actions"),O.Button({variant:"outline",onClick:c},r.coalesce(e,d.$.cancel)),O.Button({color:"primary",variant:"filled",onClick:h},r.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggle=K;exports.AnimatedToggleClass=D;exports.BooleanValidator=C;exports.ConfirmModal=Y;exports.FocusTrap=V;exports.Modal=W;exports.ObjectValidator=$;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=j;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=B;exports.useFocusTrap=U;exports.useTimedToggle=z;
1
+ "use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./notice-CgT9ma2m.cjs"),O=require("./translations-hMQlZmD4.cjs"),_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function P(o){return Array.from(o.querySelectorAll(_)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(o={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:n,returnFocus:a,clickOutsideDeactivates:i=!1,onClickOutside:d}=o;return r.WithElement(p=>{let f=t,h=null,c=[];typeof document<"u"&&(h=document.activeElement);const v=()=>{c=P(p)},b=u=>{if(f){if(s&&u.key==="Escape"){u.preventDefault(),e?.();return}if(u.key==="Tab"){if(v(),c.length===0){u.preventDefault();return}const l=c.indexOf(document.activeElement);u.shiftKey?l<=0&&(u.preventDefault(),c[c.length-1]?.focus()):l>=c.length-1&&(u.preventDefault(),c[0]?.focus())}}},g=u=>{if(!f||!i)return;const l=u.target;p.contains(l)||d?.()},y=()=>{if(!f)return;v();let u=null;typeof n=="function"?u=n():n?u=n:c.length>0&&(u=c[0]),u&&setTimeout(()=>{u?.focus()},50),document.addEventListener("keydown",b,!0),i&&document.addEventListener("click",g,!0)},A=()=>{f=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",g,!0);let u=null;typeof a=="function"?u=a():a?u=a:h&&(u=h),u&&document.body.contains(u)&&setTimeout(()=>{u?.focus()},0)};return setTimeout(()=>y(),0),r.OnDispose(()=>{A()})})}function U(o={}){return{activate:()=>V({...o,active:!0}),deactivate:()=>V({...o,active:!1})}}function B({initialStatus:o="closed",openedAfter:t,closedAfter:s}){const e=r.prop(o),n=()=>{e.set("start-opening")},a=()=>{e.set("start-closing")},i=e.map(l=>l!=="closed"&&l!=="start-closing"&&l!=="closing"),d=l=>{l?n():a()},p=()=>{d(!i.value)},f=[],h=l=>{f.push(e.on(x=>{x==="closed"&&l()}))};let c=()=>{};e.on(l=>{switch(c(),l){case"start-opening":c=w.g(()=>e.set("opening"));break;case"opening":c=t(()=>e.set("opened"));break;case"start-closing":c=w.g(()=>e.set("closing"));break;case"closing":c=s(()=>e.set("closed"));break;case"closed":c=()=>{};break}}),e.onDispose(()=>{f.forEach(l=>l()),c()});const v=e.map(l=>l==="closed"),b=e.map(l=>l==="start-opening"),g=e.map(l=>l==="opening"),y=e.map(l=>l==="opened"),A=e.map(l=>l==="closing"),u=e.map(l=>l==="start-closing");return{status:e,open:n,close:a,toggle:p,setOpen:d,display:i,isClosed:v,isStartOpening:b,isOpening:g,isOpened:y,isClosing:A,isStartClosing:u,dispose:()=>e.dispose(),listenOnClosed:h}}function z({initialStatus:o="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return B({initialStatus:o,openedAfter:n=>w.T(n,s),closedAfter:n=>w.T(n,e)})}function M(o,t){let s=!1,e=null;function n(){s||(s=!0,o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i),e&&(clearTimeout(e),e=null),t())}function a(f){f.target===o&&n()}function i(f){f.target===o&&n()}const d=()=>{if(typeof o.getAnimations>"u"){e=setTimeout(n,16);return}o.addEventListener("transitionend",a),o.addEventListener("animationend",i),o.getAnimations().length===0&&(e=setTimeout(n,1e3))},p=w.g(d);return()=>{s=!0,p(),e&&(clearTimeout(e),e=null),o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i)}}function F({initialStatus:o="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...B({initialStatus:o,openedAfter:e=>s==null?(e(),()=>{}):M(s,e),closedAfter:e=>s==null?(e(),()=>{}):M(s,e)})}}function R(o){if(o==null)return"";const t=[];return o.fade&&t.push("fade"),o.slide&&t.push(`slide-${o.slide}`),o.scale!=null&&t.push("scale"),t.length>0?t.join(" "):"none"}function H(o){if(o==null)return"";const t=[];return o.scale!=null&&typeof o.scale=="number"&&t.push(`--scale-factor: ${o.scale}`),o.transformOrigin!=null&&t.push(`--transform-origin: ${o.transformOrigin}`),o.duration!=null&&t.push(`--animation-duration: ${o.duration}ms`),o.easing!=null&&t.push(`--animation-easing: ${o.easing}`),t.join("; ")}function D({animation:o,status:t}){const s=r.computedOf(o,t)((n,a)=>{if(n==null)return`bc-animated-toggle bc-animated-toggle--${a}`;const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,`bc-animated-toggle bc-animated-toggle--${R(d)} bc-animated-toggle--${a}`}),e=r.computedOf(o,t)((n,a)=>{if(n==null)return"";const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,H(d)});return r.Fragment(r.attr.class(s),r.attr.style(e))}function K({initialStatus:o="closed",animation:t},s){return r.WithElement(e=>{const{setElement:n,dispose:a,...i}=F({initialStatus:o,element:e});return n(e),r.Fragment(D({status:i.status,animation:t}),r.OnDispose(a),s(i))})}function j(o){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=o.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(n=>({message:n.message,path:n.path}))}},types:void 0},safeParse:s=>{const e=o.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(n=>({message:n.message,path:n.path?.map(a=>typeof a=="object"&&"key"in a?a.key.toString():a.toString())||[]}))}}}}}class k{optional(){return new N(this)}default(t){return new G(this,t)}schema(){return j(this)}}class T extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const n=e(t);n&&s.push({message:n})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new T;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length<t?s:null),e}max(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length>t?s:null),e}regex(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>t.test(n)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,n=>s.test(n)?null:t],e}refine(t){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class C extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new C;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const n=e.validate.bind(e);return e.validate=a=>{const i=n(a);return i.success?t(i.data)?i:{success:!1,errors:[{message:s}]}:i},e}literal(t,s){const e=new C;return e.mustBeTrue=!0,e.trueMessage=s,e}}class N extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class G extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class $ extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},n=[];for(const[a,i]of Object.entries(this.shape)){const d=i.validate(s[a]);if(d.success)e[a]=d.data;else for(const p of d.errors)n.push({message:p.message,path:[a,...p.path||[]]})}return n.length>0?{success:!1,errors:n}:{success:!0,data:e}}refine(t,s){const e=new $(this.shape),n=e.validate.bind(e);return e.validate=a=>{const i=n(a);if(!i.success)return i;const d=t(i.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:i.data}},e}}const J=()=>new T,Q=()=>new C,X=o=>new $(o);function I(o){return r.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(a=>a());return o(({effect:a="opaque",mode:i="capturing",onClickOutside:d,onEscape:p,content:f,container:h="body"})=>{h==="body"&&(t=t.makePortal("body"));const c=F();c.listenOnClosed(e);let v=()=>{},b=()=>{};const g=E=>{E.key==="Escape"&&(p?.(),c.close())},y=()=>{d?.(),c.close()},A=E=>{v(),b(),E==="capturing"?(document.addEventListener("keydown",g),v=()=>document.removeEventListener("keydown",g),t.element.addEventListener("mousedown",y),b=()=>t.element.removeEventListener("mousedown",y)):(v=()=>{},b=()=>{})},u=r.Value.on(i,A);s.push(u),s.push(()=>{c.dispose(),v(),b()});const l=()=>{const E=new Set;for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))m.hasAttribute("inert")?E.add(m):m.setAttribute("inert","");return s.push(()=>{for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(m)||m.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),r.html.div(r.WithElement(m=>c.setElement(m)),r.dataAttr.status(c.status.map(String)),r.dataAttr.overlay("true"),r.attr.class(r.computedOf(a??"opaque",i)((m,L)=>`bc-overlay bc-overlay--effect-${m} bc-overlay--mode-${L}`)),f)},x=r.render(l(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(x),w.g(()=>c.open())},e)})}function W(o,t){const{size:s="md",dismissable:e=!0,showCloseButton:n=!0,onClose:a,overlayEffect:i="opaque",container:d="body",position:p="center"}=o;return I((f,h)=>{let c=()=>{};return t(g=>{c=h;const y=r.prop("capturing");r.Value.on(e,m=>{y.set(m?"capturing":"non-capturing")});const A=r.computedOf(g.header!=null,n)((m,L)=>m||L),u=q.sessionId("modal"),l=`${u}-header`,x=`${u}-body`,E=r.html.div(r.attr.class(r.computedOf(s,p)((m,L)=>`bc-modal bc-modal--size-${m} bc-modal--container-${d} bc-modal--position-${L}`)),r.attr.role("dialog"),r.aria.modal(!0),...g.header?[r.aria.labelledby(l)]:[],r.aria.describedby(x),r.attr.tabindex(-1),r.attr.id(u),r.dataAttr.focusTrap("true"),r.on.mousedown(m=>m.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const m=document.getElementById(u);if(!m)return null;const L=m.querySelector('[aria-label="Close modal"]');if(L)return L;const S=m.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||m}}),r.html.div(r.attr.class("bc-modal__content"),r.When(A,()=>r.html.div(r.attr.class("bc-modal__header"),r.html.div(r.attr.class("bc-modal__title"),...g.header?[r.attr.id(l)]:[],g.header),r.When(n,()=>r.Use(O.BeatUII18n,m=>q.CloseButton({size:"sm",label:m.$.closeModal,onClick:()=>{c(),h()}}))))),r.html.div(r.attr.class("bc-modal__body"),r.attr.id(x),g.body),g.footer&&r.html.div(r.attr.class("bc-modal__footer"),g.footer)));f({mode:y,effect:i??"opaque",container:d,content:E,onClickOutside:()=>{a?.(),h()},onEscape:()=>{a?.(),h()}})},()=>{c(),h()})})}function Y(o,t){const{confirmText:s,cancelText:e,onConfirm:n,onCancel:a,...i}=o;return r.Use(O.BeatUII18n,d=>W({showCloseButton:!1,...i},(p,f)=>{const h=()=>{n?.(),f()},c=()=>{a?.(),f()};return t(b=>{p({body:b,footer:r.Fragment(r.attr.class("bc-modal__actions"),O.Button({variant:"outline",onClick:c},r.coalesce(e,d.$.cancel)),O.Button({color:"primary",variant:"filled",onClick:h},r.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggle=K;exports.AnimatedToggleClass=D;exports.BooleanValidator=C;exports.ConfirmModal=Y;exports.FocusTrap=V;exports.Modal=W;exports.ObjectValidator=$;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=j;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=B;exports.useFocusTrap=U;exports.useTimedToggle=z;
@@ -1,2 +1,2 @@
1
- "use strict";const s=require("@tempots/dom"),v=require("./translations-hMQlZmD4.cjs"),L=new Map;function D(e){const t=L.get(e)??0;return L.set(e,t+1),`${e}-${t}`}const y={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return y.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return y.isSuccess(e)?e.value:t()},getOrNull(e){return y.isSuccess(e)?e.value:null},getOrUndefined(e){return y.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(y.isSuccess(e))return e.value;throw y.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:r,notAsked:a=r})=>y.isSuccess(e)?t(e.value):y.isFailure(e)?n(e.error):y.isNotAsked(e)?a():r(e.previousValue),whenSuccess:(e,t)=>(y.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(y.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(y.isSuccess(n))t.push(n.value);else return n;return y.success(t)},ofPromise:async e=>{try{const t=await e;return y.success(t)}catch(t){return y.failure(t instanceof Error?t:new Error(String(t)))}}},O=(e,t)=>e===t||e!==e&&t!==t,k={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>k.isValid(e)?t():n(e.error),toResult:(e,t)=>k.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(k.isValid(e)&&t(),e),whenInvalid:(e,t)=>(k.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>y.success(t),t=>y.failure(t))},toValidation(e){return f.match(e,()=>k.valid,t=>k.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,r)=>f.match(e,a=>f.match(t,i=>f.success(n(a,i)),i=>f.failure(i)),a=>f.match(t,i=>f.failure(a),i=>f.failure(r(a,i)))),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function N({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:r="full",color:a="base",onClick:i,label:o},...l){return s.Use(v.BeatUII18n,c=>{const p=s.coalesce(o,c.$.closeModal);return v.Button({variant:"text",size:e,roundedness:r,disabled:n,color:a,onClick:i},s.attr.title(p),s.aria.label(p),...l,v.Icon({icon:t,size:e??"sm"}))})}function F(e){return`bc-label bc-label--${e}`}const ee=(...e)=>s.html.span(s.attr.class(F("emphasis")),...e),j=(...e)=>s.html.span(s.attr.class(F("default")),...e),q=(...e)=>s.html.span(s.attr.class(F("muted")),...e),te=(...e)=>s.html.span(s.attr.class(F("danger")),...e),se=e=>{const{value:t,onBlur:n,onChange:r,placeholder:a,disabled:i,id:o,checkedIcon:l,uncheckedIcon:c,iconSize:p="lg"}=e,h=o??D("checkbox"),m=`${h}-label`,w=()=>{if(s.Value.get(i??!1))return;const u=s.Value.get(t);r?.(!u)},b=u=>{s.Value.get(i??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),w())};return v.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(h),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,u=>u?-1:0)),s.aria.checked(t),s.aria.disabled(i),a!=null?s.aria.labelledby(m):s.Empty,s.on.keydown(b),n!=null?s.on.blur(n):s.Empty,v.Icon({icon:s.computedOf(t,l,c)((u,d,g)=>u?d??"akar-icons/check-box-fill":g??"akar-icons/box"),accessibility:"decorative",size:p})),a!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(m),s.attr.for(h),q(a)):s.Empty)},s.on.click(w))},U=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function ne(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function re(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function ae(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const P=({fullWidth:e=!1,required:t,label:n,labelChildren:r,context:a,description:i,content:o,error:l,labelFor:c,hasError:p,disabled:h,layout:m,labelWidth:w},...b)=>{const u=p??l!=null,d=h??!1,g=m??"vertical",I=D("input-wrapper"),C=i?`${I}-description`:void 0,_=l!=null?`${I}-error`:void 0,A=s.computedOf(g)(S=>S!=="vertical"),Z=s.computedOf(g,w??void 0)((S,V)=>ae(S,V));return s.html.div(s.attr.class(s.Value.map(g,S=>ne(S))),s.attr.class(s.Value.map(e,S=>S?"bc-input-wrapper--full-width":"")),s.attr.style(Z),n!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),c!=null?s.attr.for(c):s.Empty,s.html.span(s.attr.class(s.computedOf(u,d)((S,V)=>re(S??!1,V??!1))),n),n!=null&&t?U:s.Empty),s.When(s.computedOf(A,i)((S,V)=>S&&V!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),i))),a!=null?j(a):s.Empty,r):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,_].filter(Boolean).length>0?s.dataAttr.describedby([C,_].filter(Boolean).join(" ")):s.Empty,t?s.dataAttr.required("true"):s.Empty,s.When(u,()=>s.dataAttr.invalid("true")),o),s.When(s.computedOf(A,i)((S,V)=>!S&&V!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),i)),s.When(u,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(_),s.aria.live("polite"),s.attr.role("alert"),l)),...b)};function ie(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const le=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:r,onBlur:a,onChange:i,onInput:o,placeholder:l}=t,c=r??v.InputIcon({icon:"line-md:email",size:e.size,color:"neutral"});return s.Use(v.BeatUII18n,p=>v.InputContainer({...e,before:c,input:s.input.email(v.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(l,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),a!=null?s.on.blur(s.emitValue(a)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,o!=null?s.on.input(s.emitValue(o)):s.Empty)}))},oe=e=>{const{value:t,onBlur:n,onChange:r,onInput:a,before:i,after:o,hasError:l,disabled:c,autocomplete:p,placeholder:h,...m}=e,w={name:"password",disabled:c,...m},b=s.prop(!0),u=s.computedOf(b,p)((d,g)=>d?g??"current-password":"off");return s.Use(v.BeatUII18n,d=>{const g=s.computedOf(d.$.passwordPlaceholderText,b,h)((C,_,A)=>_?"•••••••••••••••":A??C),I=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>b.update(C=>!C)),s.When(b,()=>v.Icon({icon:"line-md:watch"}),()=>v.Icon({icon:"line-md:watch-off"})));return v.InputContainer({before:i,disabled:c,hasError:l,input:s.html.input(v.CommonInputAttributes({...w,autocomplete:u,placeholder:g}),s.When(b,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,r!=null?s.on.change(s.emitValue(r)):s.Empty,a!=null?s.on.input(s.emitValue(a)):s.Empty),after:o!=null?s.Fragment(I,o):I})})},W=(e,t)=>()=>{e.markTouched(),t?.()},M=(e,t)=>n=>{e.change(n),t?.(n)};function $(e,t){const{controller:n,onBlur:r,onChange:a,id:i,triggerOn:o,...l}=t;return e({id:i??n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,name:n.name,...l,onInput:o==="input"?M(n,a):void 0,onChange:o!=="input"?M(n,a):void 0,onBlur:W(n,r)})}function ce(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control"),o=n??i;return P({...r,hasError:r.controller.errorVisible,error:s.TextNode(r.controller.error.map(l=>l??"")),labelFor:o,content:$(l=>e({...l,id:i}),r)},...a)}function z(e,t){const{toInput:n,fromInput:r,controller:a,...i}=t,o=a.transform(n,r);return $(e,{...i,controller:o})}function ue(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control");return P({...r,labelFor:n??i,content:z(e,{...r,id:i})},...a)}function he(e){return e.split(".").map(n=>{const r=n.match(/^\[(\d+)\]$/);return r?Number(r[1]):n})}function H(e){return typeof e=="number"?`[${e}]`:`.${e}`}function R(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(H)].join("")}function T(e){return function(n){if(n.type==="valid")return n;let r=n.error;for(const a of e)if(r=r?.dependencies?.[a],r==null)return k.valid;return k.invalid(r)}}class E{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,r,a,i,o=O){this.path=t,this.change=n,this.signal=r,this.status=a,this.#s=o,this.#t.set(r.value),this.error=a.map(l=>l?.type==="invalid"?l.error?.message:void 0),this.hasError=this.error.map(l=>l!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((l,c,p)=>p==="continuous"?!!l:!!l&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((l,c)=>!!l&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((l,c)=>!this.#s(l,c)),this.dependencyErrors=a.map(l=>l?.type==="invalid"?l.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((l,c)=>l||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((l,c)=>l||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return R(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=O)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=O)=>new K(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,r=[],a=O)=>new E([...this.path,...r],i=>this.change(n(i)),this.signal.map(t,a),this.status.map(T(r)),this.parent,a);asyncTransform=(t,n,r,a=[],i=O)=>new E([...this.path,...a],o=>{n(o).then(l=>this.change(l))},this.signal.mapAsync(t,r,void 0,i),this.status.map(T(a)),this.parent,i)}class K extends E{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){super(t,n,r.map(c=>c??{},o),a,i,o),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const l=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),l()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async o=>{this.change({...this.signal.value,[t]:o})},r=new E([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,r);const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class G extends E{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){const l=r.map(h=>h??[],o);super(t,n,l,a,i,o);const c=l.on(h=>{const m=this.#e.length-h.length;m>0&&(this.#e.splice(h.length,m).forEach((w,b)=>{const u=h.length+b;w.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#r.get(u)?.(),this.#r.delete(u),this.#a.delete(u)}),this.#o(),this.#i())});this.length=l.map(h=>h.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const p=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),l.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#r.values())h();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),p()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async o=>{const l=this.signal.value.slice();l[t]=o,this.change(l)},r=new E([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=r;const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const r=this.signal.value.slice();r.splice(t,n),this.change(r)};move=(t,n,r=1)=>{if(r<1||t===n)return;const a=this.signal.value.slice(),i=a.splice(t,r);a.splice(n,0,...i),this.change(a)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function J(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function Q(e){const t=e.filter(a=>a.path==null||a.path.length===0).map(a=>a.message),n=e.filter(a=>a.path!=null&&a.path.length>0).reduce((a,i)=>{const o=J(i.path),l=o.pop();let c=a;for(const p of o)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[l]={message:i.message},a},{}),r=t.join(`
2
- `);return{...n,message:r!=""?r:void 0}}function X({initialValue:e,onChange:t,validate:n,equals:r,validationMode:a,validateDebounceMs:i}){const o=s.Value.deriveProp(e),l=s.prop(k.valid),c=s.prop(!1),p=s.prop(a??"touchedOrSubmit"),h=d=>{l.set(d)};let m;const w=async d=>{if(n!=null){const g=await n(d);h(g)}},b=async d=>{o.set(d),t?.(d);const g=p.value;if(n!=null){if(g==="onSubmit")return;const I=i??0;I>0?(m&&clearTimeout(m),m=setTimeout(()=>{w(d)},I)):await w(d)}},u=new E([],b,o,l,{disabled:c,validationMode:p},r??O);return u.onDispose(()=>{c.dispose(),o.dispose(),l.dispose(),p.dispose(),m&&clearTimeout(m)}),{controller:u,setStatus:h}}function x(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function de(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function pe(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function B(e){return e.issues!=null?k.invalid(Q(e.issues)):k.valid}async function me({task:e,errorMessage:t,errorPath:n=["root"],validation:r}){try{const a=await e();return r!=null?r(a):k.valid}catch(a){const i=t??(a instanceof Error?a.message:"Operation failed");return n.length===1&&n[0]==="root"?k.invalid({message:i}):k.invalid({dependencies:Y(n,i)})}}function Y(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...r]=e;return{[n]:{dependencies:Y(r,t)}}}function fe({initialValue:e={},schema:t,onSubmit:n=async()=>k.valid,validationMode:r,validateDebounceMs:a}){const{controller:i,setStatus:o}=X({initialValue:e,validationMode:r??"touchedOrSubmit",validateDebounceMs:a,validate:(r??"touchedOrSubmit")==="onSubmit"||t==null?void 0:async h=>B(await t["~standard"].validate(h))}),l=s.prop(!1),c=i.object();return c.onDispose(l.dispose),{controller:c,setStatus:o,submit:async h=>{if(l.set(!0),h?.preventDefault(),c.markAllTouched(),(r??"touchedOrSubmit")==="onSubmit"){const w=c.signal.value,b=t?.["~standard"].validate;if(b==null){l.set(!1);return}const u=B(await b(w));if(o(u),u.type==="invalid"){l.set(!1);return}}const m=await n(c.signal.value);l.set(!1),m.type==="invalid"&&o(m)},submitting:l}}function be(e){switch(e){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function ge(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function ye(e,t,n,r){const a=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&a.push("bc-notice--dismissible"),r&&r.length>0&&a.push(r),a.join(" ")}function ve({variant:e="info",tone:t="subtle",role:n,title:r,icon:a,closable:i=!1,onDismiss:o,class:l},...c){const p=s.prop(!0);return s.When(p,()=>{const h=s.Value.map(i,u=>!!u||o!=null),m=s.Value.map(e,u=>u??"info"),w=s.Value.map(t,u=>u??"subtle"),b=s.computedOf(n,m)((u,d)=>u??(d==="danger"?"alert":"status"));return s.Use(v.BeatUII18n,u=>s.html.div(s.attr.class(s.computedOf(m,w,h,l)((d,g,I,C)=>ye(d,g,I,C))),s.attr.role(s.Value.map(b,d=>d)),s.Unless(s.Value.map(a,d=>d===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),v.Icon({icon:s.computedOf(a,m)((d,g)=>d===void 0?be(g):String(d)),size:"md",color:s.Value.map(m,ge)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(r,d=>s.html.div(s.attr.class("bc-notice__title"),d)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(h,()=>N({size:"xs",label:u.$.closeModal,onClick:()=>{p.set(!1),o?.()}}))))})}exports.ArrayController=G;exports.BaseControl=$;exports.BaseMappedControl=z;exports.CheckboxInput=se;exports.CloseButton=N;exports.Control=ce;exports.Controller=E;exports.DangerLabel=te;exports.EmailInput=le;exports.EmphasisLabel=ee;exports.InputWrapper=P;exports.Label=j;exports.MappedControl=ue;exports.MutedLabel=q;exports.Notice=ve;exports.O=O;exports.ObjectController=K;exports.PasswordInput=oe;exports.RequiredSymbol=U;exports.Stack=ie;exports.a=k;exports.connectCommonAttributes=x;exports.connectNumberInput=pe;exports.connectStringInput=de;exports.convertStandardSchemaIssues=Q;exports.convertStandardSchemaPathToPath=J;exports.makeMapValidation=T;exports.makeOnBlurHandler=W;exports.makeOnChangeHandler=M;exports.parsePath=he;exports.pathToString=R;exports.sessionId=D;exports.standardSchemaResultToValidation=B;exports.taskToValidation=me;exports.useController=X;exports.useForm=fe;exports.wrapSegment=H;
1
+ "use strict";const s=require("@tempots/dom"),v=require("./translations-hMQlZmD4.cjs"),L=new Map;function D(e){const t=L.get(e)??0;return L.set(e,t+1),`${e}-${t}`}const y={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return y.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return y.isSuccess(e)?e.value:t()},getOrNull(e){return y.isSuccess(e)?e.value:null},getOrUndefined(e){return y.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(y.isSuccess(e))return e.value;throw y.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:r,notAsked:a=r})=>y.isSuccess(e)?t(e.value):y.isFailure(e)?n(e.error):y.isNotAsked(e)?a():r(e.previousValue),whenSuccess:(e,t)=>(y.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(y.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(y.isSuccess(n))t.push(n.value);else return n;return y.success(t)},ofPromise:async e=>{try{const t=await e;return y.success(t)}catch(t){return y.failure(t instanceof Error?t:new Error(String(t)))}}},T=(e,t)=>e===t||e!==e&&t!==t,k={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>k.isValid(e)?t():n(e.error),toResult:(e,t)=>k.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(k.isValid(e)&&t(),e),whenInvalid:(e,t)=>(k.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>y.success(t),t=>y.failure(t))},toValidation(e){return f.match(e,()=>k.valid,t=>k.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,r)=>f.match(e,a=>f.match(t,i=>f.success(n(a,i)),i=>f.failure(i)),a=>f.match(t,i=>f.failure(a),i=>f.failure(r(a,i)))),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function N({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:r="full",color:a="base",onClick:i,label:o},...l){return s.Use(v.BeatUII18n,c=>{const p=s.coalesce(o,c.$.closeModal);return v.Button({variant:"text",size:e,roundedness:r,disabled:n,color:a,onClick:i},s.attr.title(p),s.aria.label(p),...l,v.Icon({icon:t,size:e??"sm"}))})}function F(e){return`bc-label bc-label--${e}`}const ee=(...e)=>s.html.span(s.attr.class(F("emphasis")),...e),j=(...e)=>s.html.span(s.attr.class(F("default")),...e),q=(...e)=>s.html.span(s.attr.class(F("muted")),...e),te=(...e)=>s.html.span(s.attr.class(F("danger")),...e),se=e=>{const{value:t,onBlur:n,onChange:r,placeholder:a,disabled:i,id:o,checkedIcon:l,uncheckedIcon:c,iconSize:p="lg"}=e,h=o??D("checkbox"),m=`${h}-label`,w=()=>{if(s.Value.get(i??!1))return;const u=s.Value.get(t);r?.(!u)},b=u=>{s.Value.get(i??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),w())};return v.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(h),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,u=>u?-1:0)),s.aria.checked(t),s.aria.disabled(i),a!=null?s.aria.labelledby(m):s.Empty,s.on.keydown(b),n!=null?s.on.blur(n):s.Empty,v.Icon({icon:s.computedOf(t,l,c)((u,d,g)=>u?d??"akar-icons/check-box-fill":g??"akar-icons/box"),accessibility:"decorative",size:p})),a!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(m),s.attr.for(h),q(a)):s.Empty)},s.on.click(w))},U=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function ne(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function re(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function ae(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const P=({fullWidth:e=!1,required:t,label:n,labelChildren:r,context:a,description:i,content:o,error:l,labelFor:c,hasError:p,disabled:h,layout:m,labelWidth:w},...b)=>{const u=p??l!=null,d=h??!1,g=m??"vertical",I=D("input-wrapper"),C=i?`${I}-description`:void 0,_=l!=null?`${I}-error`:void 0,A=s.computedOf(g)(S=>S!=="vertical"),Z=s.computedOf(g,w??void 0)((S,V)=>ae(S,V));return s.html.div(s.attr.class(s.Value.map(g,S=>ne(S))),s.attr.class(s.Value.map(e,S=>S?"bc-input-wrapper--full-width":"")),s.attr.style(Z),n!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),c!=null?s.attr.for(c):s.Empty,s.html.span(s.attr.class(s.computedOf(u,d)((S,V)=>re(S??!1,V??!1))),n),n!=null&&t?U:s.Empty),s.When(s.computedOf(A,i)((S,V)=>S&&V!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),i))),a!=null?j(a):s.Empty,r):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,_].filter(Boolean).length>0?s.dataAttr.describedby([C,_].filter(Boolean).join(" ")):s.Empty,t?s.dataAttr.required("true"):s.Empty,s.When(u,()=>s.dataAttr.invalid("true")),o),s.When(s.computedOf(A,i)((S,V)=>!S&&V!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),i)),s.When(u,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(_),s.aria.live("polite"),s.attr.role("alert"),l)),...b)};function ie(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const le=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:r,onBlur:a,onChange:i,onInput:o,placeholder:l}=t,c=r??v.InputIcon({icon:"line-md:email",size:e.size,color:"neutral"});return s.Use(v.BeatUII18n,p=>v.InputContainer({...e,before:c,input:s.input.email(v.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(l,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),a!=null?s.on.blur(s.emitValue(a)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,o!=null?s.on.input(s.emitValue(o)):s.Empty)}))},oe=e=>{const{value:t,onBlur:n,onChange:r,onInput:a,before:i,after:o,hasError:l,disabled:c,autocomplete:p,placeholder:h,...m}=e,w={name:"password",disabled:c,...m},b=s.prop(!0),u=s.computedOf(b,p)((d,g)=>d?g??"current-password":"off");return s.Use(v.BeatUII18n,d=>{const g=s.computedOf(d.$.passwordPlaceholderText,b,h)((C,_,A)=>_?"•••••••••••••••":A??C),I=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>b.update(C=>!C)),s.When(b,()=>v.Icon({icon:"line-md:watch"}),()=>v.Icon({icon:"line-md:watch-off"})));return v.InputContainer({before:i,disabled:c,hasError:l,input:s.html.input(v.CommonInputAttributes({...w,autocomplete:u,placeholder:g}),s.When(b,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,r!=null?s.on.change(s.emitValue(r)):s.Empty,a!=null?s.on.input(s.emitValue(a)):s.Empty),after:o!=null?s.Fragment(I,o):I})})},W=(e,t)=>()=>{e.markTouched(),t?.()},M=(e,t)=>n=>{e.change(n),t?.(n)};function $(e,t){const{controller:n,onBlur:r,onChange:a,id:i,triggerOn:o,...l}=t;return e({id:i??n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,name:n.name,...l,onInput:o==="input"?M(n,a):void 0,onChange:o!=="input"?M(n,a):void 0,onBlur:W(n,r)})}function ce(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control"),o=n??i;return P({...r,hasError:r.controller.errorVisible,error:s.TextNode(r.controller.error.map(l=>l??"")),labelFor:o,content:$(l=>e({...l,id:i}),r)},...a)}function z(e,t){const{toInput:n,fromInput:r,controller:a,...i}=t,o=a.transform(n,r);return $(e,{...i,controller:o})}function ue(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control");return P({...r,labelFor:n??i,content:z(e,{...r,id:i})},...a)}function he(e){return e.split(".").map(n=>{const r=n.match(/^\[(\d+)\]$/);return r?Number(r[1]):n})}function H(e){return typeof e=="number"?`[${e}]`:`.${e}`}function R(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(H)].join("")}function O(e){return function(n){if(n.type==="valid")return n;let r=n.error;for(const a of e)if(r=r?.dependencies?.[a],r==null)return k.valid;return k.invalid(r)}}class E{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,r,a,i,o=T){this.path=t,this.change=n,this.signal=r,this.status=a,this.#s=o,this.#t.set(r.value),this.error=a.map(l=>l?.type==="invalid"?l.error?.message:void 0),this.hasError=this.error.map(l=>l!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((l,c,p)=>p==="eager"?!!l:!!l&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((l,c)=>!!l&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((l,c)=>!this.#s(l,c)),this.dependencyErrors=a.map(l=>l?.type==="invalid"?l.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((l,c)=>l||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((l,c)=>l||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return R(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=T)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=T)=>new K(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,r=[],a=T)=>new E([...this.path,...r],i=>this.change(n(i)),this.signal.map(t,a),this.status.map(O(r)),this.parent,a);asyncTransform=(t,n,r,a=[],i=T)=>new E([...this.path,...a],o=>{n(o).then(l=>this.change(l))},this.signal.mapAsync(t,r,void 0,i),this.status.map(O(a)),this.parent,i)}class K extends E{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){super(t,n,r.map(c=>c??{},o),a,i,o),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const l=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),l()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async o=>{this.change({...this.signal.value,[t]:o})},r=new E([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(O([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,r);const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class G extends E{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){const l=r.map(h=>h??[],o);super(t,n,l,a,i,o);const c=l.on(h=>{const m=this.#e.length-h.length;m>0&&(this.#e.splice(h.length,m).forEach((w,b)=>{const u=h.length+b;w.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#r.get(u)?.(),this.#r.delete(u),this.#a.delete(u)}),this.#o(),this.#i())});this.length=l.map(h=>h.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const p=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),l.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#r.values())h();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),p()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async o=>{const l=this.signal.value.slice();l[t]=o,this.change(l)},r=new E([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(O([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=r;const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const r=this.signal.value.slice();r.splice(t,n),this.change(r)};move=(t,n,r=1)=>{if(r<1||t===n)return;const a=this.signal.value.slice(),i=a.splice(t,r);a.splice(n,0,...i),this.change(a)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function J(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function Q(e){const t=e.filter(a=>a.path==null||a.path.length===0).map(a=>a.message),n=e.filter(a=>a.path!=null&&a.path.length>0).reduce((a,i)=>{const o=J(i.path),l=o.pop();let c=a;for(const p of o)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[l]={message:i.message},a},{}),r=t.join(`
2
+ `);return{...n,message:r!=""?r:void 0}}function X({initialValue:e,onChange:t,validate:n,equals:r,validationMode:a,validateDebounceMs:i}){const o=s.Value.deriveProp(e),l=s.prop(k.valid),c=s.prop(!1),p=s.prop(a??"onTouched"),h=d=>{l.set(d)};let m;const w=async d=>{if(n!=null){const g=await n(d);h(g)}},b=async d=>{o.set(d),t?.(d);const g=p.value;if(n!=null){if(g==="onSubmit")return;const I=i??0;I>0?(m&&clearTimeout(m),m=setTimeout(()=>{w(d)},I)):await w(d)}},u=new E([],b,o,l,{disabled:c,validationMode:p},r??T);return u.onDispose(()=>{c.dispose(),o.dispose(),l.dispose(),p.dispose(),m&&clearTimeout(m)}),{controller:u,setStatus:h}}function x(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function de(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function pe(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function B(e){return e.issues!=null?k.invalid(Q(e.issues)):k.valid}async function me({task:e,errorMessage:t,errorPath:n=["root"],validation:r}){try{const a=await e();return r!=null?r(a):k.valid}catch(a){const i=t??(a instanceof Error?a.message:"Operation failed");return n.length===1&&n[0]==="root"?k.invalid({message:i}):k.invalid({dependencies:Y(n,i)})}}function Y(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...r]=e;return{[n]:{dependencies:Y(r,t)}}}function fe({initialValue:e={},schema:t,onSubmit:n=async()=>k.valid,validationMode:r,validateDebounceMs:a}){const{controller:i,setStatus:o}=X({initialValue:e,validationMode:r??"onTouched",validateDebounceMs:a,validate:(r??"onTouched")==="onSubmit"||t==null?void 0:async h=>B(await t["~standard"].validate(h))}),l=s.prop(!1),c=i.object();return c.onDispose(l.dispose),{controller:c,setStatus:o,submit:async h=>{if(l.set(!0),h?.preventDefault(),c.markAllTouched(),t!=null){const w=c.signal.value,b=B(await t["~standard"].validate(w));if(o(b),b.type==="invalid"){l.set(!1);return}}const m=await n(c.signal.value);l.set(!1),m.type==="invalid"&&o(m)},submitting:l}}function be(e){switch(e){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function ge(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function ye(e,t,n,r){const a=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&a.push("bc-notice--dismissible"),r&&r.length>0&&a.push(r),a.join(" ")}function ve({variant:e="info",tone:t="subtle",role:n,title:r,icon:a,closable:i=!1,onDismiss:o,class:l},...c){const p=s.prop(!0);return s.When(p,()=>{const h=s.Value.map(i,u=>!!u||o!=null),m=s.Value.map(e,u=>u??"info"),w=s.Value.map(t,u=>u??"subtle"),b=s.computedOf(n,m)((u,d)=>u??(d==="danger"?"alert":"status"));return s.Use(v.BeatUII18n,u=>s.html.div(s.attr.class(s.computedOf(m,w,h,l)((d,g,I,C)=>ye(d,g,I,C))),s.attr.role(s.Value.map(b,d=>d)),s.Unless(s.Value.map(a,d=>d===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),v.Icon({icon:s.computedOf(a,m)((d,g)=>d===void 0?be(g):String(d)),size:"md",color:s.Value.map(m,ge)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(r,d=>s.html.div(s.attr.class("bc-notice__title"),d)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(h,()=>N({size:"xs",label:u.$.closeModal,onClick:()=>{p.set(!1),o?.()}}))))})}exports.ArrayController=G;exports.BaseControl=$;exports.BaseMappedControl=z;exports.CheckboxInput=se;exports.CloseButton=N;exports.Control=ce;exports.Controller=E;exports.DangerLabel=te;exports.EmailInput=le;exports.EmphasisLabel=ee;exports.InputWrapper=P;exports.Label=j;exports.MappedControl=ue;exports.MutedLabel=q;exports.Notice=ve;exports.O=T;exports.ObjectController=K;exports.PasswordInput=oe;exports.RequiredSymbol=U;exports.Stack=ie;exports.a=k;exports.connectCommonAttributes=x;exports.connectNumberInput=pe;exports.connectStringInput=de;exports.convertStandardSchemaIssues=Q;exports.convertStandardSchemaPathToPath=J;exports.makeMapValidation=O;exports.makeOnBlurHandler=W;exports.makeOnChangeHandler=M;exports.parsePath=he;exports.pathToString=R;exports.sessionId=D;exports.standardSchemaResultToValidation=B;exports.taskToValidation=me;exports.useController=X;exports.useForm=fe;exports.wrapSegment=H;
@@ -1,4 +1,4 @@
1
- import { Use as q, coalesce as Q, aria as x, attr as c, html as f, on as D, Value as S, Empty as C, computedOf as w, When as V, dataAttr as R, input as ne, emitValue as F, prop as I, Fragment as N, TextNode as re, emitValueAsNumber as ie, Unless as ae, Ensure as le } from "@tempots/dom";
1
+ import { Use as q, coalesce as Q, aria as x, attr as c, html as f, on as D, Value as S, Empty as C, computedOf as w, When as V, dataAttr as R, input as ne, emitValue as F, prop as E, Fragment as N, TextNode as re, emitValueAsNumber as ie, Unless as ae, Ensure as le } from "@tempots/dom";
2
2
  import { a as z, B as oe, I as B, b as W, c as ce, C as X } from "./translations-BUTBIDsS.js";
3
3
  const K = /* @__PURE__ */ new Map();
4
4
  function H(e) {
@@ -486,7 +486,7 @@ function ue({
486
486
  function U(e) {
487
487
  return `bc-label bc-label--${e}`;
488
488
  }
489
- const Oe = (...e) => f.span(c.class(U("emphasis")), ...e), he = (...e) => f.span(c.class(U("default")), ...e), de = (...e) => f.span(c.class(U("muted")), ...e), Me = (...e) => f.span(c.class(U("danger")), ...e), Fe = (e) => {
489
+ const Me = (...e) => f.span(c.class(U("emphasis")), ...e), he = (...e) => f.span(c.class(U("default")), ...e), de = (...e) => f.span(c.class(U("muted")), ...e), Oe = (...e) => f.span(c.class(U("danger")), ...e), Fe = (e) => {
490
490
  const {
491
491
  value: s,
492
492
  onBlur: t,
@@ -591,16 +591,16 @@ const Y = ({
591
591
  layout: b,
592
592
  labelWidth: k
593
593
  }, ...g) => {
594
- const u = p ?? a != null, d = h ?? !1, v = b ?? "vertical", T = H("input-wrapper"), A = i ? `${T}-description` : void 0, P = a != null ? `${T}-error` : void 0, L = w(v)((E) => E !== "vertical"), te = w(
594
+ const u = p ?? a != null, d = h ?? !1, v = b ?? "vertical", I = H("input-wrapper"), A = i ? `${I}-description` : void 0, P = a != null ? `${I}-error` : void 0, L = w(v)((T) => T !== "vertical"), te = w(
595
595
  v,
596
596
  k ?? void 0
597
- )((E, M) => me(E, M));
597
+ )((T, O) => me(T, O));
598
598
  return f.div(
599
- c.class(S.map(v, (E) => fe(E))),
599
+ c.class(S.map(v, (T) => fe(T))),
600
600
  c.class(
601
601
  S.map(
602
602
  e,
603
- (E) => E ? "bc-input-wrapper--full-width" : ""
603
+ (T) => T ? "bc-input-wrapper--full-width" : ""
604
604
  )
605
605
  ),
606
606
  c.style(te),
@@ -617,9 +617,9 @@ const Y = ({
617
617
  u,
618
618
  d
619
619
  )(
620
- (E, M) => be(
621
- E ?? !1,
622
- M ?? !1
620
+ (T, O) => be(
621
+ T ?? !1,
622
+ O ?? !1
623
623
  )
624
624
  )
625
625
  ),
@@ -632,7 +632,7 @@ const Y = ({
632
632
  w(
633
633
  L,
634
634
  i
635
- )((E, M) => E && M != null),
635
+ )((T, O) => T && O != null),
636
636
  () => f.div(
637
637
  c.class(
638
638
  "bc-input-wrapper__description bc-input-wrapper__description--under-label"
@@ -657,7 +657,7 @@ const Y = ({
657
657
  ),
658
658
  // Show description at bottom only when not horizontal
659
659
  V(
660
- w(L, i)((E, M) => !E && M != null),
660
+ w(L, i)((T, O) => !T && O != null),
661
661
  () => f.div(
662
662
  c.class("bc-input-wrapper__description"),
663
663
  c.id(A),
@@ -732,7 +732,7 @@ const xe = (e) => {
732
732
  name: "password",
733
733
  disabled: o,
734
734
  ...b
735
- }, g = I(!0), u = w(
735
+ }, g = E(!0), u = w(
736
736
  g,
737
737
  p
738
738
  )((d, v) => d ? v ?? "current-password" : "off");
@@ -741,7 +741,7 @@ const xe = (e) => {
741
741
  d.$.passwordPlaceholderText,
742
742
  g,
743
743
  h
744
- )((A, P, L) => P ? "•••••••••••••••" : L ?? A), T = f.button(
744
+ )((A, P, L) => P ? "•••••••••••••••" : L ?? A), I = f.button(
745
745
  c.type("button"),
746
746
  c.class("bc-input-container__password-toggle"),
747
747
  x.label(d.$.togglePasswordVisibility),
@@ -773,7 +773,7 @@ const xe = (e) => {
773
773
  n != null ? D.change(F(n)) : C,
774
774
  r != null ? D.input(F(r)) : C
775
775
  ),
776
- after: l != null ? N(T, l) : T
776
+ after: l != null ? N(I, l) : I
777
777
  });
778
778
  });
779
779
  }, ge = (
@@ -865,7 +865,7 @@ function j(e) {
865
865
  return _.invalid(n);
866
866
  };
867
867
  }
868
- class O {
868
+ class M {
869
869
  path;
870
870
  change;
871
871
  signal;
@@ -877,11 +877,11 @@ class O {
877
877
  dirty;
878
878
  dependencyErrors;
879
879
  #e = {
880
- disabled: I(!1),
881
- touched: I(!1)
880
+ disabled: E(!1),
881
+ touched: E(!1)
882
882
  };
883
883
  #t;
884
- #s = I(void 0);
884
+ #s = E(void 0);
885
885
  parent;
886
886
  disabled;
887
887
  #n = [];
@@ -893,7 +893,7 @@ class O {
893
893
  this.hasError,
894
894
  this.touched,
895
895
  i.validationMode
896
- )((a, o, p) => p === "continuous" ? !!a : !!a && !!o) : this.errorVisible = w(
896
+ )((a, o, p) => p === "eager" ? !!a : !!a && !!o) : this.errorVisible = w(
897
897
  this.hasError,
898
898
  this.touched
899
899
  )((a, o) => !!a && !!o), this.dirty = w(
@@ -960,7 +960,7 @@ class O {
960
960
  this.parent,
961
961
  s
962
962
  );
963
- transform = (s, t, n = [], r = $) => new O(
963
+ transform = (s, t, n = [], r = $) => new M(
964
964
  [...this.path, ...n],
965
965
  (i) => this.change(t(i)),
966
966
  this.signal.map(s, r),
@@ -968,7 +968,7 @@ class O {
968
968
  this.parent,
969
969
  r
970
970
  );
971
- asyncTransform = (s, t, n, r = [], i = $) => new O(
971
+ asyncTransform = (s, t, n, r = [], i = $) => new M(
972
972
  [...this.path, ...r],
973
973
  (l) => {
974
974
  t(l).then((a) => this.change(a));
@@ -979,15 +979,15 @@ class O {
979
979
  i
980
980
  );
981
981
  }
982
- class ke extends O {
982
+ class ke extends M {
983
983
  #e = /* @__PURE__ */ new Map();
984
984
  #t = /* @__PURE__ */ new Map();
985
985
  #s = /* @__PURE__ */ new Map();
986
- #n = I(!1);
986
+ #n = E(!1);
987
987
  touchedDeep = this.#n;
988
988
  #i = /* @__PURE__ */ new Map();
989
989
  #r = /* @__PURE__ */ new Map();
990
- #l = I(!1);
990
+ #l = E(!1);
991
991
  dirtyDeep = this.#l;
992
992
  #c;
993
993
  #u;
@@ -1032,7 +1032,7 @@ class ke extends O {
1032
1032
  ...this.signal.value,
1033
1033
  [s]: l
1034
1034
  });
1035
- }, n = new O(
1035
+ }, n = new M(
1036
1036
  [...this.path, s],
1037
1037
  t,
1038
1038
  this.signal.map((l) => l[s]),
@@ -1079,16 +1079,16 @@ class ke extends O {
1079
1079
  this.#l.set(this.dirty.value || s);
1080
1080
  };
1081
1081
  }
1082
- class Se extends O {
1082
+ class Se extends M {
1083
1083
  #e = new Array();
1084
1084
  length;
1085
1085
  #t = /* @__PURE__ */ new Map();
1086
1086
  #s = /* @__PURE__ */ new Map();
1087
- #n = I(!1);
1087
+ #n = E(!1);
1088
1088
  touchedDeep = this.#n;
1089
1089
  #i = /* @__PURE__ */ new Map();
1090
1090
  #r = /* @__PURE__ */ new Map();
1091
- #l = I(!1);
1091
+ #l = E(!1);
1092
1092
  dirtyDeep = this.#l;
1093
1093
  #c;
1094
1094
  #u;
@@ -1133,7 +1133,7 @@ class Se extends O {
1133
1133
  const t = async (l) => {
1134
1134
  const a = this.signal.value.slice();
1135
1135
  a[s] = l, this.change(a);
1136
- }, n = new O(
1136
+ }, n = new M(
1137
1137
  [...this.path, s],
1138
1138
  t,
1139
1139
  this.signal.map((l) => l[s]),
@@ -1229,7 +1229,7 @@ function De({
1229
1229
  validationMode: r,
1230
1230
  validateDebounceMs: i
1231
1231
  }) {
1232
- const l = S.deriveProp(e), a = I(_.valid), o = I(!1), p = I(r ?? "touchedOrSubmit"), h = (d) => {
1232
+ const l = S.deriveProp(e), a = E(_.valid), o = E(!1), p = E(r ?? "onTouched"), h = (d) => {
1233
1233
  a.set(d);
1234
1234
  };
1235
1235
  let b;
@@ -1244,12 +1244,12 @@ function De({
1244
1244
  if (t != null) {
1245
1245
  if (v === "onSubmit")
1246
1246
  return;
1247
- const T = i ?? 0;
1248
- T > 0 ? (b && clearTimeout(b), b = setTimeout(() => {
1247
+ const I = i ?? 0;
1248
+ I > 0 ? (b && clearTimeout(b), b = setTimeout(() => {
1249
1249
  k(d);
1250
- }, T)) : await k(d);
1250
+ }, I)) : await k(d);
1251
1251
  }
1252
- }, u = new O(
1252
+ }, u = new M(
1253
1253
  [],
1254
1254
  g,
1255
1255
  l,
@@ -1329,24 +1329,21 @@ function He({
1329
1329
  }) {
1330
1330
  const { controller: i, setStatus: l } = De({
1331
1331
  initialValue: e,
1332
- validationMode: n ?? "touchedOrSubmit",
1332
+ validationMode: n ?? "onTouched",
1333
1333
  validateDebounceMs: r,
1334
- validate: (n ?? "touchedOrSubmit") === "onSubmit" || s == null ? void 0 : async (h) => J(
1334
+ validate: (n ?? "onTouched") === "onSubmit" || s == null ? void 0 : async (h) => J(
1335
1335
  await s["~standard"].validate(h)
1336
1336
  )
1337
- }), a = I(!1), o = i.object();
1337
+ }), a = E(!1), o = i.object();
1338
1338
  return o.onDispose(a.dispose), {
1339
1339
  controller: o,
1340
1340
  setStatus: l,
1341
1341
  submit: async (h) => {
1342
- if (a.set(!0), h?.preventDefault(), o.markAllTouched(), (n ?? "touchedOrSubmit") === "onSubmit") {
1343
- const k = o.signal.value, g = s?.["~standard"].validate;
1344
- if (g == null) {
1345
- a.set(!1);
1346
- return;
1347
- }
1348
- const u = J(await g(k));
1349
- if (l(u), u.type === "invalid") {
1342
+ if (a.set(!0), h?.preventDefault(), o.markAllTouched(), s != null) {
1343
+ const k = o.signal.value, g = J(
1344
+ await s["~standard"].validate(k)
1345
+ );
1346
+ if (l(g), g.type === "invalid") {
1350
1347
  a.set(!1);
1351
1348
  return;
1352
1349
  }
@@ -1357,7 +1354,7 @@ function He({
1357
1354
  submitting: a
1358
1355
  };
1359
1356
  }
1360
- function Ee(e) {
1357
+ function Te(e) {
1361
1358
  switch (e) {
1362
1359
  case "success":
1363
1360
  return "material-symbols:check-circle-outline";
@@ -1370,7 +1367,7 @@ function Ee(e) {
1370
1367
  return "material-symbols:info-outline";
1371
1368
  }
1372
1369
  }
1373
- function Ie(e) {
1370
+ function Ee(e) {
1374
1371
  switch (e) {
1375
1372
  case "success":
1376
1373
  return "success";
@@ -1383,7 +1380,7 @@ function Ie(e) {
1383
1380
  return "info";
1384
1381
  }
1385
1382
  }
1386
- function Te(e, s, t, n) {
1383
+ function Ie(e, s, t, n) {
1387
1384
  const r = [
1388
1385
  "bc-notice",
1389
1386
  `bc-notice--${e}`,
@@ -1401,7 +1398,7 @@ function Ue({
1401
1398
  onDismiss: l,
1402
1399
  class: a
1403
1400
  }, ...o) {
1404
- const p = I(!0);
1401
+ const p = E(!0);
1405
1402
  return V(p, () => {
1406
1403
  const h = S.map(
1407
1404
  i,
@@ -1421,7 +1418,7 @@ function Ue({
1421
1418
  k,
1422
1419
  h,
1423
1420
  a
1424
- )((d, v, T, A) => Te(d, v, T, A))
1421
+ )((d, v, I, A) => Ie(d, v, I, A))
1425
1422
  ),
1426
1423
  // Accessibility role mapping (always defined)
1427
1424
  c.role(S.map(g, (d) => d)),
@@ -1434,10 +1431,10 @@ function Ue({
1434
1431
  r,
1435
1432
  b
1436
1433
  )(
1437
- (d, v) => d === void 0 ? Ee(v) : String(d)
1434
+ (d, v) => d === void 0 ? Te(v) : String(d)
1438
1435
  ),
1439
1436
  size: "md",
1440
- color: S.map(b, Ie)
1437
+ color: S.map(b, Ee)
1441
1438
  })
1442
1439
  )
1443
1440
  ),
@@ -1467,7 +1464,7 @@ export {
1467
1464
  Se as A,
1468
1465
  Z as B,
1469
1466
  ue as C,
1470
- Me as D,
1467
+ Oe as D,
1471
1468
  xe as E,
1472
1469
  Y as I,
1473
1470
  he as L,
@@ -1481,7 +1478,7 @@ export {
1481
1478
  Fe as b,
1482
1479
  Pe as c,
1483
1480
  G as d,
1484
- O as e,
1481
+ M as e,
1485
1482
  j as f,
1486
1483
  ve as g,
1487
1484
  we as h,
@@ -1498,7 +1495,7 @@ export {
1498
1495
  H as s,
1499
1496
  ze as t,
1500
1497
  He as u,
1501
- Oe as v,
1498
+ Me as v,
1502
1499
  ye as w,
1503
1500
  de as x
1504
1501
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index-CWuw5oBV.cjs");exports.DEFAULT_FEATURES=r.DEFAULT_FEATURES;exports.ProseMirrorMarkdownInput=r.ProseMirrorMarkdownInput;exports.ProseMirrorToolbar=r.ProseMirrorToolbar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index-B7lXSIXm.cjs");exports.DEFAULT_FEATURES=r.DEFAULT_FEATURES;exports.ProseMirrorMarkdownInput=r.ProseMirrorMarkdownInput;exports.ProseMirrorToolbar=r.ProseMirrorToolbar;
@@ -1,4 +1,4 @@
1
- import { D as a, P as s, b as e } from "../index-BaNgZ2Pb.js";
1
+ import { D as a, P as s, b as e } from "../index-CzuXAuLZ.js";
2
2
  export {
3
3
  a as DEFAULT_FEATURES,
4
4
  s as ProseMirrorMarkdownInput,
@@ -22,7 +22,7 @@ export interface UnionBranch<T = unknown> {
22
22
  /** Default value for this branch when switching to it */
23
23
  defaultValue: () => T;
24
24
  }
25
- export type ValidationMode = 'onSubmit' | 'continuous' | 'touchedOrSubmit';
25
+ export type ValidationMode = 'onSubmit' | 'eager' | 'onTouched';
26
26
  /**
27
27
  * Controller for union types that manages multiple possible value types
28
28
  */
@@ -5,7 +5,7 @@ export interface UseFormOptions<T> {
5
5
  schema?: StandardSchemaV1<T, T>;
6
6
  initialValue?: Value<T>;
7
7
  onSubmit?: (value: T) => Promise<ControllerValidation>;
8
- validationMode?: 'onSubmit' | 'continuous' | 'touchedOrSubmit';
8
+ validationMode?: 'onSubmit' | 'eager' | 'onTouched';
9
9
  validateDebounceMs?: number;
10
10
  }
11
11
  export interface UseControllerOptions<T> {
@@ -13,7 +13,7 @@ export interface UseControllerOptions<T> {
13
13
  onChange?: (value: T) => void;
14
14
  validate?: (value: T) => Promise<ControllerValidation> | ControllerValidation;
15
15
  equals?: (a: T, b: T) => boolean;
16
- validationMode?: 'onSubmit' | 'continuous' | 'touchedOrSubmit';
16
+ validationMode?: 'onSubmit' | 'eager' | 'onTouched';
17
17
  validateDebounceMs?: number;
18
18
  }
19
19
  /**
@@ -11,8 +11,9 @@ export declare function JSONSchemaGenericControl<T>({ ctx, controller, }: {
11
11
  /**
12
12
  * Main entry point for JSON Schema controls
13
13
  */
14
- export declare function JSONSchemaControl<T>({ schema, controller, ajv, }: {
14
+ export declare function JSONSchemaControl<T>({ schema, controller, ajv, widgetRegistry, }: {
15
15
  schema: JSONSchemaDefinition;
16
16
  controller: Controller<T>;
17
17
  ajv?: import('ajv').default;
18
+ widgetRegistry?: import('../widgets/widget-customization').WidgetRegistry;
18
19
  }): Renderable;
@@ -1,5 +1,7 @@
1
1
  import type { JSONSchema } from '../schema-context';
2
- import type { InputWrapperOptions } from '../../form';
2
+ import type { InputWrapperOptions, Controller } from '../../form';
3
+ import type { Renderable } from '@tempots/dom';
4
+ import type { ResolvedWidget } from '../widgets/utils';
3
5
  /**
4
6
  * Convert schema definition to input wrapper options
5
7
  */
@@ -22,3 +24,17 @@ export declare function shouldHideWriteOnly(ctx: import('../schema-context').Sch
22
24
  * Determine if a control should be disabled based on readOnly or deprecated status
23
25
  */
24
26
  export declare function shouldDisableControl(ctx: import('../schema-context').SchemaContext): boolean;
27
+ /**
28
+ * Try to resolve and render a custom widget following the precedence order:
29
+ * 1. Explicit x:ui widget in custom registry (highest priority)
30
+ * 2. Explicit x:ui widget in global registry
31
+ * 3. Matcher-based custom widgets (by priority)
32
+ * 4. Matcher-based global widgets (lowest priority)
33
+ *
34
+ * Returns the rendered widget if found, or null if no custom widget matches
35
+ */
36
+ export declare function tryResolveCustomWidget({ ctx, controller, resolved, }: {
37
+ ctx: import('../schema-context').SchemaContext;
38
+ controller: Controller<unknown>;
39
+ resolved: ResolvedWidget | null | undefined;
40
+ }): Renderable | null;
@@ -3,3 +3,4 @@ export * from './schema-context';
3
3
  export * from './controls';
4
4
  export * from './json-schema-form';
5
5
  export * from './validator';
6
+ export { type CustomWidgets, type CustomWidgetRegistration, type WidgetFactory, forXUI, forFormat, forTypeAndFormat, } from './widgets/widget-customization';
@@ -1,6 +1,7 @@
1
1
  import { type SchemaObject } from 'ajv';
2
2
  import { Value, Renderable } from '@tempots/dom';
3
3
  import { Controller, ControllerValidation } from '../form';
4
+ import { type CustomWidgets } from './widgets/widget-customization';
4
5
  /**
5
6
  * External reference resolver function type.
6
7
  * Called when the form encounters external $ref URIs that need to be resolved.
@@ -69,10 +70,12 @@ export interface JSONSchemaFormProps<T> extends JSONSchemaFormExternalOptions {
69
70
  /** Reactive value containing the form data */
70
71
  initialValue: Value<T>;
71
72
  /** Validation behavior */
72
- validationMode?: 'onSubmit' | 'continuous' | 'touchedOrSubmit';
73
+ validationMode?: 'onSubmit' | 'eager' | 'onTouched';
73
74
  validateDebounceMs?: number;
75
+ /** Custom widgets for form-scoped widget overrides */
76
+ customWidgets?: CustomWidgets;
74
77
  }
75
- export declare function JSONSchemaForm<T>({ schema, initialValue, externalSchemas, refResolver, sanitizeAdditional, validationMode, validateDebounceMs, }: JSONSchemaFormProps<T>, fn: ({ Form, controller, setStatus, }: {
78
+ export declare function JSONSchemaForm<T>({ schema, initialValue, externalSchemas, refResolver, sanitizeAdditional, validationMode, validateDebounceMs, customWidgets, }: JSONSchemaFormProps<T>, fn: ({ Form, controller, setStatus, }: {
76
79
  Form: Renderable;
77
80
  controller: Controller<T>;
78
81
  setStatus: (result: ControllerValidation) => void;