@tempots/beatui 0.76.0 → 0.78.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-CefikVG3.cjs → ar-DNoFBb9J.cjs} +1 -1
- package/dist/{ar-BbgpGwJp.js → ar-D__6gR_P.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +5 -5
- package/dist/beatui.css +11 -2
- package/dist/beatui.tailwind.css +11 -2
- package/dist/{colors-B9fcMxa_.cjs → colors-B2yrgHSW.cjs} +1 -1
- package/dist/{colors-pQZlNrwM.js → colors-DPo9GEJR.js} +6 -6
- package/dist/{de-ZRnkggf5.cjs → de-AwUkK0rS.cjs} +1 -1
- package/dist/{de-R7lPfyZ4.js → de-DmKpCTuQ.js} +1 -1
- package/dist/deep-merge-BoJqJNah.cjs +1 -0
- package/dist/{deep-merge-CQQCMLwG.js → deep-merge-Cjm-tFVT.js} +224 -226
- package/dist/{duration-input-D-SIoDoo.cjs → duration-input-COTlyMwv.cjs} +1 -1
- package/dist/{duration-input-DKxZ6OCa.js → duration-input-DfdE7_V9.js} +3 -3
- package/dist/{es-DV0Jr_BZ.js → es-BDZ5UJLS.js} +1 -1
- package/dist/{es-IkNtVSp2.cjs → es-D-d2AIlX.cjs} +1 -1
- package/dist/{fa-DXvHejs9.js → fa-CuPgy1cj.js} +1 -1
- package/dist/{fa-B-byOhgU.cjs → fa-D7rRdG8c.cjs} +1 -1
- package/dist/{fr-F0ZegdR2.cjs → fr-0er_BWMt.cjs} +1 -1
- package/dist/{fr-D8FOMX0o.js → fr-DmyMO3lB.js} +1 -1
- package/dist/{he-B19Qsx-u.js → he-C3RHfs6R.js} +1 -1
- package/dist/{he-BcEFNuYz.cjs → he-R2veUyP3.cjs} +1 -1
- package/dist/{hi-CarXvOJD.cjs → hi-C9UP7NGG.cjs} +1 -1
- package/dist/{hi-DozFnE3b.js → hi-YnvrXBht.js} +1 -1
- package/dist/{index-DdpYvBeh.js → index-BSl-AmDV.js} +3 -3
- package/dist/{index-B7lXSIXm.cjs → index-ByWYsYVI.cjs} +2 -2
- package/dist/{index-CYb1YxDX.js → index-Ck1DAzZ9.js} +1 -1
- package/dist/{index-gSTSk9KZ.cjs → index-D5kPtj3r.cjs} +1 -1
- package/dist/{index-CyyNsVT9.cjs → index-DE2tjivA.cjs} +1 -1
- package/dist/{index-CpZh_Snx.js → index-DklKfzD4.js} +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +244 -243
- package/dist/{it-But8uzNi.js → it-CWLwlDXe.js} +1 -1
- package/dist/{it-ops3Czzi.cjs → it-Cxt1_D4h.cjs} +1 -1
- package/dist/{ja-2dzONSkh.cjs → ja-CpDovHPb.cjs} +1 -1
- package/dist/{ja-DkwTnFdU.js → ja-DthjgDtM.js} +1 -1
- package/dist/json-schema/index.cjs.js +2 -2
- package/dist/json-schema/index.es.js +7 -7
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +5 -5
- package/dist/{ko-uVJEhtyQ.cjs → ko-M_MCTNuN.cjs} +1 -1
- package/dist/{ko-Cqv-IjhX.js → ko-joDK7ONT.js} +1 -1
- package/dist/{modal-MofsfmAe.js → modal-CkcwBTk2.js} +28 -28
- package/dist/{modal-5P9mU_a4.cjs → modal-CwDATZfz.cjs} +1 -1
- package/dist/monaco/index.cjs.js +2 -2
- package/dist/monaco/index.es.js +11 -11
- package/dist/{nl-DXnbYulJ.cjs → nl-DGhIOGxN.cjs} +1 -1
- package/dist/{nl-YSiU3rFI.js → nl-DmoWeXUt.js} +1 -1
- package/dist/{notice-DP209Ed8.cjs → notice-Bs90dF7k.cjs} +1 -1
- package/dist/{notice-Cqq8g17n.js → notice-CQ1Vx-z1.js} +2 -2
- package/dist/{pl-DXmHc2Nh.js → pl-8hl5VXnm.js} +1 -1
- package/dist/{pl-RbiIBA3C.cjs → pl-DocnXix_.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-Bf3z_-26.js → pt-BfYK9Rl3.js} +1 -1
- package/dist/{pt-BAecyAv-.cjs → pt-DO2Zcuqv.cjs} +1 -1
- package/dist/{ru-DZ4gJ6yr.cjs → ru-D9KCOBqN.cjs} +1 -1
- package/dist/{ru-Sy00qUeG.js → ru-eA_dNkJz.js} +1 -1
- package/dist/tailwind/index.cjs.js +1 -1
- package/dist/tailwind/index.es.js +1 -1
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +2 -2
- package/dist/tailwind/vite-plugin.cjs.js +1 -1
- package/dist/tailwind/vite-plugin.es.js +1 -1
- package/dist/timer-BJHOsuS6.cjs +1 -0
- package/dist/timer-Rd2sKnvH.js +65 -0
- package/dist/{toolbar-C_Ec0_XC.js → toolbar-CdY5huSG.js} +1 -1
- package/dist/{toolbar-wEm8iNet.cjs → toolbar-DoRPrs-s.cjs} +1 -1
- package/dist/{tr-7jGF_acJ.cjs → tr-BBmQvRSa.cjs} +1 -1
- package/dist/{tr-BDxG3qd6.js → tr-CdqbnopM.js} +1 -1
- package/dist/{translations-DQxouiBG.js → translations-BEMKy6-W.js} +19 -19
- package/dist/{translations-BmsRhth7.js → translations-CVfr2JXG.js} +1 -1
- package/dist/{translations-C7HVMcOQ.cjs → translations-D_Vu2mbd.cjs} +1 -1
- package/dist/{translations-hMQlZmD4.cjs → translations-eUtMHN9s.cjs} +1 -1
- package/dist/types/components/form/controller/controller-validation.d.ts +41 -0
- package/dist/types/components/json-schema/widgets/widget-customization.d.ts +7 -7
- package/dist/{ur-55zdT2TQ.js → ur-D9sr_I1M.js} +1 -1
- package/dist/{ur-ZT6fZFId.cjs → ur-u5qjZsKM.cjs} +1 -1
- package/dist/use-form-C5eF9ALX.cjs +2 -0
- package/dist/use-form-D3EXhCfe.js +1731 -0
- package/dist/{vi-C7K7W0hM.js → vi-0f97dtZb.js} +1 -1
- package/dist/{vi-tNs62pgs.cjs → vi-_w5RE8el.cjs} +1 -1
- package/dist/{widget-customization-CobH7Rj_.js → widget-customization-BB1gYtwq.js} +4 -4
- package/dist/{widget-customization-GaZB6sLP.cjs → widget-customization-Czt9chmX.cjs} +1 -1
- package/dist/{zh-CBnP8_Lf.cjs → zh-6cQcHbf6.cjs} +1 -1
- package/dist/{zh-DvJBV9D8.js → zh-C7HcUKhE.js} +1 -1
- package/package.json +7 -4
- package/dist/deep-merge-DZxfgKqX.cjs +0 -1
- package/dist/timer-DK_yKNwE.cjs +0 -1
- package/dist/timer-DzWb416P.js +0 -51
- package/dist/use-form-B7A865EM.js +0 -1298
- package/dist/use-form-DVJXMMoN.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("@tempots/dom"),I=require("@tempots/ui"),V=require("./colors-B9fcMxa_.cjs");function M(t,{units:e=["B","KB","MB","GB","TB"],decimalPlaces:o=0,locale:n}={}){if(t===0||t===0n)return new Intl.NumberFormat(n,{style:"unit",unit:"byte",unitDisplay:"short",maximumFractionDigits:0}).format(0).replace("byte",e[0]);let s,a;if(typeof t=="bigint"){let i=t<0n?-t:t;for(s=0;i>=1024n&&s<e.length-1;)i=i/1024n,s++;a=Number(t)/Math.pow(1024,s)}else s=Math.floor(Math.log(Math.abs(t))/Math.log(1024)),s=Math.min(s,e.length-1),a=t/Math.pow(1024,s);return new Intl.NumberFormat(n,{style:"unit",unit:"byte",unitDisplay:"short",minimumFractionDigits:s===0?0:o,maximumFractionDigits:s===0?0:o}).format(a).replace("byte",e[s])}const H={loadingExtended:"Loading, please wait",loadingShort:"Loading...",locale:"Locale",iconDescription:"Icon",loadingIcon:"Loading icon",failedToLoadIcon:"Failed to load icon",editLabel:"Edit",selectOne:"Select one",selectMany:"Select many",noResults:"No results",passwordPlaceholderText:"Secret Password",togglePasswordVisibility:"Toggle password visibility",toggleMenu:"Toggle menu",toggleAside:"Toggle aside",mainNavigation:"Main navigation",sidebar:"Sidebar",closeDrawer:"Close drawer",closeModal:"Close modal",confirm:"Confirm",cancel:"Cancel",addLabel:"Add",removeItem:"Remove item",currentLocale:"English",ar:"Arabic",de:"German",en:"English",es:"Spanish",fr:"French",hi:"Hindi",it:"Italian",ja:"Japanese",ko:"Korean",nl:"Dutch",pl:"Polish",pt:"Portuguese",ru:"Russian",tr:"Turkish",vi:"Vietnamese",zh:"Chinese",he:"Hebrew",fa:"Persian",ur:"Urdu",emailPlaceholderText:"Enter your email",incrementValue:"Increment value",decrementValue:"Decrement value",dropZoneInstructions:t=>t?"Click to choose or drag files here, or press Enter or Space to open file selector":"Drag files here",fileSizeUnits:["Bytes","KB","MB","GB","TB"],removeFile:"Remove file",clearAllFiles:"Clear all files",clearValue:"Reset",unknownType:"Unknown type",filesInputInstructions:(t,e,o)=>{let n=t==null||t>1?"Click to choose or drag files here":"Click to choose or drag a file here";if(t||e){const s=[];if(t!=null&&t>1&&s.push(`up to ${t} files`),e&&o){const a=M(e,{units:o});s.push(`max ${a} each`)}s.length>0&&(n+=` (${s.join(", ")})`)}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Inline code",link:"Insert link",removeLink:"Remove link",heading:t=>`Heading ${t}`,bulletList:"Bullet list",orderedList:"Ordered list",blockquote:"Blockquote",codeBlock:"Code block",horizontalRule:"Horizontal rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"Loading PDF...",loadFailed:"Failed to load PDF",invalidPdf:"Invalid PDF file",pageOutOfRange:(t,e)=>`Page ${t} is out of range (1-${e})`,renderFailed:"Failed to render PDF page"}},v=H,y="en",K=new Set(["ar","he","fa","ur","ps","sd","ku","dv","yi","ji","iw","in"]);function L(t){if(!t)return"ltr";const e=t.split(/[-_]/)[0].toLowerCase();return K.has(e)?"rtl":"ltr"}function O(t,e){return t==="auto"?L(e):t}function Y(t){return`b-${t}`}function J(t){return L(t)==="rtl"}function Q(t){return t==="ltr"?"rtl":"ltr"}const F={ltr:{"inline-start":"left","inline-end":"right","block-start":"top","block-end":"bottom"},rtl:{"inline-start":"right","inline-end":"left","block-start":"top","block-end":"bottom"}};function Z(t,e){return F[e][t]}const E={mark:r.makeProviderMark("Locale"),create:t=>{const e=r.localStorageProp({defaultValue:navigator.language??"en-US",key:"beatui-locale"}),o=r.localStorageProp({defaultValue:"auto",key:"beatui-direction-preference"}),n=r.computedOf(e,o)((a,l)=>O(l,a));return{value:{locale:e,setLocale:a=>e.set(a),direction:n,directionPreference:o,setDirectionPreference:a=>o.set(a)},dispose:()=>{e.dispose(),o.dispose(),n.dispose()}}}},{variants:X,special:tt,overrides:D}=V.backgroundConfig;function k(t,e){switch(t){case"white":return"var(--color-white)";case"black":return"var(--color-black)";case"transparent":return"transparent";default:return V.getColorVar(t,e)}}function _(t,e){const o=tt[t];if(!o)return;if(e==="light")return o;const n=D[t];return n?n[e]:o}function p(t,e,o){const n=D[t];if(n){const a=n[o];if(a)return{backgroundColor:a.backgroundColor,textColor:a.color}}if(e==="solid"){const a=_(t,o);if(a)return{backgroundColor:a.backgroundColor,textColor:a.color}}const s=X[e][o];return{backgroundColor:k(t,s.bgShade),textColor:s.textColor}}const et={light:{shade:600,textColor:"var(--color-white)"},dark:{shade:600,textColor:"var(--text-inverted-dark)"}},rt={light:{shade:300,textColor:"var(--text-normal-light)"},dark:{shade:700,textColor:"var(--text-normal-dark)"}},nt={light:{shade:400,textColor:"var(--text-normal-light)"},dark:{shade:600,textColor:"var(--text-normal-dark)"}};function b(t,e,o){const n=D[t];if(n){const a=n[o];if(a)return{backgroundColor:a.backgroundColor,textColor:a.color}}if(e==="solid"){const a=_(t,o);if(a)return{backgroundColor:a.backgroundColor,textColor:a.color};const l=et[o];return{backgroundColor:k(t,l.shade),textColor:l.textColor}}const s=e==="light"?rt[o]:nt[o];return{backgroundColor:k(t,s.shade),textColor:s.textColor}}function P(t,e){const o=e==="light"?500:600;switch(t){case"white":return e==="light"?"var(--text-inverse-light)":"var(--text-inverted-dark)";case"black":return"var(--color-black)";case"transparent":return"transparent";default:return k(t,o)}}function m(t,e){return t==="white"?"var(--color-white)":t==="black"?"var(--color-black)":t==="transparent"?"inherit":k(t,e==="light"?800:200)}function $(t,e,o){return e==="soft"?k(t,o==="light"?300:700):k(t,o==="light"?500:600)}const ot="bui-icons",x=new Map,B=(()=>{try{return typeof indexedDB<"u"&&indexedDB!==null}catch{return!1}})();function at(){return B?new Promise((t,e)=>{const o=indexedDB.open(ot,1);o.onupgradeneeded=function(n){const s=n.target.result;s.objectStoreNames.contains("icons")||s.createObjectStore("icons")},o.onsuccess=function(){t(o.result)},o.onerror=function(){e(o.error)}}):Promise.reject(new Error("IndexedDB not available"))}const C=B?at():null;async function T(t,e){try{if(C){const o=await C;return new Promise((n,s)=>{const a=o.transaction("icons","readwrite");a.objectStore("icons").put(e,t),a.oncomplete=()=>n(),a.onerror=s})}else x.set(t,e)}catch{x.set(t,e)}}async function j(t){try{if(C){const e=await C;return new Promise((o,n)=>{const l=e.transaction("icons","readonly").objectStore("icons").get(t);l.onsuccess=function(){o(l.result)},l.onerror=n})}else return x.get(t)||null}catch{return x.get(t)||null}}async function st(t){const e=`https://api.iconify.design/${t}.svg`;return fetch(e).then(o=>{if(o.status===200)return o.text();throw new Error(`Failed to load icon: ${t}`)})}async function lt(t){const e=t.replace(":","/"),o=await j(e);if(o)return o;const n=await st(e);return await T(e,n),n}function it(t){return["bc-icon",`bc-icon--${t}`].join(" ")}function ut(t,e="solid"){if(!t)return"";const o=$(t,e,"light"),n=$(t,e,"dark");return`--icon-color: ${o}; --icon-color-dark: ${n}`}function S({icon:t,size:e="md",color:o,title:n,accessibility:s="auto",tone:a="solid"},...l){const u=r.computedOf(s,n)((i,c)=>i==="decorative"?!1:i==="informative"?!0:c!=null&&c!=="");return r.Use(q,i=>r.html.span(r.attr.class(r.computedOf(e,o)(c=>it(c??"md"))),r.attr.style(r.computedOf(o,a)((c,g)=>ut(c??void 0,g??"solid"))),r.When(u,()=>r.Fragment(r.attr.role("img"),r.aria.label(r.coalesce(n,i.$.iconDescription))),()=>r.aria.hidden(!0)),I.WhenInViewport({once:!0},()=>I.Query({request:t,load:({request:c})=>lt(c),convertError:String,success:({value:c})=>r.html.span(r.style.width("100%"),r.style.height("100%"),r.attr.innerHTML(c)),pending:()=>r.html.span(r.attr.class("animate-spin"),r.When(u,()=>r.Fragment(r.attr.role("img"),r.aria.label(i.$.loadingIcon)),()=>r.aria.hidden(!0)),"↻"),failure:({error:c})=>r.html.span(r.attr.title(c),r.attr.class("text-red-500"),r.When(u,()=>r.Fragment(r.attr.role("img"),r.aria.label(i.$.failedToLoadIcon)),()=>r.aria.hidden(!0)),"🚫")})),...l))}function R(t,e,o,n){const s=["bc-button",`bc-button--size-${t}`,`bc-control--padding-${t}`,`bc-control--rounded-${e}`];return o&&s.push("bc-button--loading"),n&&s.push("bc-button--full-width"),s.join(" ")}function A(t,e,o){const n=new Map;n.set("--button-text-shadow","var(--text-shadow-none)"),n.set("--button-text-shadow-dark","var(--text-shadow-none)");const s=(a,l,u,i)=>{o||(n.set("--button-bg-hover",a),n.set("--button-text-hover",u),n.set("--button-bg-hover-dark",l),n.set("--button-text-hover-dark",i))};switch(t){case"filled":{const a=p(e,"solid","light"),l=p(e,"solid","dark");n.set("--button-bg",a.backgroundColor),n.set("--button-text",a.textColor),n.set("--button-bg-dark",l.backgroundColor),n.set("--button-text-dark",l.textColor),n.set("--button-text-shadow","var(--text-shadow-button-filled, var(--text-shadow-sm))"),n.set("--button-text-shadow-dark","var(--text-shadow-button-filled, var(--text-shadow-sm))");const u=b(e,"solid","light"),i=b(e,"solid","dark");s(u.backgroundColor,i.backgroundColor,u.textColor,i.textColor);break}case"light":{const a=p(e,"light","light"),l=p(e,"light","dark");n.set("--button-bg",a.backgroundColor),n.set("--button-text",a.textColor),n.set("--button-bg-dark",l.backgroundColor),n.set("--button-text-dark",l.textColor);const u=b(e,"light","light"),i=b(e,"light","dark");s(u.backgroundColor,i.backgroundColor,u.textColor,i.textColor);break}case"outline":{n.set("--button-bg","transparent"),n.set("--button-bg-dark","transparent"),n.set("--button-border",P(e,"light")),n.set("--button-border-dark",P(e,"dark")),n.set("--button-text",m(e,"light")),n.set("--button-text-dark",m(e,"dark")),n.set("--button-text-shadow","var(--text-shadow-button-light, var(--text-shadow-xs))"),n.set("--button-text-shadow-dark","var(--text-shadow-button-light, var(--text-shadow-xs))");const a=b(e,"light","light"),l=b(e,"light","dark");s(a.backgroundColor,l.backgroundColor,a.textColor,l.textColor);break}case"default":{const a=p("neutral","light","light"),l=p("neutral","light","dark");n.set("--button-bg",a.backgroundColor),n.set("--button-text",m(e,"light")),n.set("--button-bg-dark",l.backgroundColor),n.set("--button-text-dark",m(e,"dark")),n.set("--button-text-shadow","var(--text-shadow-button-default, var(--text-shadow-2xs))"),n.set("--button-text-shadow-dark","var(--text-shadow-button-default, var(--text-shadow-2xs))");const u=b("base","light","light"),i=b("base","light","dark");s(u.backgroundColor,i.backgroundColor,n.get("--button-text")??a.textColor,n.get("--button-text-dark")??l.textColor);break}case"text":{n.set("--button-bg","transparent"),n.set("--button-bg-dark","transparent"),n.set("--button-text",m(e,"light")),n.set("--button-text-dark",m(e,"dark")),o||n.set("--button-hover-decoration","underline");break}}return Array.from(n.entries()).map(([a,l])=>`${a}: ${l}`).join("; ")}function ct({type:t="button",disabled:e=!1,loading:o=!1,variant:n="filled",size:s="md",color:a="base",roundedness:l="sm",onClick:u=()=>{},fullWidth:i=!1,stopPropagation:c=!0},...g){const d=r.prop(null);return r.Use(q,f=>r.html.button(r.attr.type(t),r.attr.disabled(r.computedOf(e,o)((h,w)=>h||w)),r.aria.busy(o??!1),r.When(o??!1,()=>r.aria.label(f.$.loadingExtended)),r.attr.class(r.computedOf(s,l,o,i)(R)),r.attr.style(r.computedOf(n,a,e)(A)),r.When(o??!1,()=>r.Fragment(r.style.width(d.map(h=>h==null?"":`${h.width}px`)),r.style.height(d.map(h=>h==null?"":`${h.height}px`)),S({icon:"line-md:loading-twotone-loop",size:s??"md"}),r.html.span(r.attr.class("sr-only"),r.aria.live("polite"),f.$.loadingExtended)),()=>r.Fragment(r.on.click(h=>{t!=="submit"&&h.preventDefault(),c&&h.stopPropagation(),u()}),...g)),r.When(o!=null,()=>I.ElementRect(h=>(h.on(w=>{r.Value.get(o??!1)||d.set(w)}),r.Empty)))))}function dt(t,e,o){const n=[t?"bc-base-input-container":"bc-input-container"];return e?n.push(t?"bc-base-input-container--disabled":"bc-input-container--disabled"):n.push(t?"bc-base-input-container--default":"bc-input-container--default"),o&&n.push("bc-input-container--error"),n.join(" ")}function N(t,e){const o=["bc-input-container__input"];return t||(o.push(`bc-control--padding-${e}`),o.push(`bc-control--text-size-${e}`)),o.join(" ")}const U=({baseContainer:t,disabled:e,input:o,before:n,after:s,hasError:a,focusableSelector:l="input, select, textarea",growInput:u=!0,size:i},...c)=>{const g=r.Value.map(e??!1,d=>d);return r.html.div(r.WithElement(d=>{const f=()=>{d.querySelector(l)?.focus()};return d.addEventListener("click",f),r.OnDispose(()=>d.removeEventListener("click",f))}),r.attr.class(r.computedOf(t,g,a??!1)((d,f,h)=>dt(d??!1,f??!1,h??!1))),n!=null?r.html.span(r.attr.class("bc-input-container__before"),n):null,r.html.div(r.attr.class(r.computedOf(t,i??"md")((d,f)=>N(d??!1,f??"md"))),r.attr.class(r.Value.map(u,d=>d?"bc-input-container__input--grow":"")),o),s!=null?r.html.span(r.attr.class("bc-input-container__after"),s):null,...c)};function ht({icon:t,size:e="md",color:o="neutral"}){return r.html.span(r.attr.class("bc-input-container__icon"),S({icon:t,size:e,color:o}))}const W=({autocomplete:t,autofocus:e,class:o,disabled:n,name:s,placeholder:a,id:l,required:u,tabIndex:i,hasError:c})=>r.Fragment(r.attr.autocomplete(t),r.attr.autofocus(e),r.attr.class(o),r.attr.disabled(n),r.attr.name(s??l),r.attr.placeholder(a),r.attr.id(l),r.aria.required(u),r.attr.tabindex(i),c!=null?r.aria.invalid(c??!1):null),gt=t=>{const{value:e,onBlur:o,onChange:n,onInput:s}=t;return U({...t,input:r.input.text(W(t),r.attr.value(e),r.attr.class("bc-input"),o!=null?r.on.blur(r.emitValue(o)):r.Empty,n!=null?r.on.change(r.emitValue(n)):r.Empty,s!=null?r.on.input(r.emitValue(s)):r.Empty)})};function ft(t){const e=t.split("-"),o=[t];return e.length>1&&o.push(e[0]),o}function G({locale:t,defaultLocale:e="en-US",defaultMessages:o,localeLoader:n}){const s=r.prop(e),a=r.prop(o),l=t.on(async u=>{if(u===s.value)return;s.set(u);const i=ft(u);for(const c of i)try{const g=await n(c);if(typeof g.default=="object"&&Object.keys(g).length===1){console.error("It appears that you are trying to load a translation module without referencing the default export. Please use `(await import(...)).default` in your loader function.");return}if(u===s.value){a.set(g);return}}catch{continue}console.warn(`No locale found for "${t.value}", using fallback`),u===s.value&&a.set(o)});return{dispose:()=>{l(),s.dispose(),a.dispose()},t:a}}function z({defaultLocale:t,defaultMessages:e,localeLoader:o,providerName:n="I18nProvider"}){return{mark:r.makeProviderMark(n),create:(s,a)=>{const{value:{locale:l}}=a.getProvider(E.mark),{t:u,dispose:i}=G({locale:l,defaultMessages:e,defaultLocale:t,localeLoader:o});return{value:u,dispose:i}}}}const bt=Object.assign({"./locales/ar.ts":()=>Promise.resolve().then(()=>require("./ar-CefikVG3.cjs")).then(t=>t.default),"./locales/de.ts":()=>Promise.resolve().then(()=>require("./de-ZRnkggf5.cjs")).then(t=>t.default),"./locales/es.ts":()=>Promise.resolve().then(()=>require("./es-IkNtVSp2.cjs")).then(t=>t.default),"./locales/fa.ts":()=>Promise.resolve().then(()=>require("./fa-B-byOhgU.cjs")).then(t=>t.default),"./locales/fr.ts":()=>Promise.resolve().then(()=>require("./fr-F0ZegdR2.cjs")).then(t=>t.default),"./locales/he.ts":()=>Promise.resolve().then(()=>require("./he-BcEFNuYz.cjs")).then(t=>t.default),"./locales/hi.ts":()=>Promise.resolve().then(()=>require("./hi-CarXvOJD.cjs")).then(t=>t.default),"./locales/it.ts":()=>Promise.resolve().then(()=>require("./it-ops3Czzi.cjs")).then(t=>t.default),"./locales/ja.ts":()=>Promise.resolve().then(()=>require("./ja-2dzONSkh.cjs")).then(t=>t.default),"./locales/ko.ts":()=>Promise.resolve().then(()=>require("./ko-uVJEhtyQ.cjs")).then(t=>t.default),"./locales/nl.ts":()=>Promise.resolve().then(()=>require("./nl-DXnbYulJ.cjs")).then(t=>t.default),"./locales/pl.ts":()=>Promise.resolve().then(()=>require("./pl-RbiIBA3C.cjs")).then(t=>t.default),"./locales/pt.ts":()=>Promise.resolve().then(()=>require("./pt-BAecyAv-.cjs")).then(t=>t.default),"./locales/ru.ts":()=>Promise.resolve().then(()=>require("./ru-DZ4gJ6yr.cjs")).then(t=>t.default),"./locales/tr.ts":()=>Promise.resolve().then(()=>require("./tr-7jGF_acJ.cjs")).then(t=>t.default),"./locales/ur.ts":()=>Promise.resolve().then(()=>require("./ur-ZT6fZFId.cjs")).then(t=>t.default),"./locales/vi.ts":()=>Promise.resolve().then(()=>require("./vi-tNs62pgs.cjs")).then(t=>t.default),"./locales/zh.ts":()=>Promise.resolve().then(()=>require("./zh-CBnP8_Lf.cjs")).then(t=>t.default)}),q=z({defaultLocale:y,defaultMessages:v,localeLoader:async t=>{if(t===y)return v;const e=bt[`./locales/${t}.ts`];return e?await e():v},providerName:"BeatUII18n"});exports.BeatUII18n=q;exports.Button=ct;exports.CommonInputAttributes=W;exports.Icon=S;exports.InputContainer=U;exports.InputIcon=ht;exports.LOGICAL_PROPERTY_MAP=F;exports.Locale=E;exports.TextInput=gt;exports.backgroundValue=p;exports.borderColorValue=P;exports.defaultLocale=y;exports.defaultMessages=v;exports.formatFileSize=M;exports.generateButtonClasses=R;exports.generateButtonStyles=A;exports.generateInputContainerInputClasses=N;exports.getDirectionClassName=Y;exports.getDirectionFromLocale=L;exports.getIconLocally=j;exports.getOppositeDirection=Q;exports.getPhysicalProperty=Z;exports.hoverBackgroundValue=b;exports.isIndexedDBAvailable=B;exports.isRTLLocale=J;exports.makeI18nProvider=z;exports.makeMessages=G;exports.resolveDirection=O;exports.storeIconLocally=T;exports.textColorValue=m;
|
|
1
|
+
"use strict";const r=require("@tempots/dom"),I=require("@tempots/ui"),V=require("./colors-B2yrgHSW.cjs");function M(t,{units:e=["B","KB","MB","GB","TB"],decimalPlaces:o=0,locale:n}={}){if(t===0||t===0n)return new Intl.NumberFormat(n,{style:"unit",unit:"byte",unitDisplay:"short",maximumFractionDigits:0}).format(0).replace("byte",e[0]);let s,a;if(typeof t=="bigint"){let i=t<0n?-t:t;for(s=0;i>=1024n&&s<e.length-1;)i=i/1024n,s++;a=Number(t)/Math.pow(1024,s)}else s=Math.floor(Math.log(Math.abs(t))/Math.log(1024)),s=Math.min(s,e.length-1),a=t/Math.pow(1024,s);return new Intl.NumberFormat(n,{style:"unit",unit:"byte",unitDisplay:"short",minimumFractionDigits:s===0?0:o,maximumFractionDigits:s===0?0:o}).format(a).replace("byte",e[s])}const H={loadingExtended:"Loading, please wait",loadingShort:"Loading...",locale:"Locale",iconDescription:"Icon",loadingIcon:"Loading icon",failedToLoadIcon:"Failed to load icon",editLabel:"Edit",selectOne:"Select one",selectMany:"Select many",noResults:"No results",passwordPlaceholderText:"Secret Password",togglePasswordVisibility:"Toggle password visibility",toggleMenu:"Toggle menu",toggleAside:"Toggle aside",mainNavigation:"Main navigation",sidebar:"Sidebar",closeDrawer:"Close drawer",closeModal:"Close modal",confirm:"Confirm",cancel:"Cancel",addLabel:"Add",removeItem:"Remove item",currentLocale:"English",ar:"Arabic",de:"German",en:"English",es:"Spanish",fr:"French",hi:"Hindi",it:"Italian",ja:"Japanese",ko:"Korean",nl:"Dutch",pl:"Polish",pt:"Portuguese",ru:"Russian",tr:"Turkish",vi:"Vietnamese",zh:"Chinese",he:"Hebrew",fa:"Persian",ur:"Urdu",emailPlaceholderText:"Enter your email",incrementValue:"Increment value",decrementValue:"Decrement value",dropZoneInstructions:t=>t?"Click to choose or drag files here, or press Enter or Space to open file selector":"Drag files here",fileSizeUnits:["Bytes","KB","MB","GB","TB"],removeFile:"Remove file",clearAllFiles:"Clear all files",clearValue:"Reset",unknownType:"Unknown type",filesInputInstructions:(t,e,o)=>{let n=t==null||t>1?"Click to choose or drag files here":"Click to choose or drag a file here";if(t||e){const s=[];if(t!=null&&t>1&&s.push(`up to ${t} files`),e&&o){const a=M(e,{units:o});s.push(`max ${a} each`)}s.length>0&&(n+=` (${s.join(", ")})`)}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Inline code",link:"Insert link",removeLink:"Remove link",heading:t=>`Heading ${t}`,bulletList:"Bullet list",orderedList:"Ordered list",blockquote:"Blockquote",codeBlock:"Code block",horizontalRule:"Horizontal rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"Loading PDF...",loadFailed:"Failed to load PDF",invalidPdf:"Invalid PDF file",pageOutOfRange:(t,e)=>`Page ${t} is out of range (1-${e})`,renderFailed:"Failed to render PDF page"}},v=H,y="en",K=new Set(["ar","he","fa","ur","ps","sd","ku","dv","yi","ji","iw","in"]);function L(t){if(!t)return"ltr";const e=t.split(/[-_]/)[0].toLowerCase();return K.has(e)?"rtl":"ltr"}function O(t,e){return t==="auto"?L(e):t}function Y(t){return`b-${t}`}function J(t){return L(t)==="rtl"}function Q(t){return t==="ltr"?"rtl":"ltr"}const F={ltr:{"inline-start":"left","inline-end":"right","block-start":"top","block-end":"bottom"},rtl:{"inline-start":"right","inline-end":"left","block-start":"top","block-end":"bottom"}};function Z(t,e){return F[e][t]}const E={mark:r.makeProviderMark("Locale"),create:t=>{const e=r.localStorageProp({defaultValue:navigator.language??"en-US",key:"beatui-locale"}),o=r.localStorageProp({defaultValue:"auto",key:"beatui-direction-preference"}),n=r.computedOf(e,o)((a,l)=>O(l,a));return{value:{locale:e,setLocale:a=>e.set(a),direction:n,directionPreference:o,setDirectionPreference:a=>o.set(a)},dispose:()=>{e.dispose(),o.dispose(),n.dispose()}}}},{variants:X,special:tt,overrides:D}=V.backgroundConfig;function k(t,e){switch(t){case"white":return"var(--color-white)";case"black":return"var(--color-black)";case"transparent":return"transparent";default:return V.getColorVar(t,e)}}function _(t,e){const o=tt[t];if(!o)return;if(e==="light")return o;const n=D[t];return n?n[e]:o}function p(t,e,o){const n=D[t];if(n){const a=n[o];if(a)return{backgroundColor:a.backgroundColor,textColor:a.color}}if(e==="solid"){const a=_(t,o);if(a)return{backgroundColor:a.backgroundColor,textColor:a.color}}const s=X[e][o];return{backgroundColor:k(t,s.bgShade),textColor:s.textColor}}const et={light:{shade:600,textColor:"var(--color-white)"},dark:{shade:600,textColor:"var(--text-inverted-dark)"}},rt={light:{shade:300,textColor:"var(--text-normal-light)"},dark:{shade:700,textColor:"var(--text-normal-dark)"}},nt={light:{shade:400,textColor:"var(--text-normal-light)"},dark:{shade:600,textColor:"var(--text-normal-dark)"}};function b(t,e,o){const n=D[t];if(n){const a=n[o];if(a)return{backgroundColor:a.backgroundColor,textColor:a.color}}if(e==="solid"){const a=_(t,o);if(a)return{backgroundColor:a.backgroundColor,textColor:a.color};const l=et[o];return{backgroundColor:k(t,l.shade),textColor:l.textColor}}const s=e==="light"?rt[o]:nt[o];return{backgroundColor:k(t,s.shade),textColor:s.textColor}}function P(t,e){const o=e==="light"?500:600;switch(t){case"white":return e==="light"?"var(--text-inverse-light)":"var(--text-inverted-dark)";case"black":return"var(--color-black)";case"transparent":return"transparent";default:return k(t,o)}}function m(t,e){return t==="white"?"var(--color-white)":t==="black"?"var(--color-black)":t==="transparent"?"inherit":k(t,e==="light"?800:200)}function $(t,e,o){return e==="soft"?k(t,o==="light"?300:700):k(t,o==="light"?500:600)}const ot="bui-icons",x=new Map,B=(()=>{try{return typeof indexedDB<"u"&&indexedDB!==null}catch{return!1}})();function at(){return B?new Promise((t,e)=>{const o=indexedDB.open(ot,1);o.onupgradeneeded=function(n){const s=n.target.result;s.objectStoreNames.contains("icons")||s.createObjectStore("icons")},o.onsuccess=function(){t(o.result)},o.onerror=function(){e(o.error)}}):Promise.reject(new Error("IndexedDB not available"))}const C=B?at():null;async function T(t,e){try{if(C){const o=await C;return new Promise((n,s)=>{const a=o.transaction("icons","readwrite");a.objectStore("icons").put(e,t),a.oncomplete=()=>n(),a.onerror=s})}else x.set(t,e)}catch{x.set(t,e)}}async function j(t){try{if(C){const e=await C;return new Promise((o,n)=>{const l=e.transaction("icons","readonly").objectStore("icons").get(t);l.onsuccess=function(){o(l.result)},l.onerror=n})}else return x.get(t)||null}catch{return x.get(t)||null}}async function st(t){const e=`https://api.iconify.design/${t}.svg`;return fetch(e).then(o=>{if(o.status===200)return o.text();throw new Error(`Failed to load icon: ${t}`)})}async function lt(t){const e=t.replace(":","/"),o=await j(e);if(o)return o;const n=await st(e);return await T(e,n),n}function it(t){return["bc-icon",`bc-icon--${t}`].join(" ")}function ut(t,e="solid"){if(!t)return"";const o=$(t,e,"light"),n=$(t,e,"dark");return`--icon-color: ${o}; --icon-color-dark: ${n}`}function S({icon:t,size:e="md",color:o,title:n,accessibility:s="auto",tone:a="solid"},...l){const u=r.computedOf(s,n)((i,c)=>i==="decorative"?!1:i==="informative"?!0:c!=null&&c!=="");return r.Use(q,i=>r.html.span(r.attr.class(r.computedOf(e,o)(c=>it(c??"md"))),r.attr.style(r.computedOf(o,a)((c,g)=>ut(c??void 0,g??"solid"))),r.When(u,()=>r.Fragment(r.attr.role("img"),r.aria.label(r.coalesce(n,i.$.iconDescription))),()=>r.aria.hidden(!0)),I.WhenInViewport({once:!0},()=>I.Query({request:t,load:({request:c})=>lt(c),convertError:String,success:({value:c})=>r.html.span(r.style.width("100%"),r.style.height("100%"),r.attr.innerHTML(c)),pending:()=>r.html.span(r.attr.class("animate-spin"),r.When(u,()=>r.Fragment(r.attr.role("img"),r.aria.label(i.$.loadingIcon)),()=>r.aria.hidden(!0)),"↻"),failure:({error:c})=>r.html.span(r.attr.title(c),r.attr.class("text-red-500"),r.When(u,()=>r.Fragment(r.attr.role("img"),r.aria.label(i.$.failedToLoadIcon)),()=>r.aria.hidden(!0)),"🚫")})),...l))}function R(t,e,o,n){const s=["bc-button",`bc-button--size-${t}`,`bc-control--padding-${t}`,`bc-control--rounded-${e}`];return o&&s.push("bc-button--loading"),n&&s.push("bc-button--full-width"),s.join(" ")}function A(t,e,o){const n=new Map;n.set("--button-text-shadow","var(--text-shadow-none)"),n.set("--button-text-shadow-dark","var(--text-shadow-none)");const s=(a,l,u,i)=>{o||(n.set("--button-bg-hover",a),n.set("--button-text-hover",u),n.set("--button-bg-hover-dark",l),n.set("--button-text-hover-dark",i))};switch(t){case"filled":{const a=p(e,"solid","light"),l=p(e,"solid","dark");n.set("--button-bg",a.backgroundColor),n.set("--button-text",a.textColor),n.set("--button-bg-dark",l.backgroundColor),n.set("--button-text-dark",l.textColor),n.set("--button-text-shadow","var(--text-shadow-button-filled, var(--text-shadow-sm))"),n.set("--button-text-shadow-dark","var(--text-shadow-button-filled, var(--text-shadow-sm))");const u=b(e,"solid","light"),i=b(e,"solid","dark");s(u.backgroundColor,i.backgroundColor,u.textColor,i.textColor);break}case"light":{const a=p(e,"light","light"),l=p(e,"light","dark");n.set("--button-bg",a.backgroundColor),n.set("--button-text",a.textColor),n.set("--button-bg-dark",l.backgroundColor),n.set("--button-text-dark",l.textColor);const u=b(e,"light","light"),i=b(e,"light","dark");s(u.backgroundColor,i.backgroundColor,u.textColor,i.textColor);break}case"outline":{n.set("--button-bg","transparent"),n.set("--button-bg-dark","transparent"),n.set("--button-border",P(e,"light")),n.set("--button-border-dark",P(e,"dark")),n.set("--button-text",m(e,"light")),n.set("--button-text-dark",m(e,"dark")),n.set("--button-text-shadow","var(--text-shadow-button-light, var(--text-shadow-xs))"),n.set("--button-text-shadow-dark","var(--text-shadow-button-light, var(--text-shadow-xs))");const a=b(e,"light","light"),l=b(e,"light","dark");s(a.backgroundColor,l.backgroundColor,a.textColor,l.textColor);break}case"default":{const a=p("neutral","light","light"),l=p("neutral","light","dark");n.set("--button-bg",a.backgroundColor),n.set("--button-text",m(e,"light")),n.set("--button-bg-dark",l.backgroundColor),n.set("--button-text-dark",m(e,"dark")),n.set("--button-text-shadow","var(--text-shadow-button-default, var(--text-shadow-2xs))"),n.set("--button-text-shadow-dark","var(--text-shadow-button-default, var(--text-shadow-2xs))");const u=b("base","light","light"),i=b("base","light","dark");s(u.backgroundColor,i.backgroundColor,n.get("--button-text")??a.textColor,n.get("--button-text-dark")??l.textColor);break}case"text":{n.set("--button-bg","transparent"),n.set("--button-bg-dark","transparent"),n.set("--button-text",m(e,"light")),n.set("--button-text-dark",m(e,"dark")),o||n.set("--button-hover-decoration","underline");break}}return Array.from(n.entries()).map(([a,l])=>`${a}: ${l}`).join("; ")}function ct({type:t="button",disabled:e=!1,loading:o=!1,variant:n="filled",size:s="md",color:a="base",roundedness:l="sm",onClick:u=()=>{},fullWidth:i=!1,stopPropagation:c=!0},...g){const d=r.prop(null);return r.Use(q,f=>r.html.button(r.attr.type(t),r.attr.disabled(r.computedOf(e,o)((h,w)=>h||w)),r.aria.busy(o??!1),r.When(o??!1,()=>r.aria.label(f.$.loadingExtended)),r.attr.class(r.computedOf(s,l,o,i)(R)),r.attr.style(r.computedOf(n,a,e)(A)),r.When(o??!1,()=>r.Fragment(r.style.width(d.map(h=>h==null?"":`${h.width}px`)),r.style.height(d.map(h=>h==null?"":`${h.height}px`)),S({icon:"line-md:loading-twotone-loop",size:s??"md"}),r.html.span(r.attr.class("sr-only"),r.aria.live("polite"),f.$.loadingExtended)),()=>r.Fragment(r.on.click(h=>{t!=="submit"&&h.preventDefault(),c&&h.stopPropagation(),u()}),...g)),r.When(o!=null,()=>I.ElementRect(h=>(h.on(w=>{r.Value.get(o??!1)||d.set(w)}),r.Empty)))))}function dt(t,e,o){const n=[t?"bc-base-input-container":"bc-input-container"];return e?n.push(t?"bc-base-input-container--disabled":"bc-input-container--disabled"):n.push(t?"bc-base-input-container--default":"bc-input-container--default"),o&&n.push("bc-input-container--error"),n.join(" ")}function N(t,e){const o=["bc-input-container__input"];return t||(o.push(`bc-control--padding-${e}`),o.push(`bc-control--text-size-${e}`)),o.join(" ")}const U=({baseContainer:t,disabled:e,input:o,before:n,after:s,hasError:a,focusableSelector:l="input, select, textarea",growInput:u=!0,size:i},...c)=>{const g=r.Value.map(e??!1,d=>d);return r.html.div(r.WithElement(d=>{const f=()=>{d.querySelector(l)?.focus()};return d.addEventListener("click",f),r.OnDispose(()=>d.removeEventListener("click",f))}),r.attr.class(r.computedOf(t,g,a??!1)((d,f,h)=>dt(d??!1,f??!1,h??!1))),n!=null?r.html.span(r.attr.class("bc-input-container__before"),n):null,r.html.div(r.attr.class(r.computedOf(t,i??"md")((d,f)=>N(d??!1,f??"md"))),r.attr.class(r.Value.map(u,d=>d?"bc-input-container__input--grow":"")),o),s!=null?r.html.span(r.attr.class("bc-input-container__after"),s):null,...c)};function ht({icon:t,size:e="md",color:o="neutral"}){return r.html.span(r.attr.class("bc-input-container__icon"),S({icon:t,size:e,color:o}))}const W=({autocomplete:t,autofocus:e,class:o,disabled:n,name:s,placeholder:a,id:l,required:u,tabIndex:i,hasError:c})=>r.Fragment(r.attr.autocomplete(t),r.attr.autofocus(e),r.attr.class(o),r.attr.disabled(n),r.attr.name(s??l),r.attr.placeholder(a),r.attr.id(l),r.aria.required(u),r.attr.tabindex(i),c!=null?r.aria.invalid(c??!1):null),gt=t=>{const{value:e,onBlur:o,onChange:n,onInput:s}=t;return U({...t,input:r.input.text(W(t),r.attr.value(e),r.attr.class("bc-input"),o!=null?r.on.blur(r.emitValue(o)):r.Empty,n!=null?r.on.change(r.emitValue(n)):r.Empty,s!=null?r.on.input(r.emitValue(s)):r.Empty)})};function ft(t){const e=t.split("-"),o=[t];return e.length>1&&o.push(e[0]),o}function G({locale:t,defaultLocale:e="en-US",defaultMessages:o,localeLoader:n}){const s=r.prop(e),a=r.prop(o),l=t.on(async u=>{if(u===s.value)return;s.set(u);const i=ft(u);for(const c of i)try{const g=await n(c);if(typeof g.default=="object"&&Object.keys(g).length===1){console.error("It appears that you are trying to load a translation module without referencing the default export. Please use `(await import(...)).default` in your loader function.");return}if(u===s.value){a.set(g);return}}catch{continue}console.warn(`No locale found for "${t.value}", using fallback`),u===s.value&&a.set(o)});return{dispose:()=>{l(),s.dispose(),a.dispose()},t:a}}function z({defaultLocale:t,defaultMessages:e,localeLoader:o,providerName:n="I18nProvider"}){return{mark:r.makeProviderMark(n),create:(s,a)=>{const{value:{locale:l}}=a.getProvider(E.mark),{t:u,dispose:i}=G({locale:l,defaultMessages:e,defaultLocale:t,localeLoader:o});return{value:u,dispose:i}}}}const bt=Object.assign({"./locales/ar.ts":()=>Promise.resolve().then(()=>require("./ar-DNoFBb9J.cjs")).then(t=>t.default),"./locales/de.ts":()=>Promise.resolve().then(()=>require("./de-AwUkK0rS.cjs")).then(t=>t.default),"./locales/es.ts":()=>Promise.resolve().then(()=>require("./es-D-d2AIlX.cjs")).then(t=>t.default),"./locales/fa.ts":()=>Promise.resolve().then(()=>require("./fa-D7rRdG8c.cjs")).then(t=>t.default),"./locales/fr.ts":()=>Promise.resolve().then(()=>require("./fr-0er_BWMt.cjs")).then(t=>t.default),"./locales/he.ts":()=>Promise.resolve().then(()=>require("./he-R2veUyP3.cjs")).then(t=>t.default),"./locales/hi.ts":()=>Promise.resolve().then(()=>require("./hi-C9UP7NGG.cjs")).then(t=>t.default),"./locales/it.ts":()=>Promise.resolve().then(()=>require("./it-Cxt1_D4h.cjs")).then(t=>t.default),"./locales/ja.ts":()=>Promise.resolve().then(()=>require("./ja-CpDovHPb.cjs")).then(t=>t.default),"./locales/ko.ts":()=>Promise.resolve().then(()=>require("./ko-M_MCTNuN.cjs")).then(t=>t.default),"./locales/nl.ts":()=>Promise.resolve().then(()=>require("./nl-DGhIOGxN.cjs")).then(t=>t.default),"./locales/pl.ts":()=>Promise.resolve().then(()=>require("./pl-DocnXix_.cjs")).then(t=>t.default),"./locales/pt.ts":()=>Promise.resolve().then(()=>require("./pt-DO2Zcuqv.cjs")).then(t=>t.default),"./locales/ru.ts":()=>Promise.resolve().then(()=>require("./ru-D9KCOBqN.cjs")).then(t=>t.default),"./locales/tr.ts":()=>Promise.resolve().then(()=>require("./tr-BBmQvRSa.cjs")).then(t=>t.default),"./locales/ur.ts":()=>Promise.resolve().then(()=>require("./ur-u5qjZsKM.cjs")).then(t=>t.default),"./locales/vi.ts":()=>Promise.resolve().then(()=>require("./vi-_w5RE8el.cjs")).then(t=>t.default),"./locales/zh.ts":()=>Promise.resolve().then(()=>require("./zh-6cQcHbf6.cjs")).then(t=>t.default)}),q=z({defaultLocale:y,defaultMessages:v,localeLoader:async t=>{if(t===y)return v;const e=bt[`./locales/${t}.ts`];return e?await e():v},providerName:"BeatUII18n"});exports.BeatUII18n=q;exports.Button=ct;exports.CommonInputAttributes=W;exports.Icon=S;exports.InputContainer=U;exports.InputIcon=ht;exports.LOGICAL_PROPERTY_MAP=F;exports.Locale=E;exports.TextInput=gt;exports.backgroundValue=p;exports.borderColorValue=P;exports.defaultLocale=y;exports.defaultMessages=v;exports.formatFileSize=M;exports.generateButtonClasses=R;exports.generateButtonStyles=A;exports.generateInputContainerInputClasses=N;exports.getDirectionClassName=Y;exports.getDirectionFromLocale=L;exports.getIconLocally=j;exports.getOppositeDirection=Q;exports.getPhysicalProperty=Z;exports.hoverBackgroundValue=b;exports.isIndexedDBAvailable=B;exports.isRTLLocale=J;exports.makeI18nProvider=z;exports.makeMessages=G;exports.resolveDirection=O;exports.storeIconLocally=T;exports.textColorValue=m;
|
|
@@ -5,4 +5,45 @@ export type ControllerError = {
|
|
|
5
5
|
dependencies?: Record<PathSegment, ControllerError>;
|
|
6
6
|
};
|
|
7
7
|
export type ControllerValidation = Validation<ControllerError>;
|
|
8
|
+
/**
|
|
9
|
+
* Helper object for creating ControllerValidation instances.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Valid state
|
|
14
|
+
* ControllerValidation.valid
|
|
15
|
+
*
|
|
16
|
+
* // Invalid with a message
|
|
17
|
+
* ControllerValidation.invalid('Something went wrong')
|
|
18
|
+
*
|
|
19
|
+
* // Invalid with field-specific errors
|
|
20
|
+
* ControllerValidation.invalidFields({
|
|
21
|
+
* email: 'Invalid email format',
|
|
22
|
+
* password: 'Password too short',
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* // Invalid from a ControllerError object
|
|
26
|
+
* ControllerValidation.fromError({
|
|
27
|
+
* message: 'Form has errors',
|
|
28
|
+
* dependencies: { field: { message: 'Error' } }
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const ControllerValidation: {
|
|
33
|
+
/** A valid validation result */
|
|
34
|
+
readonly valid: ControllerValidation;
|
|
35
|
+
/**
|
|
36
|
+
* Create an invalid validation with a message
|
|
37
|
+
*/
|
|
38
|
+
readonly invalid: (message: string) => ControllerValidation;
|
|
39
|
+
/**
|
|
40
|
+
* Create an invalid validation with field-specific errors.
|
|
41
|
+
* Values can be error messages (strings) or full ControllerError objects.
|
|
42
|
+
*/
|
|
43
|
+
readonly invalidFields: (fields: Record<PathSegment, string | ControllerError>) => ControllerValidation;
|
|
44
|
+
/**
|
|
45
|
+
* Create an invalid validation from a ControllerError object
|
|
46
|
+
*/
|
|
47
|
+
readonly fromError: (error: ControllerError) => ControllerValidation;
|
|
48
|
+
};
|
|
8
49
|
export declare function makeMapValidation(fields: PathSegment[]): (status: ControllerValidation) => ControllerValidation;
|
|
@@ -87,9 +87,9 @@ export interface WidgetCustomization {
|
|
|
87
87
|
/**
|
|
88
88
|
* Custom widget registration for form-scoped widgets
|
|
89
89
|
*/
|
|
90
|
-
export interface CustomWidgetRegistration
|
|
90
|
+
export interface CustomWidgetRegistration {
|
|
91
91
|
/** Widget factory function */
|
|
92
|
-
factory: WidgetFactory
|
|
92
|
+
factory: WidgetFactory;
|
|
93
93
|
/** Custom matcher function for widget selection (required) */
|
|
94
94
|
matcher: (ctx: SchemaContext) => boolean;
|
|
95
95
|
/** Widget priority (higher = preferred, default: 50) */
|
|
@@ -173,7 +173,7 @@ export declare function registerWidget<T = unknown>(name: string, factory: Widge
|
|
|
173
173
|
* // Matches schema: { type: 'string', 'x:ui': 'fancy-email' }
|
|
174
174
|
* ```
|
|
175
175
|
*/
|
|
176
|
-
export declare function forXUI
|
|
176
|
+
export declare function forXUI(widgetName: string, factory: WidgetFactory, options?: Partial<Omit<CustomWidgetRegistration, 'factory' | 'matcher'>>): CustomWidgetRegistration;
|
|
177
177
|
/**
|
|
178
178
|
* Create a custom widget registration that matches by schema format
|
|
179
179
|
*
|
|
@@ -183,7 +183,7 @@ export declare function forXUI<T = unknown>(widgetName: string, factory: WidgetF
|
|
|
183
183
|
* // Matches ANY schema with: { format: 'email' }
|
|
184
184
|
* ```
|
|
185
185
|
*/
|
|
186
|
-
export declare function forFormat
|
|
186
|
+
export declare function forFormat(format: string, factory: WidgetFactory, options?: Partial<Omit<CustomWidgetRegistration, 'factory' | 'matcher'>>): CustomWidgetRegistration;
|
|
187
187
|
/**
|
|
188
188
|
* Create a custom widget registration that matches by type + format combination
|
|
189
189
|
*
|
|
@@ -193,7 +193,7 @@ export declare function forFormat<T = unknown>(format: string, factory: WidgetFa
|
|
|
193
193
|
* // Matches schema: { type: 'string', format: 'uuid' }
|
|
194
194
|
* ```
|
|
195
195
|
*/
|
|
196
|
-
export declare function forTypeAndFormat
|
|
196
|
+
export declare function forTypeAndFormat(type: string, format: string, factory: WidgetFactory, options?: Partial<Omit<CustomWidgetRegistration, 'factory' | 'matcher'>>): CustomWidgetRegistration;
|
|
197
197
|
/**
|
|
198
198
|
* Create a diagnostic custom widget registration for debugging custom widget matching.
|
|
199
199
|
*
|
|
@@ -217,7 +217,7 @@ export declare function forTypeAndFormat<T = unknown>(type: string, format: stri
|
|
|
217
217
|
* ]
|
|
218
218
|
* ```
|
|
219
219
|
*/
|
|
220
|
-
export declare function createDiagnosticWidget
|
|
220
|
+
export declare function createDiagnosticWidget(options?: {
|
|
221
221
|
/** Prefix for log messages (default: 'WIDGET_DIAG') */
|
|
222
222
|
logPrefix?: string;
|
|
223
223
|
/** Filter function to control which properties are logged */
|
|
@@ -230,4 +230,4 @@ export declare function createDiagnosticWidget<T = unknown>(options?: {
|
|
|
230
230
|
hasRegistry: boolean;
|
|
231
231
|
definition: unknown;
|
|
232
232
|
}) => void;
|
|
233
|
-
}): CustomWidgetRegistration
|
|
233
|
+
}): CustomWidgetRegistration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-eUtMHN9s.cjs"),a={loadingExtended:"لوڈ ہو رہا ہے، براہ کرم انتظار کریں",loadingShort:"لوڈ ہو رہا ہے...",locale:"زبان",iconDescription:"آئیکن",loadingIcon:"لوڈنگ آئیکن",failedToLoadIcon:"آئیکن لوڈ کرنے میں ناکام",editLabel:"ترمیم",selectOne:"ایک منتخب کریں",selectMany:"متعدد منتخب کریں",noResults:"کوئی نتیجہ نہیں",passwordPlaceholderText:"خفیہ پاس ورڈ",togglePasswordVisibility:"پاس ورڈ کی مرئیت تبدیل کریں",toggleMenu:"مینو ٹوگل کریں",toggleAside:"سائیڈ پینل ٹوگل کریں",mainNavigation:"بنیادی نیویگیشن",sidebar:"سائیڈ بار",closeDrawer:"دراز بند کریں",closeModal:"ماڈل بند کریں",confirm:"تصدیق",cancel:"منسوخ",addLabel:"شامل کریں",removeItem:"آئٹم ہٹائیں",currentLocale:"اردو",ar:"عربی",de:"جرمن",en:"انگریزی",es:"ہسپانوی",fr:"فرانسیسی",he:"عبرانی",hi:"ہندی",it:"اطالوی",ja:"جاپانی",ko:"کوریائی",nl:"ڈچ",pl:"پولش",pt:"پرتگالی",ru:"روسی",tr:"ترکی",vi:"ویتنامی",zh:"چینی",fa:"فارسی",ur:"اردو",emailPlaceholderText:"اپنا ای میل داخل کریں",incrementValue:"قدر اضافہ کریں",decrementValue:"قدر کم کریں",dropZoneInstructions:e=>e?"منتخب کرنے کے لیے کلک کریں یا فائلیں یہاں گھسیٹیں، یا فائل منتخب کرنے کے لیے Enter یا Space دبائیں":"فائلیں یہاں گھسیٹیں",fileSizeUnits:["بائٹس","KB","MB","GB","TB"],removeFile:"فائل حذف کریں",clearAllFiles:"تمام فائلیں صاف کریں",clearValue:"قدر صاف کریں",unknownType:"نامعلوم قسم",filesInputInstructions:(e,o,t)=>{let n=e==null||e>1?"منتخب کرنے کے لیے کلک کریں یا فائلیں یہاں گھسیٹیں":"منتخب کرنے کے لیے کلک کریں یا فائل یہاں گھسیٹیں";if(e||o){const l=[];if(e!=null&&e>1&&l.push(`زیادہ سے زیادہ ${e} فائلیں`),o&&t){const i=r.formatFileSize(o,{units:t});l.push(`ہر ایک زیادہ سے زیادہ ${i}`)}l.length>0&&(n+=` (${l.join("، ")})`)}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:e=>`Heading ${e}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"Loading PDF...",loadFailed:"Failed to load PDF",invalidPdf:"Invalid PDF file",pageOutOfRange:(e,o)=>`Page ${e} is out of range (1-${o})`,renderFailed:"Failed to render PDF page"}};exports.default=a;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const r=require("@tempots/dom"),F=require("./translations-eUtMHN9s.cjs"),P=new Map;function I(e){const s=P.get(e)??0;return P.set(e,s+1),`${e}-${s}`}const n={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,s){return n.isSuccess(e)?e.value:s},getOrElseLazy(e,s){return n.isSuccess(e)?e.value:s()},getOrNull(e){return n.isSuccess(e)?e.value:null},getOrUndefined(e){return n.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(n.isSuccess(e))return e.value;throw n.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:s,failure:t,loading:a,notAsked:i=a})=>n.isSuccess(e)?s(e.value):n.isFailure(e)?t(e.error):n.isNotAsked(e)?i():a(e.previousValue),effect:(e,s)=>{switch(e.type){case"AsyncSuccess":s.success?s.success(e.value):s.else?.();break;case"AsyncFailure":s.failure?s.failure(e.error):s.else?.();break;case"Loading":s.loading?s.loading(e.previousValue):s.else?.();break;case"NotAsked":s.notAsked?s.notAsked():s.else?.();break}return e},whenSuccess:(e,s)=>(n.isSuccess(e)&&s(e.value),e),whenFailure:(e,s)=>(n.isFailure(e)&&s(e.error),e),equals:(e,s,t={valueEquals:(a,i)=>a===i,errorEquals:(a,i)=>a===i})=>e.type==="AsyncSuccess"&&s.type==="AsyncSuccess"?t.valueEquals(e.value,s.value):e.type==="AsyncFailure"&&s.type==="AsyncFailure"?t.errorEquals(e.error,s.error):e.type==="Loading"&&s.type==="Loading"?t.valueEquals(e.previousValue,s.previousValue):e.type==="NotAsked"&&s.type==="NotAsked",all:e=>{const s=[];for(const t of e)if(n.isSuccess(t))s.push(t.value);else return t;return n.success(s)},ofPromise:async e=>{try{const s=await e;return n.success(s)}catch(s){return n.failure(s instanceof Error?s:new Error(String(s)))}},map:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(s(e.value));case"NotAsked":return n.notAsked;case"AsyncFailure":return n.failure(e.error);case"Loading":return n.loading(e.previousValue!=null?s(e.previousValue):void 0)}},flatMap:(e,s)=>{switch(e.type){case"AsyncSuccess":return s(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return n.failure(e.error);case"Loading":return n.loading()}},mapError:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return n.failure(s(e.error));case"Loading":return n.loading(e.previousValue)}},flatMapError:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return s(e.error);case"Loading":return n.loading(e.previousValue)}},toResult:e=>{switch(e.type){case"AsyncSuccess":return{type:"Success",value:e.value};case"AsyncFailure":return{type:"Failure",error:e.error};case"NotAsked":case"Loading":return}},isSettled(e){return e.type==="AsyncSuccess"||e.type==="AsyncFailure"},recover:(e,s)=>{switch(e.type){case"AsyncSuccess":return n.success(e.value);case"NotAsked":return n.notAsked;case"AsyncFailure":return n.success(s(e.error));case"Loading":return n.loading(e.previousValue)}},ap:(e,s)=>n.isSuccess(e)&&n.isSuccess(s)?n.success(e.value(s.value)):n.isFailure(e)?n.failure(e.error):n.isFailure(s)?n.failure(s.error):n.isLoading(e)||n.isLoading(s)?n.loading():n.notAsked,map2:(e,s,t)=>n.isSuccess(e)&&n.isSuccess(s)?n.success(t(e.value,s.value)):n.isFailure(e)?n.failure(e.error):n.isFailure(s)?n.failure(s.error):n.isLoading(e)||n.isLoading(s)?n.loading():n.notAsked,map3:(e,s,t,a)=>n.isSuccess(e)&&n.isSuccess(s)&&n.isSuccess(t)?n.success(a(e.value,s.value,t.value)):n.isFailure(e)?n.failure(e.error):n.isFailure(s)?n.failure(s.error):n.isFailure(t)?n.failure(t.error):n.isLoading(e)||n.isLoading(s)||n.isLoading(t)?n.loading():n.notAsked},E=(e,s)=>e===s||e!==e&&s!==s,h={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,s,t)=>h.isValid(e)?s():t(e.error),toResult:(e,s)=>h.match(e,()=>o.success(s),t=>o.failure(t)),effect:(e,s)=>(e.type==="valid"?s.valid?s.valid():s.else?.():s.invalid?s.invalid(e.error):s.else?.(),e),whenValid:(e,s)=>(h.isValid(e)&&s(),e),whenInvalid:(e,s)=>(h.isInvalid(e)&&s(e.error),e),mapError:(e,s)=>e.type==="invalid"?h.invalid(s(e.error)):e,flatMapError:(e,s)=>e.type==="invalid"?s(e.error):e,combine:(e,s,t)=>h.isValid(e)&&h.isValid(s)?h.valid:h.isInvalid(e)&&h.isInvalid(s)?h.invalid(t(e.error,s.error)):h.isInvalid(e)?e:s,all:e=>{for(const s of e)if(h.isInvalid(s))return s;return h.valid},allErrors:e=>{const s=[];for(const t of e)h.isInvalid(t)&&s.push(t.error);return s.length>0?h.invalid(s):h.valid},equals:(e,s,t=(a,i)=>a===i)=>e.type==="valid"&&s.type==="valid"?!0:e.type==="invalid"&&s.type==="invalid"?t(e.error,s.error):!1,recover:e=>h.valid,getError:e=>{if(h.isInvalid(e))return e.error},getErrorOrElse:(e,s)=>h.isInvalid(e)?e.error:s},o={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,s)=>e.type==="Success"?o.success(s(e.value)):e,flatMap:(e,s)=>e.type==="Success"?s(e.value):e,toAsync(e){return o.match(e,s=>n.success(s),s=>n.failure(s))},toValidation(e){return o.match(e,()=>h.valid,s=>h.invalid(s))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,s){return o.isSuccess(e)?e.value:s},getOrElseLazy(e,s){return o.isSuccess(e)?e.value:s()},getOrNull(e){return o.isSuccess(e)?e.value:null},getOrUndefined(e){return o.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(o.isSuccess(e))return e.value;throw e.error},match:(e,s,t)=>o.isSuccess(e)?s(e.value):t(e.error),effect:(e,s)=>(e.type==="Success"?s.success?s.success(e.value):s.else?.():s.failure?s.failure(e.error):s.else?.(),e),whenSuccess:(e,s)=>(o.isSuccess(e)&&s(e.value),e),whenFailure:(e,s)=>(o.isFailure(e)&&s(e.error),e),combine:(e,s,t,a)=>o.match(e,i=>o.match(s,l=>o.success(t(i,l)),l=>o.failure(l)),i=>o.match(s,l=>o.failure(i),l=>o.failure(a(i,l)))),equals:(e,s,t={valueEquals:(a,i)=>a===i,errorEquals:(a,i)=>a===i})=>e.type==="Success"&&s.type==="Success"?t.valueEquals(e.value,s.value):e.type==="Failure"&&s.type==="Failure"?t.errorEquals(e.error,s.error):!1,all:e=>{const s=[];for(const t of e)if(o.isSuccess(t))s.push(t.value);else return t;return o.success(s)},mapError:(e,s)=>e.type==="Failure"?o.failure(s(e.error)):e,flatMapError:(e,s)=>e.type==="Failure"?s(e.error):e,recover:(e,s)=>e.type==="Failure"?{type:"Success",value:s(e.error)}:e,ap:(e,s)=>o.isSuccess(e)&&o.isSuccess(s)?o.success(e.value(s.value)):o.isFailure(e)?o.failure(e.error):o.failure(s.error),map2:(e,s,t)=>o.isSuccess(e)&&o.isSuccess(s)?o.success(t(e.value,s.value)):o.isFailure(e)?o.failure(e.error):o.failure(s.error),map3:(e,s,t,a)=>o.isSuccess(e)&&o.isSuccess(s)&&o.isSuccess(t)?o.success(a(e.value,s.value,t.value)):o.isFailure(e)?o.failure(e.error):o.isFailure(s)?o.failure(s.error):o.failure(t.error),ofPromise:async e=>{try{const s=await e;return o.success(s)}catch(s){return o.failure(s instanceof Error?s:new Error(String(s)))}},swap:e=>o.isSuccess(e)?o.failure(e.value):o.success(e.error),fromNullable:(e,s)=>e==null?o.failure(s):o.success(e),fromNullableLazy:(e,s)=>e==null?o.failure(s()):o.success(e),tryCatch:e=>{try{return o.success(e())}catch(s){return o.failure(s instanceof Error?s:new Error(String(s)))}}};function Z({size:e="sm",icon:s="line-md:close",disabled:t,roundedness:a="full",color:i="base",onClick:l,label:u},...c){return r.Use(F.BeatUII18n,d=>{const m=r.coalesce(u,d.$.closeModal);return F.Button({variant:"text",size:e,roundedness:a,disabled:t,color:i,onClick:l},r.attr.title(m),r.aria.label(m),...c,F.Icon({icon:s,size:e??"sm"}))})}function T(e){return`bc-label bc-label--${e}`}const ee=(...e)=>r.html.span(r.attr.class(T("emphasis")),...e),q=(...e)=>r.html.span(r.attr.class(T("default")),...e),$=(...e)=>r.html.span(r.attr.class(T("muted")),...e),se=(...e)=>r.html.span(r.attr.class(T("danger")),...e),te=e=>{const{value:s,onBlur:t,onChange:a,placeholder:i,disabled:l,id:u,checkedIcon:c,uncheckedIcon:d,iconSize:m="lg"}=e,p=u??I("checkbox"),v=`${p}-label`,b=()=>{if(r.Value.get(l??!1))return;const f=r.Value.get(s);a?.(!f)},k=f=>{r.Value.get(l??!1)||(f.key===" "||f.key==="Enter")&&(f.preventDefault(),b())};return F.InputContainer({baseContainer:!0,growInput:!1,...e,input:r.html.span(r.attr.class("bc-checkbox-input"),r.html.span(r.attr.class("bc-checkbox-input__checkbox"),r.attr.class(r.Value.map(s,f=>f?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),r.attr.class(r.Value.map(l??!1,f=>f?"bc-checkbox-input__checkbox--disabled":"")),r.attr.id(p),r.attr.role("checkbox"),r.attr.tabindex(r.Value.map(l??!1,f=>f?-1:0)),r.aria.checked(s),r.aria.disabled(l),i!=null?r.aria.labelledby(v):r.Empty,r.on.keydown(k),t!=null?r.on.blur(t):r.Empty,F.Icon({icon:r.computedOf(s,c,d)((f,y,S)=>f?y??"akar-icons/check-box-fill":S??"akar-icons/box"),accessibility:"decorative",size:m})),i!=null?r.html.label(r.attr.class("bc-checkbox-input__label"),r.attr.id(v),r.attr.for(p),$(i)):r.Empty)},r.on.click(b))},j=r.html.span(r.attr.class("bc-input-wrapper__required")," *");function re(e){const s=["bc-input-wrapper"];return e!=="vertical"&&s.push(`bc-input-wrapper--${e}`),s.join(" ")}function ae(e,s){const t=["bc-input-wrapper__label-text"];return e?t.push("bc-input-wrapper__label-text--error"):s?t.push("bc-input-wrapper__label-text--disabled"):t.push("bc-input-wrapper__label-text--default"),t.join(" ")}function ie(e,s){if(e==="horizontal-fixed"&&s!=null)return`--input-wrapper-label-width: ${s}`}const M=({fullWidth:e=!1,required:s,label:t,labelChildren:a,context:i,description:l,content:u,error:c,labelFor:d,hasError:m,disabled:p,layout:v,labelWidth:b},...k)=>{const f=m??c!=null,y=p??!1,S=v??"vertical",C=I("input-wrapper"),D=l?`${C}-description`:void 0,O=c!=null?`${C}-error`:void 0,B=r.computedOf(S)(g=>g!=="vertical"),Y=r.computedOf(S,b??void 0)((g,A)=>ie(g,A));return r.html.div(r.attr.class(r.Value.map(S,g=>re(g))),r.attr.class(r.Value.map(e,g=>g?"bc-input-wrapper--full-width":"")),r.attr.style(Y),t!=null||i!=null?r.html.div(r.attr.class("bc-input-wrapper__header"),r.html.div(r.attr.class("bc-input-wrapper__label-section"),r.html.label(r.attr.class("bc-input-wrapper__label"),d!=null?r.attr.for(d):r.Empty,r.html.span(r.attr.class(r.computedOf(f,y)((g,A)=>ae(g??!1,A??!1))),t),t!=null&&s?j:r.Empty),r.When(r.computedOf(B,l)((g,A)=>g&&A!=null),()=>r.html.div(r.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),r.attr.id(D),l))),i!=null?q(i):r.Empty,a):r.Empty,r.html.div(r.attr.class("bc-input-wrapper__content"),[D,O].filter(Boolean).length>0?r.dataAttr.describedby([D,O].filter(Boolean).join(" ")):r.Empty,s?r.dataAttr.required("true"):r.Empty,r.When(f,()=>r.dataAttr.invalid("true")),u),r.When(r.computedOf(B,l)((g,A)=>!g&&A!=null),()=>r.html.div(r.attr.class("bc-input-wrapper__description"),r.attr.id(D),l)),r.When(f,()=>r.html.div(r.attr.class("bc-input-wrapper__error"),r.attr.id(O),r.aria.live("polite"),r.attr.role("alert"),c)),...k)};function ne(...e){return r.html.div(r.attr.class("bc-stack"),...e)}const H=(e,s)=>()=>{e.markTouched(),s?.()},_=(e,s)=>t=>{e.change(t),s?.(t)};function N(e,s){const{controller:t,onBlur:a,onChange:i,id:l,triggerOn:u,...c}=s;return e({id:l??t.name,disabled:t.disabled,value:t.signal,hasError:t.errorVisible,name:t.name,...c,onInput:u==="input"?_(t,i):void 0,onChange:u!=="input"?_(t,i):void 0,onBlur:H(t,a)})}function le(e,{id:s,labelFor:t,...a},...i){const l=s??a.controller.name??I("control"),u=t??l;return M({...a,hasError:a.controller.errorVisible,error:r.TextNode(a.controller.error.map(c=>c??"")),labelFor:u,content:N(c=>e({...c,id:l}),a)},...i)}function z(e,s){const{toInput:t,fromInput:a,controller:i,...l}=s,u=i.transform(t,a);return N(e,{...l,controller:u})}function ce(e,{id:s,labelFor:t,...a},...i){const l=s??a.controller.name??I("control");return M({...a,labelFor:t??l,content:z(e,{...a,id:l})},...i)}function oe(e){return e.split(".").map(t=>{const a=t.match(/^\[(\d+)\]$/);return a?Number(a[1]):t})}function W(e){return typeof e=="number"?`[${e}]`:`.${e}`}function R(e){if(e.length===0)return"";const[s,...t]=e;return[typeof s=="number"?`[${s}]`:s,...t.map(W)].join("")}const ue={valid:h.valid,invalid(e){return h.invalid({message:e})},invalidFields(e){const s={};for(const[t,a]of Object.entries(e))s[t]=typeof a=="string"?{message:a}:a;return h.invalid({dependencies:s})},fromError(e){return h.invalid(e)}};function V(e){return function(t){if(t.type==="valid")return t;let a=t.error;for(const i of e)if(a=a?.dependencies?.[i],a==null)return h.valid;return h.invalid(a)}}class w{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:r.prop(!1),touched:r.prop(!1)};#t;#s=r.prop(void 0);parent;disabled;#r=[];disabledOrHasErrors;constructor(s,t,a,i,l,u=E){this.path=s,this.change=t,this.signal=a,this.status=i,this.#t=u,this.#s.set(a.value),this.error=i.map(c=>c?.type==="invalid"?c.error?.message:void 0),this.hasError=this.error.map(c=>c!=null),this.touched=this.#e.touched,l.validationMode?this.errorVisible=r.computedOf(this.hasError,this.touched,l.validationMode)((c,d,m)=>m==="eager"?!!c:!!c&&!!d):this.errorVisible=r.computedOf(this.hasError,this.touched)((c,d)=>!!c&&!!d),this.dirty=r.computedOf(this.signal,this.#s)((c,d)=>!this.#t(c,d)),this.dependencyErrors=i.map(c=>c?.type==="invalid"?c.error?.dependencies:void 0),this.parent=l,this.disabled=r.computedOf(this.#e.disabled,l.disabled)((c,d)=>c||d),this.disabledOrHasErrors=r.computedOf(this.disabled,this.hasError)((c,d)=>c||d),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#s.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return R(this.path)}onDispose=s=>{this.#r.push(s)};dispose=()=>{for(const s of this.#r)try{s()}catch(t){console.error("Error in dispose callback:",t)}this.#r.length=0};setDisabled=s=>{this.#e.disabled.set(s)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#s.set(this.signal.value)};reset=()=>{this.change(this.#s.value)};array=(s=E)=>new K(this.path,this.change,this.signal,this.status,this.parent,s);object=(s=E)=>new U(this.path,this.change,this.signal,this.status,this.parent,s);transform=(s,t,a=[],i=E)=>new w([...this.path,...a],l=>this.change(t(l)),this.signal.map(s,i),this.status.map(V(a)),this.parent,i);asyncTransform=(s,t,a,i=[],l=E)=>new w([...this.path,...i],u=>{t(u).then(c=>this.change(c))},this.signal.mapAsync(s,a,void 0,l),this.status.map(V(i)),this.parent,l)}class U extends w{#e=new Map;#t=new Map;#s=new Map;#r=r.prop(!1);touchedDeep=this.#r;#i=new Map;#a=new Map;#l=r.prop(!1);dirtyDeep=this.#l;#o;#u;#c=()=>{let s=!1;for(const t of this.#t.values())if(t){s=!0;break}this.#r.set(this.touched.value||s)};constructor(s,t,a,i,l,u){super(s,t,a.map(d=>d??{},u),i,l,u),this.#o=this.touched.on(()=>{this.#c()}),this.#u=this.dirty.on(()=>{this.#n()});const c=this.signal.on(()=>this.#n());this.onDispose(()=>{for(const d of this.#e.values())d.dispose();this.#e.clear();for(const d of this.#s.values())d();this.#s.clear(),this.#t.clear(),this.#r.dispose();for(const d of this.#a.values())d();this.#a.clear(),this.#i.clear(),this.#l.dispose(),this.#o(),this.#u(),c()})}field=s=>{if(this.#e.has(s))return this.#e.get(s);const t=async u=>{this.change({...this.signal.value,[s]:u})},a=new w([...this.path,s],t,this.signal.map(u=>u[s]),this.status.map(V([s])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(s,a);const i=a.touched.on(u=>{this.#t.set(s,u),this.#c()});this.#s.set(s,i);const l=a.dirty.on(u=>{this.#i.set(s,u),this.#n()});return this.#a.set(s,l),a};markAllTouched=()=>{this.markTouched();const s=this.signal.value;for(const t of Object.keys(s))this.field(t).markTouched();for(const t of this.#e.values())t.markTouched()};markAllPristine=()=>{this.markPristine();const s=this.signal.value;for(const t of Object.keys(s))this.field(t).markPristine?.();for(const t of this.#e.values())t.markPristine?.()};#n=()=>{let s=!1;for(const t of this.#i.values())if(t){s=!0;break}this.#l.set(this.dirty.value||s)}}class K extends w{#e=new Array;length;#t=new Map;#s=new Map;#r=r.prop(!1);touchedDeep=this.#r;#i=new Map;#a=new Map;#l=r.prop(!1);dirtyDeep=this.#l;#o;#u;#c=()=>{let s=!1;for(const t of this.#t.values())if(t){s=!0;break}this.#r.set(this.touched.value||s)};constructor(s,t,a,i,l,u){const c=a.map(p=>p??[],u);super(s,t,c,i,l,u);const d=c.on(p=>{const v=this.#e.length-p.length;v>0&&(this.#e.splice(p.length,v).forEach((b,k)=>{const f=p.length+k;b.dispose(),this.#s.get(f)?.(),this.#s.delete(f),this.#t.delete(f),this.#a.get(f)?.(),this.#a.delete(f),this.#i.delete(f)}),this.#c(),this.#n())});this.length=c.map(p=>p.length),this.#o=this.touched.on(()=>{this.#c()}),this.#u=this.dirty.on(()=>{this.#n()});const m=this.signal.on(()=>this.#n());this.onDispose(()=>{for(const p of this.#e)p.dispose();this.length.dispose(),this.#e.length=0,d(),c.dispose();for(const p of this.#s.values())p();this.#s.clear(),this.#t.clear(),this.#r.dispose();for(const p of this.#a.values())p();this.#a.clear(),this.#i.clear(),this.#l.dispose(),this.#o(),this.#u(),m()})}item=s=>{if(this.#e[s])return this.#e[s];const t=async u=>{const c=this.signal.value.slice();c[s]=u,this.change(c)},a=new w([...this.path,s],t,this.signal.map(u=>u[s]),this.status.map(V([s])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[s]=a;const i=a.touched.on(u=>{this.#t.set(s,u),this.#c()});this.#s.set(s,i);const l=a.dirty.on(u=>{this.#i.set(s,u),this.#n()});return this.#a.set(s,l),a};push=(...s)=>{this.change([...this.signal.value,...s])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...s)=>{this.change([...s,...this.signal.value])};removeAt=s=>{this.splice(s,1)};splice=(s,t)=>{const a=this.signal.value.slice();a.splice(s,t),this.change(a)};move=(s,t,a=1)=>{if(a<1||s===t)return;const i=this.signal.value.slice(),l=i.splice(s,a);i.splice(t,0,...l),this.change(i)};markAllTouched=()=>{this.markTouched();const s=this.signal.value.length;for(let t=0;t<s;t++)this.item(t).markTouched()};markAllPristine=()=>{this.markPristine();const s=this.signal.value.length;for(let t=0;t<s;t++)this.item(t).markPristine?.()};#n=()=>{let s=!1;for(const t of this.#i.values())if(t){s=!0;break}this.#l.set(this.dirty.value||s)}}function G(e){function s(t){return typeof t=="number"?t:t.toString()}return e.map(t=>typeof t=="object"&&t.key!=null?s(t.key):s(t))}function J(e){const s=e.filter(i=>i.path==null||i.path.length===0).map(i=>i.message),t=e.filter(i=>i.path!=null&&i.path.length>0).reduce((i,l)=>{const u=G(l.path),c=u.pop();let d=i;for(const m of u)d.dependencies==null&&(d.dependencies={}),d.dependencies[m]==null&&(d.dependencies[m]={}),d=d.dependencies[m];return d.dependencies==null&&(d.dependencies={}),d.dependencies[c]={message:l.message},i},{}),a=s.join(`
|
|
2
|
+
`);return{...t,message:a!=""?a:void 0}}function Q({initialValue:e,onChange:s,validate:t,equals:a,validationMode:i,validateDebounceMs:l}){const u=r.Value.deriveProp(e),c=r.prop(h.valid),d=r.prop(!1),m=r.prop(i??"onTouched"),p=y=>{c.set(y)};let v;const b=async y=>{if(t!=null){const S=await t(y);p(S)}},k=async y=>{u.set(y),s?.(y);const S=m.value;if(t!=null){if(S==="onSubmit")return;const C=l??0;C>0?(v&&clearTimeout(v),v=setTimeout(()=>{b(y)},C)):await b(y)}},f=new w([],k,u,c,{disabled:d,validationMode:m},a??E);return f.onDispose(()=>{d.dispose(),u.dispose(),c.dispose(),m.dispose(),v&&clearTimeout(v)}),{controller:f,setStatus:p}}function x(e){return r.Fragment(r.attr.disabled(e.disabled),r.attr.name(e.name))}function de(e,{triggerOn:s="change"}={}){return r.Fragment(x(e),r.attr.value(e.signal),(s==="input"?r.on.input:r.on.change)(r.emitValue(e.change)))}function he(e,{triggerOn:s="change"}={}){return r.Fragment(x(e),r.attr.valueAsNumber(e.signal),(s==="input"?r.on.input:r.on.change)(r.emitValueAsNumber(e.change)))}function L(e){return e.issues!=null?h.invalid(J(e.issues)):h.valid}async function pe({task:e,errorMessage:s,errorPath:t=["root"],validation:a}){try{const i=await e();return a!=null?a(i):h.valid}catch(i){const l=s??(i instanceof Error?i.message:"Operation failed");return t.length===1&&t[0]==="root"?h.invalid({message:l}):h.invalid({dependencies:X(t,l)})}}function X(e,s){if(e.length===1)return{[e[0]]:{message:s}};const[t,...a]=e;return{[t]:{dependencies:X(a,s)}}}function fe({initialValue:e={},schema:s,onSubmit:t=async()=>h.valid,validationMode:a,validateDebounceMs:i}){const{controller:l,setStatus:u}=Q({initialValue:e,validationMode:a??"onTouched",validateDebounceMs:i,validate:(a??"onTouched")==="onSubmit"||s==null?void 0:async p=>L(await s["~standard"].validate(p))}),c=r.prop(!1),d=l.object();return d.onDispose(c.dispose),{controller:d,setStatus:u,submit:async p=>{if(c.set(!0),p?.preventDefault(),d.markAllTouched(),s!=null){const b=d.signal.value,k=L(await s["~standard"].validate(b));if(u(k),k.type==="invalid"){c.set(!1);return}}const v=await t(d.signal.value);c.set(!1),v.type==="invalid"&&u(v)},submitting:c}}exports.ArrayController=K;exports.BaseControl=N;exports.BaseMappedControl=z;exports.CheckboxInput=te;exports.CloseButton=Z;exports.Control=le;exports.Controller=w;exports.ControllerValidation=ue;exports.DangerLabel=se;exports.EmphasisLabel=ee;exports.InputWrapper=M;exports.Label=q;exports.MappedControl=ce;exports.MutedLabel=$;exports.O=E;exports.ObjectController=U;exports.RequiredSymbol=j;exports.Stack=ne;exports.connectCommonAttributes=x;exports.connectNumberInput=he;exports.connectStringInput=de;exports.convertStandardSchemaIssues=J;exports.convertStandardSchemaPathToPath=G;exports.i=h;exports.makeMapValidation=V;exports.makeOnBlurHandler=H;exports.makeOnChangeHandler=_;exports.parsePath=oe;exports.pathToString=R;exports.sessionId=I;exports.standardSchemaResultToValidation=L;exports.taskToValidation=pe;exports.useController=Q;exports.useForm=fe;exports.wrapSegment=W;
|