@tempots/beatui 0.80.0 → 0.82.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-DwHLVgKj.cjs → ar-D7CXDmVZ.cjs} +1 -1
- package/dist/{ar-Bo_FZZi7.js → ar-nOSKXpIW.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +101 -99
- package/dist/beatui.css +393 -0
- package/dist/beatui.tailwind.css +393 -0
- package/dist/{de-zI5mdV4M.cjs → de-WzsOu9Gn.cjs} +1 -1
- package/dist/{de-CCqwOkqN.js → de-f2xcEb34.js} +1 -1
- package/dist/{deep-merge-1uN6CG6K.js → deep-merge-CiOwVWn8.js} +269 -284
- package/dist/deep-merge-DxZqCkE5.cjs +1 -0
- package/dist/{duration-input-C9kpsw-t.js → duration-input-B3vnnwBZ.js} +30 -29
- package/dist/duration-input-Dg5SX3lM.cjs +1 -0
- package/dist/{es-BF02UrPL.js → es-CDqqzpCw.js} +1 -1
- package/dist/{es-Cw90CAbu.cjs → es-Ds2Xf3wV.cjs} +1 -1
- package/dist/{fa-DPQV4YB8.js → fa-C7tE_hR3.js} +1 -1
- package/dist/{fa-B4lssnzR.cjs → fa-Ct1UtDB7.cjs} +1 -1
- package/dist/{fr-1Kd6z1F-.cjs → fr-CzAkRFed.cjs} +1 -1
- package/dist/{fr-dmxPhwkD.js → fr-yOW_68YY.js} +1 -1
- package/dist/{he-BtQbrVt3.js → he-D2oUloCJ.js} +1 -1
- package/dist/{he-CJ3XnuPm.cjs → he-DlXALrK7.cjs} +1 -1
- package/dist/{hi-BpfnFKHp.cjs → hi-3dBhLwDs.cjs} +1 -1
- package/dist/{hi-D_Le4Yka.js → hi-D5ZlZoQq.js} +1 -1
- package/dist/{index-CfaWytS2.cjs → index-C5YCCgnn.cjs} +1 -1
- package/dist/{index-K6u33-GC.cjs → index-ChsRjiIp.cjs} +17 -17
- package/dist/{index-CGEzILlC.js → index-CiAVfKIZ.js} +1 -1
- package/dist/{index-YtW7SCWB.js → index-DT6-HMMz.js} +8 -7
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +296 -291
- package/dist/{it-DyHjSuHN.js → it-6e6X-4BB.js} +1 -1
- package/dist/{it-COCZ9NyB.cjs → it-DohtcWi9.cjs} +1 -1
- package/dist/{ja-X43lABza.js → ja-BxNuNo2H.js} +1 -1
- package/dist/{ja--NdggLU9.cjs → ja-eyTArrgS.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -8
- package/dist/json-schema/index.es.js +1391 -7471
- package/dist/json-schema-display/index.cjs.js +1 -0
- package/dist/json-schema-display/index.es.js +846 -0
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +89 -87
- package/dist/{ko-BUvb0ggK.cjs → ko-BFLCDMMs.cjs} +1 -1
- package/dist/{ko-B9g9iw99.js → ko-Ch0jFsBV.js} +1 -1
- package/dist/modal-D2xE47kr.cjs +1 -0
- package/dist/{modal-CSHIhHvI.js → modal-hkQD1bqZ.js} +22 -21
- package/dist/{nl-0S25Gsld.cjs → nl-Bx2ACvr4.cjs} +1 -1
- package/dist/{nl-Ew5jnSsT.js → nl-NuTdZO1s.js} +1 -1
- package/dist/notice-C0SmlheE.cjs +1 -0
- package/dist/{notice-C-964yaY.js → notice-CZHWWwOQ.js} +52 -51
- package/dist/oneof-branch-detection-BVNoKU9d.js +6281 -0
- package/dist/oneof-branch-detection-C8g3eWnx.cjs +8 -0
- package/dist/{pl-C9f6UBSe.js → pl-Bs4nLJ__.js} +1 -1
- package/dist/{pl-B3k-K3S4.cjs → pl-QHl6sl8f.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-DYtAvbrw.js → pt-BETjHZrL.js} +1 -1
- package/dist/{pt-CKoikRO5.cjs → pt-DZGw2Z-1.cjs} +1 -1
- package/dist/{ru-ZexN-b8V.js → ru-Bi1_DEKM.js} +1 -1
- package/dist/{ru-COb7RSDt.cjs → ru-D03IuLqh.cjs} +1 -1
- package/dist/stack-BJgsPJ9A.js +873 -0
- package/dist/stack-DcZ_u50f.cjs +1 -0
- package/dist/string-B9vVyfq3.cjs +1 -0
- package/dist/string-DYyMxBl-.js +19 -0
- package/dist/text-input-CByq5OIo.cjs +1 -0
- package/dist/text-input-CFJntP7G.js +287 -0
- package/dist/{toolbar-DNpBIoJo.js → toolbar-DR2Zd4Oo.js} +1 -1
- package/dist/toolbar-TPWYzoiF.cjs +1 -0
- package/dist/{tr-tO_EH-Y2.cjs → tr-B_-_1wua.cjs} +1 -1
- package/dist/{tr-BDvn05-H.js → tr-DiYB-FwX.js} +1 -1
- package/dist/translations-B4-Zd2LM.cjs +1 -0
- package/dist/translations-Cq8bUKJP.js +584 -0
- package/dist/{translations-DwGC_94w.cjs → translations-D62qqNV9.cjs} +1 -1
- package/dist/{translations-CfWR4loD.js → translations-DPr6c05Z.js} +1 -1
- package/dist/types/components/json-schema/schema-conditionals.d.ts +11 -0
- package/dist/types/components/json-schema/schema-context.d.ts +1 -1
- package/dist/types/components/json-schema-display/display-widget-customization.d.ts +61 -0
- package/dist/types/components/json-schema-display/display-wrapper.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/any-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/array-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/boolean-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/composition-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/enum-const-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/generic-display.d.ts +18 -0
- package/dist/types/components/json-schema-display/displays/null-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/number-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/object-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/string-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/index.d.ts +14 -0
- package/dist/types/components/json-schema-display/json-schema-display.d.ts +25 -0
- package/dist/types/components/json-schema-display/mismatch.d.ts +14 -0
- package/dist/types/json-schema-display/index.d.ts +1 -0
- package/dist/{ur-DbEqQgS6.js → ur-B69X-xNs.js} +1 -1
- package/dist/{ur-BbnYJ3HS.cjs → ur-DyUSmIbo.cjs} +1 -1
- package/dist/use-form-CgZyrACX.js +864 -0
- package/dist/use-form-JjeKCINk.cjs +2 -0
- package/dist/utils-DEbsp9Q9.js +129 -0
- package/dist/utils-DIUEhA-Z.cjs +1 -0
- package/dist/{vi-CpZUeuSj.js → vi-BdzxA60L.js} +1 -1
- package/dist/{vi-ByBwvGQY.cjs → vi-CBmPaHxg.cjs} +1 -1
- package/dist/widget-customization-DRA7E9Zf.js +1072 -0
- package/dist/widget-customization-G-QLB1rw.cjs +1 -0
- package/dist/{zh-DnxK0ieB.cjs → zh-Cb1b8uik.cjs} +1 -1
- package/dist/{zh-DJyhKO0I.js → zh-Dn1UJiZa.js} +1 -1
- package/package.json +13 -7
- package/dist/deep-merge-CBIkQM4E.cjs +0 -1
- package/dist/duration-input-DHWhQJnn.cjs +0 -1
- package/dist/modal-cc8Ehngz.cjs +0 -1
- package/dist/notice-C_BWqu2K.cjs +0 -1
- package/dist/toolbar-D5FcnRju.cjs +0 -1
- package/dist/translations-0tLX4x7M.js +0 -866
- package/dist/translations-WPN3ibDg.cjs +0 -1
- package/dist/use-form-D4JFOcjo.cjs +0 -2
- package/dist/use-form-D4rqJkvG.js +0 -1731
- package/dist/widget-customization-BSjJz3_Y.js +0 -1195
- package/dist/widget-customization-CrFVrt4V.cjs +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("@tempots/dom"),E=require("./translations-B4-Zd2LM.cjs"),P=require("./text-input-CByq5OIo.cjs"),m=require("./stack-DcZ_u50f.cjs"),j=new Map;function I(n){const t=j.get(n)??0;return j.set(n,t+1),`${n}-${t}`}const C=(n,t)=>n===t||n!==n&&t!==t;function J({size:n="sm",icon:t="line-md:close",disabled:s,roundedness:i="full",color:r="base",onClick:o,label:l},...a){return e.Use(E.BeatUII18n,c=>{const d=e.coalesce(l,c.$.closeModal);return P.Button({variant:"text",size:n,roundedness:i,disabled:s,color:r,onClick:o},e.attr.title(d),e.aria.label(d),...a,E.Icon({icon:t,size:n??"sm"}))})}const Q=n=>{const{value:t,onBlur:s,onChange:i,placeholder:r,disabled:o,id:l,checkedIcon:a,uncheckedIcon:c,iconSize:d="lg"}=n,h=l??I("checkbox"),p=`${h}-label`,g=()=>{if(e.Value.get(o??!1))return;const u=e.Value.get(t);i?.(!u)},y=u=>{e.Value.get(o??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),g())};return P.InputContainer({baseContainer:!0,growInput:!1,...n,input:e.html.span(e.attr.class("bc-checkbox-input"),e.html.span(e.attr.class("bc-checkbox-input__checkbox"),e.attr.class(e.Value.map(t,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),e.attr.class(e.Value.map(o??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),e.attr.id(h),e.attr.role("checkbox"),e.attr.tabindex(e.Value.map(o??!1,u=>u?-1:0)),e.aria.checked(t),e.aria.disabled(o),r!=null?e.aria.labelledby(p):e.Empty,e.on.keydown(y),s!=null?e.on.blur(s):e.Empty,E.Icon({icon:e.computedOf(t,a,c)((u,f,v)=>u?f??"akar-icons/check-box-fill":v??"akar-icons/box"),accessibility:"decorative",size:d})),r!=null?e.html.label(e.attr.class("bc-checkbox-input__label"),e.attr.id(p),e.attr.for(h),m.MutedLabel(r)):e.Empty)},e.on.click(g))},$=e.html.span(e.attr.class("bc-input-wrapper__required")," *");function X(n){const t=["bc-input-wrapper"];return n!=="vertical"&&t.push(`bc-input-wrapper--${n}`),t.join(" ")}function Y(n,t){const s=["bc-input-wrapper__label-text"];return n?s.push("bc-input-wrapper__label-text--error"):t?s.push("bc-input-wrapper__label-text--disabled"):s.push("bc-input-wrapper__label-text--default"),s.join(" ")}function Z(n,t){if(n==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const M=({fullWidth:n=!1,required:t,label:s,labelChildren:i,context:r,description:o,content:l,error:a,labelFor:c,hasError:d,disabled:h,layout:p,labelWidth:g},...y)=>{const u=d??a!=null,f=h??!1,v=p??"vertical",D=I("input-wrapper"),_=o?`${D}-description`:void 0,V=a!=null?`${D}-error`:void 0,B=e.computedOf(v)(b=>b!=="vertical"),G=e.computedOf(v,g??void 0)((b,w)=>Z(b,w));return e.html.div(e.attr.class(e.Value.map(v,b=>X(b))),e.attr.class(e.Value.map(n,b=>b?"bc-input-wrapper--full-width":"")),e.attr.style(G),s!=null||r!=null?e.html.div(e.attr.class("bc-input-wrapper__header"),e.html.div(e.attr.class("bc-input-wrapper__label-section"),e.html.label(e.attr.class("bc-input-wrapper__label"),c!=null?e.attr.for(c):e.Empty,e.html.span(e.attr.class(e.computedOf(u,f)((b,w)=>Y(b??!1,w??!1))),s),s!=null&&t?$:e.Empty),e.When(e.computedOf(B,o)((b,w)=>b&&w!=null),()=>e.html.div(e.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),e.attr.id(_),o))),r!=null?m.Label(r):e.Empty,i):e.Empty,e.html.div(e.attr.class("bc-input-wrapper__content"),[_,V].filter(Boolean).length>0?e.dataAttr.describedby([_,V].filter(Boolean).join(" ")):e.Empty,t?e.dataAttr.required("true"):e.Empty,e.When(u,()=>e.dataAttr.invalid("true")),l),e.When(e.computedOf(B,o)((b,w)=>!b&&w!=null),()=>e.html.div(e.attr.class("bc-input-wrapper__description"),e.attr.id(_),o)),e.When(u,()=>e.html.div(e.attr.class("bc-input-wrapper__error"),e.attr.id(V),e.aria.live("polite"),e.attr.role("alert"),a)),...y)},H=((n,t)=>()=>{n.markTouched(),t?.()}),O=(n,t)=>s=>{n.change(s),t?.(s)};function A(n,t){const{controller:s,onBlur:i,onChange:r,id:o,triggerOn:l,...a}=t;return n({id:o??s.name,disabled:s.disabled,value:s.signal,hasError:s.errorVisible,name:s.name,...a,onInput:l==="input"?O(s,r):void 0,onChange:l!=="input"?O(s,r):void 0,onBlur:H(s,i)})}function tt(n,{id:t,labelFor:s,...i},...r){const o=t??i.controller.name??I("control"),l=s??o;return M({...i,hasError:i.controller.errorVisible,error:e.TextNode(i.controller.error.map(a=>a??"")),labelFor:l,content:A(a=>n({...a,id:o}),i)},...r)}function F(n,t){const{toInput:s,fromInput:i,controller:r,...o}=t,l=r.transform(s,i);return A(n,{...o,controller:l})}function et(n,{id:t,labelFor:s,...i},...r){const o=t??i.controller.name??I("control");return M({...i,labelFor:s??o,content:F(n,{...i,id:o})},...r)}function st(n){return n.split(".").map(s=>{const i=s.match(/^\[(\d+)\]$/);return i?Number(i[1]):s})}function W(n){return typeof n=="number"?`[${n}]`:`.${n}`}function N(n){if(n.length===0)return"";const[t,...s]=n;return[typeof t=="number"?`[${t}]`:t,...s.map(W)].join("")}const nt={valid:m.i.valid,invalid(n){return m.i.invalid({message:n})},invalidFields(n){const t={};for(const[s,i]of Object.entries(n))t[s]=typeof i=="string"?{message:i}:i;return m.i.invalid({dependencies:t})},fromError(n){return m.i.invalid(n)}};function T(n){return function(s){if(s.type==="valid")return s;let i=s.error;for(const r of n)if(i=i?.dependencies?.[r],i==null)return m.i.valid;return m.i.invalid(i)}}class k{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#t={disabled:e.prop(!1),touched:e.prop(!1)};#s;#e=e.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,s,i,r,o,l=C){this.path=t,this.change=s,this.signal=i,this.status=r,this.#s=l,this.#e.set(i.value),this.error=r.map(a=>a?.type==="invalid"?a.error?.message:void 0),this.hasError=this.error.map(a=>a!=null),this.touched=this.#t.touched,o.validationMode?this.errorVisible=e.computedOf(this.hasError,this.touched,o.validationMode)((a,c,d)=>d==="eager"?!!a:!!a&&!!c):this.errorVisible=e.computedOf(this.hasError,this.touched)((a,c)=>!!a&&!!c),this.dirty=e.computedOf(this.signal,this.#e)((a,c)=>!this.#s(a,c)),this.dependencyErrors=r.map(a=>a?.type==="invalid"?a.error?.dependencies:void 0),this.parent=o,this.disabled=e.computedOf(this.#t.disabled,o.disabled)((a,c)=>a||c),this.disabledOrHasErrors=e.computedOf(this.disabled,this.hasError)((a,c)=>a||c),this.onDispose(()=>{this.#t.disabled.dispose(),this.#t.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#e.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return N(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(s){console.error("Error in dispose callback:",s)}this.#n.length=0};setDisabled=t=>{this.#t.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#t.touched.set(!0)};resetTouched=()=>{this.#t.touched.set(!1)};markPristine=()=>{this.#e.set(this.signal.value)};reset=()=>{this.change(this.#e.value)};array=(t=C)=>new q(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=C)=>new z(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,s,i=[],r=C)=>new k([...this.path,...i],o=>this.change(s(o)),this.signal.map(t,r),this.status.map(T(i)),this.parent,r);asyncTransform=(t,s,i,r=[],o=C)=>new k([...this.path,...r],l=>{s(l).then(a=>this.change(a))},this.signal.mapAsync(t,i,void 0,o),this.status.map(T(r)),this.parent,o)}class z extends k{#t=new Map;#s=new Map;#e=new Map;#n=e.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=e.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let t=!1;for(const s of this.#s.values())if(s){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,s,i,r,o,l){super(t,s,i.map(c=>c??{},l),r,o,l),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const a=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const c of this.#t.values())c.dispose();this.#t.clear();for(const c of this.#e.values())c();this.#e.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#i.values())c();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),a()})}field=t=>{if(this.#t.has(t))return this.#t.get(t);const s=async l=>{this.change({...this.signal.value,[t]:l})},i=new k([...this.path,t],s,this.signal.map(l=>l[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#t.set(t,i);const r=i.touched.on(l=>{this.#s.set(t,l),this.#l()});this.#e.set(t,r);const o=i.dirty.on(l=>{this.#r.set(t,l),this.#a()});return this.#i.set(t,o),i};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const s of Object.keys(t))this.field(s).markTouched();for(const s of this.#t.values())s.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const s of Object.keys(t))this.field(s).markPristine?.();for(const s of this.#t.values())s.markPristine?.()};#a=()=>{let t=!1;for(const s of this.#r.values())if(s){t=!0;break}this.#o.set(this.dirty.value||t)}}class q extends k{#t=new Array;length;#s=new Map;#e=new Map;#n=e.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=e.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let t=!1;for(const s of this.#s.values())if(s){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,s,i,r,o,l){const a=i.map(h=>h??[],l);super(t,s,a,r,o,l);const c=a.on(h=>{const p=this.#t.length-h.length;p>0&&(this.#t.splice(h.length,p).forEach((g,y)=>{const u=h.length+y;g.dispose(),this.#e.get(u)?.(),this.#e.delete(u),this.#s.delete(u),this.#i.get(u)?.(),this.#i.delete(u),this.#r.delete(u)}),this.#l(),this.#a())});this.length=a.map(h=>h.length),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const d=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const h of this.#t)h.dispose();this.length.dispose(),this.#t.length=0,c(),a.dispose();for(const h of this.#e.values())h();this.#e.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#i.values())h();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),d()})}item=t=>{if(this.#t[t])return this.#t[t];const s=async l=>{const a=this.signal.value.slice();a[t]=l,this.change(a)},i=new k([...this.path,t],s,this.signal.map(l=>l[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#t[t]=i;const r=i.touched.on(l=>{this.#s.set(t,l),this.#l()});this.#e.set(t,r);const o=i.dirty.on(l=>{this.#r.set(t,l),this.#a()});return this.#i.set(t,o),i};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,s)=>{const i=this.signal.value.slice();i.splice(t,s),this.change(i)};move=(t,s,i=1)=>{if(i<1||t===s)return;const r=this.signal.value.slice(),o=r.splice(t,i);r.splice(s,0,...o),this.change(r)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let s=0;s<t;s++)this.item(s).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let s=0;s<t;s++)this.item(s).markPristine?.()};#a=()=>{let t=!1;for(const s of this.#r.values())if(s){t=!0;break}this.#o.set(this.dirty.value||t)}}function L(n){function t(s){return typeof s=="number"?s:s.toString()}return n.map(s=>typeof s=="object"&&s.key!=null?t(s.key):t(s))}function R(n){const t=n.filter(r=>r.path==null||r.path.length===0).map(r=>r.message),s=n.filter(r=>r.path!=null&&r.path.length>0).reduce((r,o)=>{const l=L(o.path),a=l.pop();let c=r;for(const d of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[d]==null&&(c.dependencies[d]={}),c=c.dependencies[d];return c.dependencies==null&&(c.dependencies={}),c.dependencies[a]={message:o.message},r},{}),i=t.join(`
|
|
2
|
+
`);return{...s,message:i!=""?i:void 0}}function U({initialValue:n,onChange:t,validate:s,equals:i,validationMode:r,validateDebounceMs:o}){const l=e.Value.deriveProp(n),a=e.prop(m.i.valid),c=e.prop(!1),d=e.prop(r??"onTouched"),h=f=>{a.set(f)};let p;const g=async f=>{if(s!=null){const v=await s(f);h(v)}},y=async f=>{l.set(f),t?.(f);const v=d.value;if(s!=null){if(v==="onSubmit")return;const D=o??0;D>0?(p&&clearTimeout(p),p=setTimeout(()=>{g(f)},D)):await g(f)}},u=new k([],y,l,a,{disabled:c,validationMode:d},i??C);return u.onDispose(()=>{c.dispose(),l.dispose(),a.dispose(),d.dispose(),p&&clearTimeout(p)}),{controller:u,setStatus:h}}function x(n){return e.Fragment(e.attr.disabled(n.disabled),e.attr.name(n.name))}function it(n,{triggerOn:t="change"}={}){return e.Fragment(x(n),e.attr.value(n.signal),(t==="input"?e.on.input:e.on.change)(e.emitValue(n.change)))}function rt(n,{triggerOn:t="change"}={}){return e.Fragment(x(n),e.attr.valueAsNumber(n.signal),(t==="input"?e.on.input:e.on.change)(e.emitValueAsNumber(n.change)))}function S(n){return n.issues!=null?m.i.invalid(R(n.issues)):m.i.valid}async function at({task:n,errorMessage:t,errorPath:s=["root"],validation:i}){try{const r=await n();return i!=null?i(r):m.i.valid}catch(r){const o=t??(r instanceof Error?r.message:"Operation failed");return s.length===1&&s[0]==="root"?m.i.invalid({message:o}):m.i.invalid({dependencies:K(s,o)})}}function K(n,t){if(n.length===1)return{[n[0]]:{message:t}};const[s,...i]=n;return{[s]:{dependencies:K(i,t)}}}function ot({initialValue:n={},schema:t,onSubmit:s=async()=>m.i.valid,validationMode:i,validateDebounceMs:r}){const{controller:o,setStatus:l}=U({initialValue:n,validationMode:i??"onTouched",validateDebounceMs:r,validate:(i??"onTouched")==="onSubmit"||t==null?void 0:async h=>S(await t["~standard"].validate(h))}),a=e.prop(!1),c=o.object();return c.onDispose(a.dispose),{controller:c,setStatus:l,submit:async h=>{if(a.set(!0),h?.preventDefault(),c.markAllTouched(),t!=null){const g=c.signal.value,y=S(await t["~standard"].validate(g));if(l(y),y.type==="invalid"){a.set(!1);return}}const p=await s(c.signal.value);a.set(!1),p.type==="invalid"&&l(p)},submitting:a}}exports.ArrayController=q;exports.BaseControl=A;exports.BaseMappedControl=F;exports.CheckboxInput=Q;exports.CloseButton=J;exports.Control=tt;exports.Controller=k;exports.ControllerValidation=nt;exports.InputWrapper=M;exports.MappedControl=et;exports.O=C;exports.ObjectController=z;exports.RequiredSymbol=$;exports.connectCommonAttributes=x;exports.connectNumberInput=rt;exports.connectStringInput=it;exports.convertStandardSchemaIssues=R;exports.convertStandardSchemaPathToPath=L;exports.makeMapValidation=T;exports.makeOnBlurHandler=H;exports.makeOnChangeHandler=O;exports.parsePath=st;exports.pathToString=N;exports.sessionId=I;exports.standardSchemaResultToValidation=S;exports.taskToValidation=at;exports.useController=U;exports.useForm=ot;exports.wrapSegment=W;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { html as n, attr as i, computedOf as l } from "@tempots/dom";
|
|
2
|
+
function g(e, r, t) {
|
|
3
|
+
const u = ["bc-card"];
|
|
4
|
+
return e !== "default" && u.push(`bc-card--${e}`), r !== "md" && u.push(`bc-card--padding-${r}`), t !== "lg" && u.push(`bc-card--rounded-${t}`), u.join(" ");
|
|
5
|
+
}
|
|
6
|
+
function y({ variant: e = "default", size: r = "md", roundedness: t = "lg" } = {}, ...u) {
|
|
7
|
+
return n.div(
|
|
8
|
+
i.class(
|
|
9
|
+
l(
|
|
10
|
+
e,
|
|
11
|
+
r,
|
|
12
|
+
t
|
|
13
|
+
)(
|
|
14
|
+
(c, s, o) => g(
|
|
15
|
+
c ?? "default",
|
|
16
|
+
s ?? "md",
|
|
17
|
+
o ?? "lg"
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
),
|
|
21
|
+
...u
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
const a = ["description", "comment", "notes", "text"];
|
|
25
|
+
function p(e) {
|
|
26
|
+
if (typeof e == "boolean") return a;
|
|
27
|
+
const r = e["x:ui"];
|
|
28
|
+
return r && Array.isArray(r.textAreaTriggers) ? [...a, ...r.textAreaTriggers] : a;
|
|
29
|
+
}
|
|
30
|
+
function d(e) {
|
|
31
|
+
if (typeof e == "boolean") return;
|
|
32
|
+
const r = e["x:ui"];
|
|
33
|
+
if (r != null && (typeof r == "string" || typeof r == "object" && r !== null))
|
|
34
|
+
return r;
|
|
35
|
+
}
|
|
36
|
+
function x(e, r) {
|
|
37
|
+
if (typeof e == "boolean") return;
|
|
38
|
+
const t = d(e);
|
|
39
|
+
if (typeof t == "object" && typeof t.widget == "string")
|
|
40
|
+
return {
|
|
41
|
+
widget: t.widget,
|
|
42
|
+
source: "explicit-widget",
|
|
43
|
+
options: t
|
|
44
|
+
};
|
|
45
|
+
const u = typeof t == "string" ? t : typeof t == "object" && typeof t.format == "string" ? t.format : void 0;
|
|
46
|
+
if (u)
|
|
47
|
+
return {
|
|
48
|
+
widget: u,
|
|
49
|
+
source: "explicit-format",
|
|
50
|
+
options: typeof t == "object" ? t : void 0
|
|
51
|
+
};
|
|
52
|
+
if (typeof e.format == "string")
|
|
53
|
+
return {
|
|
54
|
+
widget: {
|
|
55
|
+
datetime: "date-time",
|
|
56
|
+
base64: "binary",
|
|
57
|
+
bytes: "binary",
|
|
58
|
+
iri: "uri",
|
|
59
|
+
"iri-reference": "uri-reference",
|
|
60
|
+
"idn-hostname": "hostname"
|
|
61
|
+
}[e.format] || e.format,
|
|
62
|
+
source: "schema-format"
|
|
63
|
+
};
|
|
64
|
+
if (e.contentMediaType === "text/markdown")
|
|
65
|
+
return {
|
|
66
|
+
widget: "markdown",
|
|
67
|
+
source: "schema-media"
|
|
68
|
+
};
|
|
69
|
+
if (e.contentMediaType != null || e.contentEncoding === "base64")
|
|
70
|
+
return {
|
|
71
|
+
widget: "binary",
|
|
72
|
+
source: "schema-media",
|
|
73
|
+
options: {
|
|
74
|
+
mediaType: e.contentMediaType,
|
|
75
|
+
encoding: e.contentEncoding
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
if (e.enum != null)
|
|
79
|
+
return {
|
|
80
|
+
widget: "enum",
|
|
81
|
+
source: "constraints"
|
|
82
|
+
};
|
|
83
|
+
if (e.const != null)
|
|
84
|
+
return {
|
|
85
|
+
widget: "const",
|
|
86
|
+
source: "constraints"
|
|
87
|
+
};
|
|
88
|
+
if ((e.type === "number" || e.type === "integer" || Array.isArray(e.type) && e.type.some((s) => s === "number" || s === "integer")) && e.minimum != null && e.maximum != null)
|
|
89
|
+
return e.maximum - e.minimum <= 5 && e.minimum >= 0 && e.minimum <= 1 && (e.multipleOf == null || e.multipleOf >= 1) ? {
|
|
90
|
+
widget: "rating",
|
|
91
|
+
source: "constraints",
|
|
92
|
+
options: { max: e.maximum }
|
|
93
|
+
} : {
|
|
94
|
+
widget: "slider",
|
|
95
|
+
source: "constraints",
|
|
96
|
+
options: {
|
|
97
|
+
min: e.minimum,
|
|
98
|
+
max: e.maximum,
|
|
99
|
+
step: e.multipleOf
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
if (e.type === "string") {
|
|
103
|
+
if (e.minLength != null && e.minLength > 20 || e.maxLength != null && e.maxLength > 100)
|
|
104
|
+
return {
|
|
105
|
+
widget: "textarea",
|
|
106
|
+
source: "heuristics"
|
|
107
|
+
};
|
|
108
|
+
if (r) {
|
|
109
|
+
const s = r.toLowerCase();
|
|
110
|
+
if (s.includes("password") || s.includes("secret"))
|
|
111
|
+
return { widget: "password", source: "heuristics" };
|
|
112
|
+
if (s.includes("email"))
|
|
113
|
+
return { widget: "email", source: "heuristics" };
|
|
114
|
+
if (s.includes("url") || s.includes("link"))
|
|
115
|
+
return { widget: "url", source: "heuristics" };
|
|
116
|
+
if (s.includes("color"))
|
|
117
|
+
return { widget: "color", source: "heuristics" };
|
|
118
|
+
if (p(e).some(
|
|
119
|
+
(m) => s.includes(m.toLowerCase())
|
|
120
|
+
))
|
|
121
|
+
return { widget: "textarea", source: "heuristics" };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
y as C,
|
|
127
|
+
d as g,
|
|
128
|
+
x as r
|
|
129
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("@tempots/dom");function l(e,r,t){const u=["bc-card"];return e!=="default"&&u.push(`bc-card--${e}`),r!=="md"&&u.push(`bc-card--padding-${r}`),t!=="lg"&&u.push(`bc-card--rounded-${t}`),u.join(" ")}function g({variant:e="default",size:r="md",roundedness:t="lg"}={},...u){return c.html.div(c.attr.class(c.computedOf(e,r,t)((o,s,m)=>l(o??"default",s??"md",m??"lg"))),...u)}const a=["description","comment","notes","text"];function p(e){if(typeof e=="boolean")return a;const r=e["x:ui"];return r&&Array.isArray(r.textAreaTriggers)?[...a,...r.textAreaTriggers]:a}function n(e){if(typeof e=="boolean")return;const r=e["x:ui"];if(r!=null&&(typeof r=="string"||typeof r=="object"&&r!==null))return r}function d(e,r){if(typeof e=="boolean")return;const t=n(e);if(typeof t=="object"&&typeof t.widget=="string")return{widget:t.widget,source:"explicit-widget",options:t};const u=typeof t=="string"?t:typeof t=="object"&&typeof t.format=="string"?t.format:void 0;if(u)return{widget:u,source:"explicit-format",options:typeof t=="object"?t:void 0};if(typeof e.format=="string")return{widget:{datetime:"date-time",base64:"binary",bytes:"binary",iri:"uri","iri-reference":"uri-reference","idn-hostname":"hostname"}[e.format]||e.format,source:"schema-format"};if(e.contentMediaType==="text/markdown")return{widget:"markdown",source:"schema-media"};if(e.contentMediaType!=null||e.contentEncoding==="base64")return{widget:"binary",source:"schema-media",options:{mediaType:e.contentMediaType,encoding:e.contentEncoding}};if(e.enum!=null)return{widget:"enum",source:"constraints"};if(e.const!=null)return{widget:"const",source:"constraints"};if((e.type==="number"||e.type==="integer"||Array.isArray(e.type)&&e.type.some(s=>s==="number"||s==="integer"))&&e.minimum!=null&&e.maximum!=null)return e.maximum-e.minimum<=5&&e.minimum>=0&&e.minimum<=1&&(e.multipleOf==null||e.multipleOf>=1)?{widget:"rating",source:"constraints",options:{max:e.maximum}}:{widget:"slider",source:"constraints",options:{min:e.minimum,max:e.maximum,step:e.multipleOf}};if(e.type==="string"){if(e.minLength!=null&&e.minLength>20||e.maxLength!=null&&e.maxLength>100)return{widget:"textarea",source:"heuristics"};if(r){const s=r.toLowerCase();if(s.includes("password")||s.includes("secret"))return{widget:"password",source:"heuristics"};if(s.includes("email"))return{widget:"email",source:"heuristics"};if(s.includes("url")||s.includes("link"))return{widget:"url",source:"heuristics"};if(s.includes("color"))return{widget:"color",source:"heuristics"};if(p(e).some(i=>s.includes(i.toLowerCase())))return{widget:"textarea",source:"heuristics"}}}}exports.Card=g;exports.getXUIConfig=n;exports.resolveWidget=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./translations-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./translations-B4-Zd2LM.cjs"),h={loadingExtended:"Đang tải, vui lòng đợi",loadingShort:"Đang tải...",locale:"Ngôn ngữ",iconDescription:"Biểu tượng",loadingIcon:"Biểu tượng tải",failedToLoadIcon:"Không thể tải biểu tượng",editLabel:"Chỉnh sửa",selectOne:"Chọn một",selectNone:"Không có",selectMany:"Chọn nhiều",noResults:"Không có kết quả",passwordPlaceholderText:"Mật khẩu bí mật",togglePasswordVisibility:"Chuyển đổi hiển thị mật khẩu",toggleMenu:"Chuyển đổi menu",toggleAside:"Chuyển đổi bảng bên",mainNavigation:"Điều hướng chính",sidebar:"Thanh bên",closeDrawer:"Đóng ngăn kéo",closeModal:"Đóng modal",confirm:"Xác nhận",cancel:"Hủy",addLabel:"Thêm",removeItem:"Xóa mục",currentLocale:"Tiếng Việt",ar:"Tiếng Ả Rập",de:"Tiếng Đức",en:"Tiếng Anh",es:"Tiếng Tây Ban Nha",fr:"Tiếng Pháp",hi:"Tiếng Hindi",it:"Tiếng Ý",ja:"Tiếng Nhật",ko:"Tiếng Hàn",nl:"Tiếng Hà Lan",pl:"Tiếng Ba Lan",pt:"Tiếng Bồ Đào Nha",ru:"Tiếng Nga",tr:"Tiếng Thổ Nhĩ Kỳ",vi:"Tiếng Việt",zh:"Tiếng Trung",he:"Tiếng Do Thái",fa:"Tiếng Ba Tư",ur:"Tiếng Urdu",emailPlaceholderText:"Nhập email của bạn",incrementValue:"Tăng giá trị",decrementValue:"Giảm giá trị",dropZoneInstructions:n=>n?"Nhấp để chọn hoặc kéo tệp vào đây, hoặc nhấn Enter hoặc Space để mở trình chọn tệp":"Kéo tệp vào đây",fileSizeUnits:["Byte","KB","MB","GB","TB"],removeFile:"Xóa tệp",clearAllFiles:"Xóa tất cả tệp",clearValue:"Xóa giá trị",unknownType:"Loại không xác định",filesInputInstructions:(n,i,e)=>{let o=n==null||n>1?"Nhấp để chọn hoặc kéo tệp vào đây":"Nhấp để chọn hoặc kéo một tệp vào đây";if(n||i){const t=[];if(n!=null&&n>1&&t.push(`tối đa ${n} tệp`),i&&e){const l=a.formatFileSize(i,{units:e});t.push(`mỗi tệp tối đa ${l}`)}t.length>0&&(o+=` (${t.join(", ")})`)}return o},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:n=>`Heading ${n}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"Đang tải PDF...",loadFailed:"Không thể tải PDF",invalidPdf:"Tệp PDF không hợp lệ",pageOutOfRange:(n,i)=>`Trang ${n} nằm ngoài phạm vi (1-${i})`,renderFailed:"Không thể hiển thị trang PDF"}};exports.default=h;
|