@tempots/beatui 0.69.0 → 0.71.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.
- package/dist/{ar-aMLQTGVh.js → ar-BbgpGwJp.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +106 -105
- package/dist/beatui.css +401 -0
- package/dist/beatui.tailwind.css +401 -0
- package/dist/{de-DBFOC44R.js → de-R7lPfyZ4.js} +1 -1
- package/dist/deep-merge-CQQCMLwG.js +1636 -0
- package/dist/deep-merge-DZxfgKqX.cjs +1 -0
- package/dist/duration-input-D-SIoDoo.cjs +1 -0
- package/dist/duration-input-DKxZ6OCa.js +277 -0
- package/dist/{es-C4xOThaT.js → es-DV0Jr_BZ.js} +1 -1
- package/dist/{fa-B7X_xydY.js → fa-DXvHejs9.js} +1 -1
- package/dist/{fr-AmjzbxN_.js → fr-D8FOMX0o.js} +1 -1
- package/dist/{he-DY-9yiOC.js → he-B19Qsx-u.js} +1 -1
- package/dist/{hi-Clkyp5Fu.js → hi-DozFnE3b.js} +1 -1
- package/dist/{index-GLoRnI6r.js → index-CYb1YxDX.js} +1 -1
- package/dist/{index-CzuXAuLZ.js → index-DdpYvBeh.js} +3 -3
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +2852 -3104
- package/dist/{it-BC32WmGF.js → it-But8uzNi.js} +1 -1
- package/dist/{ja-JNSZS_Hv.js → ja-DkwTnFdU.js} +1 -1
- package/dist/json-schema/index.cjs.js +6 -6
- package/dist/json-schema/index.es.js +3099 -2961
- package/dist/json-structure/index.cjs.js +1 -0
- package/dist/json-structure/index.es.js +3157 -0
- package/dist/{ko-B8l0TJp0.js → ko-Cqv-IjhX.js} +1 -1
- package/dist/modal-5P9mU_a4.cjs +1 -0
- package/dist/{modal-DJWj5M5e.js → modal-MofsfmAe.js} +2 -2
- package/dist/{nl-BpYESHP8.js → nl-YSiU3rFI.js} +1 -1
- package/dist/notice-Cqq8g17n.js +209 -0
- package/dist/notice-DP209Ed8.cjs +1 -0
- package/dist/{pl-_sWhGdrs.js → pl-DXmHc2Nh.js} +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-BmiQvHUz.js → pt-Bf3z_-26.js} +1 -1
- package/dist/{ru-DacnqexG.js → ru-Sy00qUeG.js} +1 -1
- package/dist/tailwind/vite-plugin.es.js +1 -0
- package/dist/{toolbar-Bk5-22ln.js → toolbar-C_Ec0_XC.js} +1 -1
- package/dist/{tr-BSS5b_v6.js → tr-BDxG3qd6.js} +1 -1
- package/dist/{translations-zGwuSQWQ.js → translations-BmsRhth7.js} +1 -1
- package/dist/{translations-BUTBIDsS.js → translations-DQxouiBG.js} +24 -24
- package/dist/types/components/form/index.d.ts +1 -0
- package/dist/types/components/form/utils/deep-merge.d.ts +27 -0
- package/dist/types/components/form/utils/index.d.ts +1 -0
- package/dist/types/components/json-schema/index.d.ts +1 -0
- package/dist/types/components/json-schema/json-schema-form.d.ts +22 -3
- package/dist/types/components/json-schema/schema-defaults.d.ts +39 -0
- package/dist/types/components/json-structure/controls/any-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/array-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/binary-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/boolean-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/choice-control.d.ts +19 -0
- package/dist/types/components/json-structure/controls/decimal-control.d.ts +17 -0
- package/dist/types/components/json-structure/controls/deprecation-utils.d.ts +14 -0
- package/dist/types/components/json-structure/controls/enum-const-controls.d.ts +22 -0
- package/dist/types/components/json-structure/controls/generic-control.d.ts +31 -0
- package/dist/types/components/json-structure/controls/index.d.ts +21 -0
- package/dist/types/components/json-structure/controls/integer-control.d.ts +18 -0
- package/dist/types/components/json-structure/controls/map-control.d.ts +17 -0
- package/dist/types/components/json-structure/controls/object-control.d.ts +17 -0
- package/dist/types/components/json-structure/controls/set-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/string-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/temporal-control.d.ts +18 -0
- package/dist/types/components/json-structure/controls/tuple-control.d.ts +19 -0
- package/dist/types/components/json-structure/controls/union-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/uri-control.d.ts +15 -0
- package/dist/types/components/json-structure/controls/uuid-control.d.ts +15 -0
- package/dist/types/components/json-structure/extends-utils.d.ts +36 -0
- package/dist/types/components/json-structure/index.d.ts +25 -0
- package/dist/types/components/json-structure/json-structure-form.d.ts +96 -0
- package/dist/types/components/json-structure/ref-utils.d.ts +55 -0
- package/dist/types/components/json-structure/structure-context.d.ts +176 -0
- package/dist/types/components/json-structure/structure-defaults.d.ts +46 -0
- package/dist/types/components/json-structure/structure-types.d.ts +173 -0
- package/dist/types/components/json-structure/validation/error-transform.d.ts +56 -0
- package/dist/types/components/json-structure/validation/index.d.ts +5 -0
- package/dist/types/components/json-structure/validation/sdk-validator.d.ts +46 -0
- package/dist/types/components/json-structure/widgets/default-widgets.d.ts +27 -0
- package/dist/types/components/json-structure/widgets/index.d.ts +6 -0
- package/dist/types/components/json-structure/widgets/widget-registry.d.ts +143 -0
- package/dist/types/components/json-structure/widgets/widget-utils.d.ts +79 -0
- package/dist/types/json-structure/index.d.ts +9 -0
- package/dist/{ur-C6Ky6OCl.js → ur-55zdT2TQ.js} +1 -1
- package/dist/{notice-Um1LwKBF.js → use-form-B7A865EM.js} +329 -532
- package/dist/use-form-DVJXMMoN.cjs +2 -0
- package/dist/{vi-Bx2gx2S0.js → vi-C7K7W0hM.js} +1 -1
- package/dist/widget-customization-29Hl2gKT.js +1171 -0
- package/dist/widget-customization-BXiewbt-.cjs +1 -0
- package/dist/{zh-eixtg-Ce.js → zh-DvJBV9D8.js} +1 -1
- package/package.json +10 -2
- package/dist/modal-D_paG9Sr.cjs +0 -1
- package/dist/notice-CgT9ma2m.cjs +0 -2
- package/dist/widget-customization-BcbRhAAR.cjs +0 -1
- package/dist/widget-customization-D6Y_Qm7o.js +0 -2788
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./use-form-DVJXMMoN.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,7 +1,7 @@
|
|
|
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 "./
|
|
4
|
-
import { a as K, B as P } from "./translations-
|
|
3
|
+
import { s as Y, C as Z } from "./use-form-B7A865EM.js";
|
|
4
|
+
import { a as K, B as P } from "./translations-DQxouiBG.js";
|
|
5
5
|
const ee = [
|
|
6
6
|
"a[href]",
|
|
7
7
|
"button:not([disabled])",
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { I as j, a as V, b as z, C as O, c as E } from "./translations-DQxouiBG.js";
|
|
2
|
+
import { Use as x, input as A, attr as n, coalesce as F, on as m, Empty as w, emitValue as v, prop as k, computedOf as C, html as p, aria as M, When as T, Fragment as B, Value as g, Unless as R, Ensure as S } from "@tempots/dom";
|
|
3
|
+
import { C as W } from "./use-form-B7A865EM.js";
|
|
4
|
+
const L = (t) => {
|
|
5
|
+
const l = {
|
|
6
|
+
name: "email",
|
|
7
|
+
autocomplete: "email",
|
|
8
|
+
...t
|
|
9
|
+
}, {
|
|
10
|
+
value: c,
|
|
11
|
+
before: s,
|
|
12
|
+
onBlur: o,
|
|
13
|
+
onChange: d,
|
|
14
|
+
onInput: r,
|
|
15
|
+
placeholder: I
|
|
16
|
+
} = l, b = s ?? j({
|
|
17
|
+
icon: "line-md:email",
|
|
18
|
+
size: t.size,
|
|
19
|
+
color: "neutral"
|
|
20
|
+
});
|
|
21
|
+
return x(
|
|
22
|
+
V,
|
|
23
|
+
(f) => z({
|
|
24
|
+
...t,
|
|
25
|
+
before: b,
|
|
26
|
+
input: A.email(
|
|
27
|
+
O(l),
|
|
28
|
+
n.placeholder(F(I, f.$.emailPlaceholderText)),
|
|
29
|
+
n.value(c),
|
|
30
|
+
n.class("bc-input"),
|
|
31
|
+
o != null ? m.blur(v(o)) : w,
|
|
32
|
+
d != null ? m.change(v(d)) : w,
|
|
33
|
+
r != null ? m.input(v(r)) : w
|
|
34
|
+
)
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
}, Q = (t) => {
|
|
38
|
+
const {
|
|
39
|
+
value: l,
|
|
40
|
+
onBlur: c,
|
|
41
|
+
onChange: s,
|
|
42
|
+
onInput: o,
|
|
43
|
+
before: d,
|
|
44
|
+
after: r,
|
|
45
|
+
hasError: I,
|
|
46
|
+
disabled: b,
|
|
47
|
+
autocomplete: f,
|
|
48
|
+
placeholder: _,
|
|
49
|
+
...h
|
|
50
|
+
} = t, $ = {
|
|
51
|
+
name: "password",
|
|
52
|
+
disabled: b,
|
|
53
|
+
...h
|
|
54
|
+
}, i = k(!0), a = C(
|
|
55
|
+
i,
|
|
56
|
+
f
|
|
57
|
+
)((e, u) => e ? u ?? "current-password" : "off");
|
|
58
|
+
return x(V, (e) => {
|
|
59
|
+
const u = C(
|
|
60
|
+
e.$.passwordPlaceholderText,
|
|
61
|
+
i,
|
|
62
|
+
_
|
|
63
|
+
)((y, N, U) => N ? "•••••••••••••••" : U ?? y), P = p.button(
|
|
64
|
+
n.type("button"),
|
|
65
|
+
n.class("bc-input-container__password-toggle"),
|
|
66
|
+
M.label(e.$.togglePasswordVisibility),
|
|
67
|
+
m.click(() => i.update((y) => !y)),
|
|
68
|
+
T(
|
|
69
|
+
i,
|
|
70
|
+
() => E({ icon: "line-md:watch" }),
|
|
71
|
+
() => E({ icon: "line-md:watch-off" })
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
return z({
|
|
75
|
+
before: d,
|
|
76
|
+
disabled: b,
|
|
77
|
+
hasError: I,
|
|
78
|
+
input: p.input(
|
|
79
|
+
O({
|
|
80
|
+
...$,
|
|
81
|
+
autocomplete: a,
|
|
82
|
+
placeholder: u
|
|
83
|
+
}),
|
|
84
|
+
T(
|
|
85
|
+
i,
|
|
86
|
+
() => B(n.type("password")),
|
|
87
|
+
() => B(n.type("text"))
|
|
88
|
+
),
|
|
89
|
+
n.class("bc-input"),
|
|
90
|
+
n.value(l),
|
|
91
|
+
c != null ? m.blur(v(c)) : w,
|
|
92
|
+
s != null ? m.change(v(s)) : w,
|
|
93
|
+
o != null ? m.input(v(o)) : w
|
|
94
|
+
),
|
|
95
|
+
after: r != null ? B(P, r) : P
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
function q(t) {
|
|
100
|
+
switch (t) {
|
|
101
|
+
case "success":
|
|
102
|
+
return "material-symbols:check-circle-outline";
|
|
103
|
+
case "warning":
|
|
104
|
+
return "material-symbols:warning-outline";
|
|
105
|
+
case "danger":
|
|
106
|
+
return "material-symbols:error-outline";
|
|
107
|
+
case "info":
|
|
108
|
+
default:
|
|
109
|
+
return "material-symbols:info-outline";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function D(t) {
|
|
113
|
+
switch (t) {
|
|
114
|
+
case "success":
|
|
115
|
+
return "success";
|
|
116
|
+
case "warning":
|
|
117
|
+
return "warning";
|
|
118
|
+
case "danger":
|
|
119
|
+
return "danger";
|
|
120
|
+
case "info":
|
|
121
|
+
default:
|
|
122
|
+
return "info";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function G(t, l, c, s) {
|
|
126
|
+
const o = [
|
|
127
|
+
"bc-notice",
|
|
128
|
+
`bc-notice--${t}`,
|
|
129
|
+
`bc-notice--tone-${l}`
|
|
130
|
+
];
|
|
131
|
+
return c && o.push("bc-notice--dismissible"), s && s.length > 0 && o.push(s), o.join(" ");
|
|
132
|
+
}
|
|
133
|
+
function X({
|
|
134
|
+
variant: t = "info",
|
|
135
|
+
tone: l = "subtle",
|
|
136
|
+
role: c,
|
|
137
|
+
title: s,
|
|
138
|
+
icon: o,
|
|
139
|
+
closable: d = !1,
|
|
140
|
+
onDismiss: r,
|
|
141
|
+
class: I
|
|
142
|
+
}, ...b) {
|
|
143
|
+
const f = k(!0);
|
|
144
|
+
return T(f, () => {
|
|
145
|
+
const _ = g.map(
|
|
146
|
+
d,
|
|
147
|
+
(a) => !!a || r != null
|
|
148
|
+
), h = g.map(t, (a) => a ?? "info"), $ = g.map(l, (a) => a ?? "subtle"), i = C(
|
|
149
|
+
c,
|
|
150
|
+
h
|
|
151
|
+
)(
|
|
152
|
+
(a, e) => a ?? (e === "danger" ? "alert" : "status")
|
|
153
|
+
);
|
|
154
|
+
return x(
|
|
155
|
+
V,
|
|
156
|
+
(a) => p.div(
|
|
157
|
+
n.class(
|
|
158
|
+
C(
|
|
159
|
+
h,
|
|
160
|
+
$,
|
|
161
|
+
_,
|
|
162
|
+
I
|
|
163
|
+
)((e, u, P, y) => G(e, u, P, y))
|
|
164
|
+
),
|
|
165
|
+
// Accessibility role mapping (always defined)
|
|
166
|
+
n.role(g.map(i, (e) => e)),
|
|
167
|
+
R(
|
|
168
|
+
g.map(o, (e) => e === !1),
|
|
169
|
+
() => p.div(
|
|
170
|
+
n.class("bc-notice__icon"),
|
|
171
|
+
E({
|
|
172
|
+
icon: C(
|
|
173
|
+
o,
|
|
174
|
+
h
|
|
175
|
+
)(
|
|
176
|
+
(e, u) => e === void 0 ? q(u) : String(e)
|
|
177
|
+
),
|
|
178
|
+
size: "md",
|
|
179
|
+
color: g.map(h, D)
|
|
180
|
+
})
|
|
181
|
+
)
|
|
182
|
+
),
|
|
183
|
+
p.div(
|
|
184
|
+
n.class("bc-notice__body"),
|
|
185
|
+
S(
|
|
186
|
+
s,
|
|
187
|
+
(e) => p.div(n.class("bc-notice__title"), e)
|
|
188
|
+
),
|
|
189
|
+
p.div(n.class("bc-notice__content"), ...b)
|
|
190
|
+
),
|
|
191
|
+
T(
|
|
192
|
+
_,
|
|
193
|
+
() => W({
|
|
194
|
+
size: "xs",
|
|
195
|
+
label: a.$.closeModal,
|
|
196
|
+
onClick: () => {
|
|
197
|
+
f.set(!1), r?.();
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
)
|
|
201
|
+
)
|
|
202
|
+
);
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
export {
|
|
206
|
+
L as E,
|
|
207
|
+
X as N,
|
|
208
|
+
Q as P
|
|
209
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./translations-hMQlZmD4.cjs"),t=require("@tempots/dom"),C=require("./use-form-DVJXMMoN.cjs"),E=n=>{const r={name:"email",autocomplete:"email",...n},{value:c,before:s,onBlur:a,onChange:p,onInput:i,placeholder:h}=r,d=s??l.InputIcon({icon:"line-md:email",size:n.size,color:"neutral"});return t.Use(l.BeatUII18n,b=>l.InputContainer({...n,before:d,input:t.input.email(l.CommonInputAttributes(r),t.attr.placeholder(t.coalesce(h,b.$.emailPlaceholderText)),t.attr.value(c),t.attr.class("bc-input"),a!=null?t.on.blur(t.emitValue(a)):t.Empty,p!=null?t.on.change(t.emitValue(p)):t.Empty,i!=null?t.on.input(t.emitValue(i)):t.Empty)}))},_=n=>{const{value:r,onBlur:c,onChange:s,onInput:a,before:p,after:i,hasError:h,disabled:d,autocomplete:b,placeholder:I,...f}=n,y={name:"password",disabled:d,...f},u=t.prop(!0),o=t.computedOf(u,b)((e,m)=>e?m??"current-password":"off");return t.Use(l.BeatUII18n,e=>{const m=t.computedOf(e.$.passwordPlaceholderText,u,I)((g,V,v)=>V?"•••••••••••••••":v??g),w=t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__password-toggle"),t.aria.label(e.$.togglePasswordVisibility),t.on.click(()=>u.update(g=>!g)),t.When(u,()=>l.Icon({icon:"line-md:watch"}),()=>l.Icon({icon:"line-md:watch-off"})));return l.InputContainer({before:p,disabled:d,hasError:h,input:t.html.input(l.CommonInputAttributes({...y,autocomplete:o,placeholder:m}),t.When(u,()=>t.Fragment(t.attr.type("password")),()=>t.Fragment(t.attr.type("text"))),t.attr.class("bc-input"),t.attr.value(r),c!=null?t.on.blur(t.emitValue(c)):t.Empty,s!=null?t.on.change(t.emitValue(s)):t.Empty,a!=null?t.on.input(t.emitValue(a)):t.Empty),after:i!=null?t.Fragment(w,i):w})})};function O(n){switch(n){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 B(n){switch(n){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function U(n,r,c,s){const a=["bc-notice",`bc-notice--${n}`,`bc-notice--tone-${r}`];return c&&a.push("bc-notice--dismissible"),s&&s.length>0&&a.push(s),a.join(" ")}function P({variant:n="info",tone:r="subtle",role:c,title:s,icon:a,closable:p=!1,onDismiss:i,class:h},...d){const b=t.prop(!0);return t.When(b,()=>{const I=t.Value.map(p,o=>!!o||i!=null),f=t.Value.map(n,o=>o??"info"),y=t.Value.map(r,o=>o??"subtle"),u=t.computedOf(c,f)((o,e)=>o??(e==="danger"?"alert":"status"));return t.Use(l.BeatUII18n,o=>t.html.div(t.attr.class(t.computedOf(f,y,I,h)((e,m,w,g)=>U(e,m,w,g))),t.attr.role(t.Value.map(u,e=>e)),t.Unless(t.Value.map(a,e=>e===!1),()=>t.html.div(t.attr.class("bc-notice__icon"),l.Icon({icon:t.computedOf(a,f)((e,m)=>e===void 0?O(m):String(e)),size:"md",color:t.Value.map(f,B)}))),t.html.div(t.attr.class("bc-notice__body"),t.Ensure(s,e=>t.html.div(t.attr.class("bc-notice__title"),e)),t.html.div(t.attr.class("bc-notice__content"),...d)),t.When(I,()=>C.CloseButton({size:"xs",label:o.$.closeModal,onClick:()=>{b.set(!1),i?.()}}))))})}exports.EmailInput=E;exports.Notice=P;exports.PasswordInput=_;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html as c, attr as n, aria as m, WithElement as v, OnDispose as A } from "@tempots/dom";
|
|
2
|
-
import { B as x } from "./translations-
|
|
2
|
+
import { B as x } from "./translations-DQxouiBG.js";
|
|
3
3
|
const l = [
|
|
4
4
|
"button:not([disabled])",
|
|
5
5
|
'[role="button"]:not([aria-disabled="true"])',
|
|
@@ -803,24 +803,24 @@ function Bt({
|
|
|
803
803
|
};
|
|
804
804
|
}
|
|
805
805
|
const $t = /* @__PURE__ */ Object.assign({
|
|
806
|
-
"./locales/ar.ts": () => import("./ar-
|
|
807
|
-
"./locales/de.ts": () => import("./de-
|
|
808
|
-
"./locales/es.ts": () => import("./es-
|
|
809
|
-
"./locales/fa.ts": () => import("./fa-
|
|
810
|
-
"./locales/fr.ts": () => import("./fr-
|
|
811
|
-
"./locales/he.ts": () => import("./he-
|
|
812
|
-
"./locales/hi.ts": () => import("./hi-
|
|
813
|
-
"./locales/it.ts": () => import("./it-
|
|
814
|
-
"./locales/ja.ts": () => import("./ja-
|
|
815
|
-
"./locales/ko.ts": () => import("./ko-
|
|
816
|
-
"./locales/nl.ts": () => import("./nl-
|
|
817
|
-
"./locales/pl.ts": () => import("./pl-
|
|
818
|
-
"./locales/pt.ts": () => import("./pt-
|
|
819
|
-
"./locales/ru.ts": () => import("./ru-
|
|
820
|
-
"./locales/tr.ts": () => import("./tr-
|
|
821
|
-
"./locales/ur.ts": () => import("./ur-
|
|
822
|
-
"./locales/vi.ts": () => import("./vi-
|
|
823
|
-
"./locales/zh.ts": () => import("./zh-
|
|
806
|
+
"./locales/ar.ts": () => import("./ar-BbgpGwJp.js").then((t) => t.default),
|
|
807
|
+
"./locales/de.ts": () => import("./de-R7lPfyZ4.js").then((t) => t.default),
|
|
808
|
+
"./locales/es.ts": () => import("./es-DV0Jr_BZ.js").then((t) => t.default),
|
|
809
|
+
"./locales/fa.ts": () => import("./fa-DXvHejs9.js").then((t) => t.default),
|
|
810
|
+
"./locales/fr.ts": () => import("./fr-D8FOMX0o.js").then((t) => t.default),
|
|
811
|
+
"./locales/he.ts": () => import("./he-B19Qsx-u.js").then((t) => t.default),
|
|
812
|
+
"./locales/hi.ts": () => import("./hi-DozFnE3b.js").then((t) => t.default),
|
|
813
|
+
"./locales/it.ts": () => import("./it-But8uzNi.js").then((t) => t.default),
|
|
814
|
+
"./locales/ja.ts": () => import("./ja-DkwTnFdU.js").then((t) => t.default),
|
|
815
|
+
"./locales/ko.ts": () => import("./ko-Cqv-IjhX.js").then((t) => t.default),
|
|
816
|
+
"./locales/nl.ts": () => import("./nl-YSiU3rFI.js").then((t) => t.default),
|
|
817
|
+
"./locales/pl.ts": () => import("./pl-DXmHc2Nh.js").then((t) => t.default),
|
|
818
|
+
"./locales/pt.ts": () => import("./pt-Bf3z_-26.js").then((t) => t.default),
|
|
819
|
+
"./locales/ru.ts": () => import("./ru-Sy00qUeG.js").then((t) => t.default),
|
|
820
|
+
"./locales/tr.ts": () => import("./tr-BDxG3qd6.js").then((t) => t.default),
|
|
821
|
+
"./locales/ur.ts": () => import("./ur-55zdT2TQ.js").then((t) => t.default),
|
|
822
|
+
"./locales/vi.ts": () => import("./vi-C7K7W0hM.js").then((t) => t.default),
|
|
823
|
+
"./locales/zh.ts": () => import("./zh-DvJBV9D8.js").then((t) => t.default)
|
|
824
824
|
}), H = Bt({
|
|
825
825
|
defaultLocale: T,
|
|
826
826
|
defaultMessages: M,
|
|
@@ -834,17 +834,17 @@ const $t = /* @__PURE__ */ Object.assign({
|
|
|
834
834
|
export {
|
|
835
835
|
Ft as B,
|
|
836
836
|
Lt as C,
|
|
837
|
-
|
|
837
|
+
Rt as I,
|
|
838
838
|
st as L,
|
|
839
839
|
Ot as T,
|
|
840
840
|
H as a,
|
|
841
841
|
It as b,
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
842
|
+
G as c,
|
|
843
|
+
x as d,
|
|
844
|
+
F as e,
|
|
845
845
|
et as f,
|
|
846
|
-
|
|
847
|
-
|
|
846
|
+
M as g,
|
|
847
|
+
yt as h,
|
|
848
848
|
m as i,
|
|
849
849
|
xt as j,
|
|
850
850
|
Ct as k,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep merge utility for form default values.
|
|
3
|
+
*
|
|
4
|
+
* Merges default values with provided values, where provided values take precedence.
|
|
5
|
+
* Only merges where the provided value is undefined.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Deep merge defaults into a target value.
|
|
9
|
+
*
|
|
10
|
+
* - Provided values take precedence over defaults
|
|
11
|
+
* - Only fills in undefined values from defaults
|
|
12
|
+
* - Recursively merges nested objects
|
|
13
|
+
* - Arrays are NOT merged (provided array replaces default)
|
|
14
|
+
*
|
|
15
|
+
* @param defaults - Default values to use when target values are undefined
|
|
16
|
+
* @param provided - Provided values that take precedence
|
|
17
|
+
* @returns Merged result
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const defaults = { name: 'John', settings: { theme: 'dark', lang: 'en' } }
|
|
22
|
+
* const provided = { settings: { theme: 'light' } }
|
|
23
|
+
* const result = deepMergeDefaults(defaults, provided)
|
|
24
|
+
* // { name: 'John', settings: { theme: 'light', lang: 'en' } }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function deepMergeDefaults<T>(defaults: unknown, provided: T | undefined | null): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './deep-merge';
|
|
@@ -3,4 +3,5 @@ export * from './schema-context';
|
|
|
3
3
|
export * from './controls';
|
|
4
4
|
export * from './json-schema-form';
|
|
5
5
|
export * from './validator';
|
|
6
|
+
export * from './schema-defaults';
|
|
6
7
|
export { type CustomWidgets, type CustomWidgetRegistration, type WidgetFactory, forXUI, forFormat, forTypeAndFormat, } from './widgets/widget-customization';
|
|
@@ -67,15 +67,34 @@ export interface JSONSchemaFormExternalOptions {
|
|
|
67
67
|
export interface JSONSchemaFormProps<T> extends JSONSchemaFormExternalOptions {
|
|
68
68
|
/** The root JSON Schema to render as a form */
|
|
69
69
|
schema: SchemaObject;
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Initial value for the form data.
|
|
72
|
+
*
|
|
73
|
+
* When omitted, the form will be auto-populated from schema defaults:
|
|
74
|
+
* - `default` property values (highest priority)
|
|
75
|
+
* - First item from `examples` array (fallback)
|
|
76
|
+
* - Empty object for object schemas (last resort)
|
|
77
|
+
*
|
|
78
|
+
* When provided, schema defaults are merged with the provided value
|
|
79
|
+
* (provided values take precedence) unless `applySchemaDefaults` is false.
|
|
80
|
+
*/
|
|
81
|
+
initialValue?: Value<T>;
|
|
72
82
|
/** Validation behavior */
|
|
73
83
|
validationMode?: 'onSubmit' | 'eager' | 'onTouched';
|
|
74
84
|
validateDebounceMs?: number;
|
|
75
85
|
/** Custom widgets for form-scoped widget overrides */
|
|
76
86
|
customWidgets?: CustomWidgets;
|
|
87
|
+
/**
|
|
88
|
+
* Whether to automatically populate form values from schema defaults.
|
|
89
|
+
* When true, extracts `default` values (with `examples[0]` as fallback)
|
|
90
|
+
* from the schema and merges them with the provided initialValue.
|
|
91
|
+
* Provided values take precedence over schema defaults.
|
|
92
|
+
*
|
|
93
|
+
* @default true
|
|
94
|
+
*/
|
|
95
|
+
applySchemaDefaults?: boolean;
|
|
77
96
|
}
|
|
78
|
-
export declare function JSONSchemaForm<T>({ schema, initialValue, externalSchemas, refResolver, sanitizeAdditional, validationMode, validateDebounceMs, customWidgets, }: JSONSchemaFormProps<T>, fn: ({ Form, controller, setStatus, }: {
|
|
97
|
+
export declare function JSONSchemaForm<T>({ schema, initialValue, externalSchemas, refResolver, sanitizeAdditional, validationMode, validateDebounceMs, customWidgets, applySchemaDefaults, }: JSONSchemaFormProps<T>, fn: ({ Form, controller, setStatus, }: {
|
|
79
98
|
Form: Renderable;
|
|
80
99
|
controller: Controller<T>;
|
|
81
100
|
setStatus: (result: ControllerValidation) => void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema Default Value Extraction
|
|
3
|
+
*
|
|
4
|
+
* Utilities to recursively extract default values from JSON Schema definitions.
|
|
5
|
+
* Priority order:
|
|
6
|
+
* 1. Explicit `default` property (highest)
|
|
7
|
+
* 2. First item of `examples` array
|
|
8
|
+
* 3. `const` value
|
|
9
|
+
* 4. First `enum` value
|
|
10
|
+
* 5. Smart type-based defaults (computed)
|
|
11
|
+
*/
|
|
12
|
+
import type { JSONSchemaDefinition } from './schema-types';
|
|
13
|
+
/**
|
|
14
|
+
* Extract default values from a JSON Schema definition.
|
|
15
|
+
*
|
|
16
|
+
* Recursively walks the schema and builds an object containing all defined defaults.
|
|
17
|
+
* For object types, extracts defaults only for required properties.
|
|
18
|
+
* For nullable types (union with null), returns null.
|
|
19
|
+
* For arrays with minItems, generates the minimum required items.
|
|
20
|
+
*
|
|
21
|
+
* @param schema - The JSON Schema to extract defaults from
|
|
22
|
+
* @returns The extracted default value, or undefined if none found
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const schema = {
|
|
27
|
+
* type: 'object',
|
|
28
|
+
* properties: {
|
|
29
|
+
* name: { type: 'string' },
|
|
30
|
+
* age: { type: 'integer', minimum: 0, maximum: 120 },
|
|
31
|
+
* active: { type: 'boolean' }
|
|
32
|
+
* },
|
|
33
|
+
* required: ['name', 'age']
|
|
34
|
+
* }
|
|
35
|
+
* const defaults = extractSchemaDefaults(schema)
|
|
36
|
+
* // { name: '', age: 60 } // only required props, smart defaults
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function extractSchemaDefaults(schema: JSONSchemaDefinition): unknown;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Any Control for JSON Structure
|
|
3
|
+
*
|
|
4
|
+
* Handles any type with JSON textarea
|
|
5
|
+
*/
|
|
6
|
+
import { Renderable } from '@tempots/dom';
|
|
7
|
+
import { type Controller } from '../../form';
|
|
8
|
+
import type { StructureContext } from '../structure-context';
|
|
9
|
+
/**
|
|
10
|
+
* Control for any type (JSON textarea)
|
|
11
|
+
*/
|
|
12
|
+
export declare function StructureAnyControl({ ctx, controller, }: {
|
|
13
|
+
ctx: StructureContext;
|
|
14
|
+
controller: Controller<unknown>;
|
|
15
|
+
}): Renderable;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Array Control for JSON Structure
|
|
3
|
+
*
|
|
4
|
+
* Handles array type with items definition and minItems/maxItems constraints
|
|
5
|
+
*/
|
|
6
|
+
import { Renderable } from '@tempots/dom';
|
|
7
|
+
import { ArrayController } from '../../form';
|
|
8
|
+
import type { StructureContext } from '../structure-context';
|
|
9
|
+
/**
|
|
10
|
+
* Control for array type
|
|
11
|
+
*/
|
|
12
|
+
export declare function StructureArrayControl({ ctx, controller, }: {
|
|
13
|
+
ctx: StructureContext;
|
|
14
|
+
controller: ArrayController<unknown[]>;
|
|
15
|
+
}): Renderable;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary Control for JSON Structure
|
|
3
|
+
*
|
|
4
|
+
* Handles binary type with FileInput
|
|
5
|
+
*/
|
|
6
|
+
import { Renderable } from '@tempots/dom';
|
|
7
|
+
import { type Controller } from '../../form';
|
|
8
|
+
import type { StructureContext } from '../structure-context';
|
|
9
|
+
/**
|
|
10
|
+
* Control for binary type
|
|
11
|
+
*/
|
|
12
|
+
export declare function StructureBinaryControl({ ctx, controller, }: {
|
|
13
|
+
ctx: StructureContext;
|
|
14
|
+
controller: Controller<File | undefined>;
|
|
15
|
+
}): Renderable;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boolean Control for JSON Structure
|
|
3
|
+
*
|
|
4
|
+
* Handles boolean type with CheckboxInput
|
|
5
|
+
*/
|
|
6
|
+
import { Renderable } from '@tempots/dom';
|
|
7
|
+
import { type Controller } from '../../form';
|
|
8
|
+
import type { StructureContext } from '../structure-context';
|
|
9
|
+
/**
|
|
10
|
+
* Control for boolean type
|
|
11
|
+
*/
|
|
12
|
+
export declare function StructureBooleanControl({ ctx, controller, }: {
|
|
13
|
+
ctx: StructureContext;
|
|
14
|
+
controller: Controller<boolean | null>;
|
|
15
|
+
}): Renderable;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choice Control for JSON Structure
|
|
3
|
+
*
|
|
4
|
+
* Handles choice type (tagged unions) with:
|
|
5
|
+
* - Dropdown to select which variant to use
|
|
6
|
+
* - Appropriate fields for selected variant
|
|
7
|
+
* - Optional discriminator property support
|
|
8
|
+
* - Tagged union serialization: { choiceName: variantValue }
|
|
9
|
+
*/
|
|
10
|
+
import { Renderable } from '@tempots/dom';
|
|
11
|
+
import type { StructureContext } from '../structure-context';
|
|
12
|
+
import { type Controller } from '../../form';
|
|
13
|
+
/**
|
|
14
|
+
* Control for choice type (tagged unions)
|
|
15
|
+
*/
|
|
16
|
+
export declare function StructureChoiceControl({ ctx, controller, }: {
|
|
17
|
+
ctx: StructureContext;
|
|
18
|
+
controller: Controller<unknown>;
|
|
19
|
+
}): Renderable;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decimal Control for JSON Structure
|
|
3
|
+
*
|
|
4
|
+
* Handles float, double, and decimal types with NumberInput
|
|
5
|
+
*/
|
|
6
|
+
import { Renderable } from '@tempots/dom';
|
|
7
|
+
import { type Controller } from '../../form';
|
|
8
|
+
import type { StructureContext } from '../structure-context';
|
|
9
|
+
import type { FloatType } from '../structure-types';
|
|
10
|
+
/**
|
|
11
|
+
* Control for float/double/decimal types
|
|
12
|
+
*/
|
|
13
|
+
export declare function StructureDecimalControl({ ctx, controller, floatType, }: {
|
|
14
|
+
ctx: StructureContext;
|
|
15
|
+
controller: Controller<number | null>;
|
|
16
|
+
floatType: FloatType;
|
|
17
|
+
}): Renderable;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deprecation utilities for JSON Structure controls
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for displaying deprecation indicators on deprecated fields
|
|
5
|
+
*/
|
|
6
|
+
import { type TNode } from '@tempots/dom';
|
|
7
|
+
/**
|
|
8
|
+
* Create a deprecation indicator badge
|
|
9
|
+
*/
|
|
10
|
+
export declare function DeprecationBadge(): TNode;
|
|
11
|
+
/**
|
|
12
|
+
* Wrap label with deprecation indicator if field is deprecated
|
|
13
|
+
*/
|
|
14
|
+
export declare function withDeprecationBadge(label: string | undefined, isDeprecated: boolean): TNode;
|