tgui-core 6.0.0 → 6.1.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.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Extracts the value of a CSS variable from the document's root element and caches it.
3
+ * Returns empty string if the variable is not defined or has an empty value.
4
+ */
5
+ export declare function getCssVariableValue(variableName: string): string;
6
+ /**
7
+ * Cleans up calculated with `getCssVariableValue` cache
8
+ * Use it only if there is too many variables changed
9
+ * For example, on theme changing
10
+ */
11
+ export declare function clearCssVariableValueCache(): void;
@@ -0,0 +1 @@
1
+ let e={};function t(t){if(t in e)return e[t];let r=getComputedStyle(document.documentElement).getPropertyValue(`--${t}`).trim();return e[t]=r,r||""}function r(){e={}}export{r as clearCssVariableValueCache,t as getCssVariableValue};
@@ -1 +1 @@
1
- function n(n,e,t){return n<e?e:n>t?t:n}function e(n){return n<0?0:n>1?1:n}function t(n,e=0,r=100){return(n-e)/(r-e)}function r(n,e){return Number.parseFloat((Math.round(n*10**e+1e-4*(n>=0?1:-1))/10**e).toFixed(e))}function u(n,e=0){return Number(n).toFixed(Math.max(e,0))}function i(n,e){return e&&n>=e[0]&&n<=e[1]}function o(n,e){for(let t of Object.keys(e))if(i(n,e[t]))return t}function f(n){return Math.floor(n)!==n&&n.toString().split(".")[1].length||0}function a(n){return"number"==typeof n&&Number.isFinite(n)&&!Number.isNaN(n)}function c(n){return 180/Math.PI*n}function m(n,e){let t=Math.round(n/12*1e6)/1e6;return"number"===e?t:`${t}rem`}export{n as clamp,e as clamp01,i as inRange,a as isSafeNumber,o as keyOfMatchingRange,f as numberOfDecimalDigits,m as pxToRem,c as rad2deg,r as round,t as scale,u as toFixed};
1
+ import{getCssVariableValue as n}from"./css.js";function e(n,e,t){return n<e?e:n>t?t:n}function t(n){return n<0?0:n>1?1:n}function r(n,e=0,t=100){return(n-e)/(t-e)}function u(n,e){return Number.parseFloat((Math.round(n*10**e+1e-4*(n>=0?1:-1))/10**e).toFixed(e))}function o(n,e=0){return Number(n).toFixed(Math.max(e,0))}function i(n,e){return e&&n>=e[0]&&n<=e[1]}function f(n,e){for(let t of Object.keys(e))if(i(n,e[t]))return t}function a(n){return Math.floor(n)!==n&&n.toString().split(".")[1].length||0}function c(n){return"number"==typeof n&&Number.isFinite(n)&&!Number.isNaN(n)}function m(n){return 180/Math.PI*n}function s(e,t){let r=Math.round(e/(Number.parseFloat(n("font-size"))||12)*1e6)/1e6;return"number"===t?r:`${r}rem`}export{e as clamp,t as clamp01,i as inRange,c as isSafeNumber,f as keyOfMatchingRange,a as numberOfDecimalDigits,s as pxToRem,m as rad2deg,u as round,r as scale,o as toFixed};
@@ -16,8 +16,4 @@ export declare function throttle<F extends (...args: any[]) => any>(fn: F, time:
16
16
  * @param {number} time
17
17
  */
18
18
  export declare function sleep(time: number): Promise<void>;
19
- /**
20
- * Prevent input parent change event from being called too often
21
- * @param dTime Debounce time, default is 250
22
- */
23
- export declare function inputDebounce(dTime?: number): (onChange: () => void) => void;
19
+ export declare function inputDebounce(id: string, dTime?: number): (onChange: () => void) => void;
@@ -1 +1 @@
1
- function e(t,n,u=!1){let o;return(...e)=>{let i=u&&!o;clearTimeout(o),o=setTimeout(function(){o=null,u||t(...e)},n),i&&t(...e)}}function t(e,t){let n,u;return function o(...i){let r=Date.now();u&&clearTimeout(u),!n||r-n>=t?(e(...i),n=r):u=setTimeout(()=>o(...i),t-(r-(n??0)))}}function n(e){return new Promise(t=>setTimeout(t,e))}function u(t=250){return e(e=>e(),t)}export{e as debounce,u as inputDebounce,n as sleep,t as throttle};
1
+ function e(t,n,u=!1){let o;return(...e)=>{let i=u&&!o;clearTimeout(o),o=setTimeout(function(){o=null,u||t(...e)},n),i&&t(...e)}}function t(e,t){let n,u;return function o(...i){let r=Date.now();u&&clearTimeout(u),!n||r-n>=t?(e(...i),n=r):u=setTimeout(()=>o(...i),t-(r-(n??0)))}}function n(e){return new Promise(t=>setTimeout(t,e))}let u=new Map;function o(t,n=250){let i=u.get(t);return i||(i=e(e=>e(),n),u.set(t,i)),i}export{e as debounce,o as inputDebounce,n as sleep,t as throttle};
package/dist/common/ui.js CHANGED
@@ -1 +1 @@
1
- import{CSS_COLORS as t}from"./constants.js";import{classes as o}from"./react.js";let e=t=>"string"==typeof t?t.endsWith("px")?`${Number.parseFloat(t)/12}rem`:t:"number"==typeof t?`${t}rem`:void 0,n=t=>"string"==typeof t?e(t):"number"==typeof t?e(.5*t):void 0;function i(o){return"string"==typeof o&&t.includes(o)}let r=t=>(o,e)=>{("number"==typeof e||"string"==typeof e)&&(o[t]=e)},l=(t,o)=>(e,n)=>{("number"==typeof n||"string"==typeof n)&&(e[t]=o(n))},p=(t,o)=>(e,n)=>{n&&(e[t]=o)},a=(t,o,e)=>(n,i)=>{if("number"==typeof i||"string"==typeof i)for(let r=0;r<e.length;r++)n[t+e[r]]=o(i)},g=t=>(o,e)=>{i(e)||(o[t]=e)},f={align:r("textAlign"),backgroundColor:g("backgroundColor"),bottom:l("bottom",e),color:g("color"),fontFamily:r("fontFamily"),fontSize:l("fontSize",e),fontWeight:r("fontWeight"),g:l("gap",n),gc:l("columnGap",n),gr:l("rowGap",n),height:l("height",e),left:l("left",e),lineHeight:(t,o)=>{"number"==typeof o?t.lineHeight=o:"string"==typeof o&&(t.lineHeight=e(o))},m:a("margin",n,["Top","Bottom","Left","Right"]),maxHeight:l("maxHeight",e),maxWidth:l("maxWidth",e),mb:l("marginBottom",n),minHeight:l("minHeight",e),minWidth:l("minWidth",e),ml:l("marginLeft",n),mr:l("marginRight",n),mt:l("marginTop",n),mx:a("margin",n,["Left","Right"]),my:a("margin",n,["Top","Bottom"]),opacity:r("opacity"),overflow:r("overflow"),overflowX:r("overflowX"),overflowY:r("overflowY"),p:a("padding",n,["Top","Bottom","Left","Right"]),pb:l("paddingBottom",n),pl:l("paddingLeft",n),position:r("position"),pr:l("paddingRight",n),pt:l("paddingTop",n),px:a("padding",n,["Left","Right"]),py:a("padding",n,["Top","Bottom"]),right:l("right",e),textAlign:r("textAlign"),textColor:g("color"),top:l("top",e),verticalAlign:r("verticalAlign"),width:l("width",e)},m={bold:p("fontWeight","bold"),fillPositionedParent:(t,o)=>{o&&(t.position="absolute",t.top=0,t.bottom=0,t.left=0,t.right=0)},inline:p("display","inline-block"),italic:p("fontStyle","italic"),nowrap:p("whiteSpace","nowrap"),preserveWhitespace:p("whiteSpace","pre-wrap")};function s(t){let o={},e={};for(let n in t){if("style"===n)continue;let i=t[n],r=f[n]||m[n];r?r(e,i):o[n]=i}return o.style={...e,...t.style},o}function u(t){let e=t.textColor||t.color,{backgroundColor:n}=t;return o([i(e)&&`color-${e}`,i(n)&&`color-bg-${n}`])}function c(t){let o={};if(!t)return o;for(let e of t.split(" ")){let[t,n]=e.split("-");if(t)if(t in f){if(""===n)continue;let e=Number(n);!Number.isNaN(e)&&Number.isFinite(e)?o[t]=e:o[t]=n}else t in m?o[t]=!0:console.warn(`Unknown prop ${t}`)}return o}let h=["onClick","onAuxClick","onContextMenu","onDoubleClick","onKeyDown","onKeyUp","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOver","onMouseUp","onScroll","onWheel","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"];export{m as booleanStyleMap,u as computeBoxClassName,s as computeBoxProps,c as computeTwClass,h as eventHandlers,n as halfUnit,f as stringStyleMap,e as unit};
1
+ import{CSS_COLORS as t}from"./constants.js";import{getCssVariableValue as o}from"./css.js";import{classes as e}from"./react.js";let n=t=>{let e=Number.parseFloat(o("font-size"))||12;return"string"==typeof t?t.endsWith("px")?`${Number.parseFloat(t)/e}rem`:t:"number"==typeof t?`${t}rem`:void 0},i=t=>"string"==typeof t?n(t):"number"==typeof t?n(.5*t):void 0;function r(o){return"string"==typeof o&&t.includes(o)}let l=t=>(o,e)=>{("number"==typeof e||"string"==typeof e)&&(o[t]=e)},p=(t,o)=>(e,n)=>{("number"==typeof n||"string"==typeof n)&&(e[t]=o(n))},a=(t,o)=>(e,n)=>{n&&(e[t]=o)},g=(t,o,e)=>(n,i)=>{if("number"==typeof i||"string"==typeof i)for(let r=0;r<e.length;r++)n[t+e[r]]=o(i)},m=t=>(o,e)=>{r(e)||(o[t]=e)},f={align:l("textAlign"),backgroundColor:m("backgroundColor"),bottom:p("bottom",n),color:m("color"),fontFamily:l("fontFamily"),fontSize:p("fontSize",n),fontWeight:l("fontWeight"),g:p("gap",i),gc:p("columnGap",i),gr:p("rowGap",i),height:p("height",n),left:p("left",n),lineHeight:(t,o)=>{"number"==typeof o?t.lineHeight=o:"string"==typeof o&&(t.lineHeight=n(o))},m:g("margin",i,["Top","Bottom","Left","Right"]),maxHeight:p("maxHeight",n),maxWidth:p("maxWidth",n),mb:p("marginBottom",i),minHeight:p("minHeight",n),minWidth:p("minWidth",n),ml:p("marginLeft",i),mr:p("marginRight",i),mt:p("marginTop",i),mx:g("margin",i,["Left","Right"]),my:g("margin",i,["Top","Bottom"]),opacity:l("opacity"),overflow:l("overflow"),overflowX:l("overflowX"),overflowY:l("overflowY"),p:g("padding",i,["Top","Bottom","Left","Right"]),pb:p("paddingBottom",i),pl:p("paddingLeft",i),position:l("position"),pr:p("paddingRight",i),pt:p("paddingTop",i),px:g("padding",i,["Left","Right"]),py:g("padding",i,["Top","Bottom"]),right:p("right",n),textAlign:l("textAlign"),textColor:m("color"),top:p("top",n),verticalAlign:l("verticalAlign"),width:p("width",n)},s={bold:a("fontWeight","bold"),fillPositionedParent:(t,o)=>{o&&(t.position="absolute",t.top=0,t.bottom=0,t.left=0,t.right=0)},inline:a("display","inline-block"),italic:a("fontStyle","italic"),nowrap:a("whiteSpace","nowrap"),preserveWhitespace:a("whiteSpace","pre-wrap")};function u(t){let o={},e={};for(let n in t){if("style"===n)continue;let i=t[n],r=f[n]||s[n];r?r(e,i):o[n]=i}return o.style={...e,...t.style},o}function c(t){let o=t.textColor||t.color,{backgroundColor:n}=t;return e([r(o)&&`color-${o}`,r(n)&&`color-bg-${n}`])}function h(t){let o={};if(!t)return o;for(let e of t.split(" ")){let[t,n]=e.split("-");if(t)if(t in f){if(""===n)continue;let e=Number(n);!Number.isNaN(e)&&Number.isFinite(e)?o[t]=e:o[t]=n}else t in s?o[t]=!0:console.warn(`Unknown prop ${t}`)}return o}let d=["onClick","onAuxClick","onContextMenu","onDoubleClick","onKeyDown","onKeyUp","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOver","onMouseUp","onScroll","onWheel","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"];export{s as booleanStyleMap,c as computeBoxClassName,u as computeBoxProps,h as computeTwClass,d as eventHandlers,i as halfUnit,f as stringStyleMap,n as unit};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{inputDebounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as m}from"../common/ui.js";import{useEffect as c,useRef as l,useState as a}from"react";function p(p){let{autoFocus:i,autoSelect:f,className:s,disabled:d,expensive:g,fluid:v,maxLength:T,monospace:y,onBlur:b,onChange:j,onEnter:I,onEscape:h,onKeyDown:k,placeholder:x,ref:C,selfClear:D,alwaysUpdate:E,spellcheck:w=!1,value:B,...K}=p,L=l(null),N=C??L,[q,z]=a(B??"");c(()=>{let e;return(i||f)&&(e=setTimeout(()=>{N.current?.focus(),f&&N.current?.select()},1)),()=>clearTimeout(e)},[]),c(()=>{(N.current&&document.activeElement!==N.current&&B!==q||E)&&z(B??"")},[B]);let A=m(K),F=n(["Input",d&&"Input--disabled",v&&"Input--fluid",y&&"Input--monospace",o(K),s]);return e("input",{...A,autoComplete:"off",className:F,disabled:d,maxLength:T,onBlur:()=>b?.(q),onChange:function(e){let t=e.currentTarget.value;z(t),g?u("number"==typeof g?g:250)(()=>j?.(t,e)):j?.(t,e)},onKeyDown:function(e){if(k?.(e),e.key===t.Enter){e.preventDefault(),I?.(e.currentTarget.value,e),D&&z(""),e.currentTarget.blur();return}r(e.key)&&(e.preventDefault(),h?.(e.currentTarget.value,e),e.currentTarget.blur())},placeholder:x,ref:N,spellCheck:w,type:"text",value:q})}export{p as Input};
1
+ import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{inputDebounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as m}from"../common/ui.js";import{useEffect as c,useId as l,useRef as a,useState as p}from"react";function i(i){let{autoFocus:f,autoSelect:s,className:d,disabled:g,expensive:v,fluid:T,maxLength:y,monospace:b,onBlur:j,onChange:I,onEnter:h,onEscape:k,onKeyDown:x,placeholder:C,ref:D,selfClear:E,alwaysUpdate:w,spellcheck:B=!1,value:K,...L}=i,N=a(null),q=D??N,[z,A]=p(K??""),F=l();c(()=>{let e;return(f||s)&&(e=setTimeout(()=>{q.current?.focus(),s&&q.current?.select()},1)),()=>clearTimeout(e)},[]),c(()=>{(q.current&&document.activeElement!==q.current&&K!==z||w)&&A(K??"")},[K]);let G=m(L),H=n(["Input",g&&"Input--disabled",T&&"Input--fluid",b&&"Input--monospace",o(L),d]);return e("input",{...G,autoComplete:"off",className:H,disabled:g,maxLength:y,onBlur:()=>j?.(z),onChange:function(e){let t=e.currentTarget.value;A(t),v?u(F,"number"==typeof v?v:250)(()=>I?.(t,e)):I?.(t,e)},onKeyDown:function(e){if(x?.(e),e.key===t.Enter){e.preventDefault(),h?.(e.currentTarget.value,e),E&&A(""),e.currentTarget.blur();return}r(e.key)&&(e.preventDefault(),k?.(e.currentTarget.value,e),e.currentTarget.blur())},placeholder:C,ref:q,spellCheck:B,type:"text",value:z})}export{i as Input};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{inputDebounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as i}from"../common/ui.js";import{useEffect as m,useRef as c,useState as l}from"react";function f(f){let{allowFloats:p,autoFocus:a,autoSelect:s,className:d,disabled:v,expensive:y,fluid:b,maxValue:I=1e4,minValue:j=0,monospace:k,onBlur:D,onChange:x,onEnter:C,onEscape:R,onKeyDown:g,onValidationChange:h,value:E,...N}=f,T=c(null),[w,B]=l(E??j),[K,M]=l(!0);function q(e,t){x&&(y?u("number"==typeof y?y:250)(()=>x?.(e,t)):x(e,t))}m(()=>{let e;return(a||s)&&(e=setTimeout(()=>{T.current?.focus(),s&&T.current?.select()},1)),()=>clearTimeout(e)},[]),m(()=>{if(T.current){let e=T.current.validity.valid;K!==e&&(M(e),h?.(e))}},[w]),m(()=>{T.current&&document.activeElement!==T.current&&E!==w&&B(E??j)},[E]);let z=i(N),A=n(["Input","RestrictedInput",v&&"Input--disabled",b&&"Input--fluid",k&&"Input--monospace",o(N),d,!K&&"RestrictedInput--invalid"]);return e("input",{...z,autoComplete:"off",className:A,disabled:v,max:I,min:j,onBlur:function(e){D?.(w)},onChange:function(e){let t=Number(e.target.value);B(t),q(t,e)},onKeyDown:function(e){if(g?.(e),e.key===t.Enter){e.preventDefault(),C?.(w,e),T.current?.blur();return}if(r(e.key)){e.preventDefault(),R?.(w,e),T.current?.blur();return}if(e.key===t.Minus){e.preventDefault();let t=-1*w;B(t),q(t,e);return}},ref:T,spellCheck:!1,step:p?"any":"1",type:"number",value:w})}export{f as RestrictedInput};
1
+ import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{inputDebounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as i}from"../common/ui.js";import{useEffect as m,useId as c,useRef as l,useState as f}from"react";function p(p){let{allowFloats:a,autoFocus:s,autoSelect:d,className:v,disabled:y,expensive:b,fluid:I,maxValue:j=1e4,minValue:k=0,monospace:D,onBlur:x,onChange:C,onEnter:R,onEscape:g,onKeyDown:h,onValidationChange:E,value:N,...T}=p,w=l(null),[B,K]=f(N??k),[M,q]=f(!0),z=c();function A(e,t){C&&(b?u(z,"number"==typeof b?b:250)(()=>C?.(e,t)):C(e,t))}m(()=>{let e;return(s||d)&&(e=setTimeout(()=>{w.current?.focus(),d&&w.current?.select()},1)),()=>clearTimeout(e)},[]),m(()=>{if(w.current){let e=w.current.validity.valid;M!==e&&(q(e),E?.(e))}},[B]),m(()=>{w.current&&document.activeElement!==w.current&&N!==B&&K(N??k)},[N]);let F=i(T),G=n(["Input","RestrictedInput",y&&"Input--disabled",I&&"Input--fluid",D&&"Input--monospace",o(T),v,!M&&"RestrictedInput--invalid"]);return e("input",{...F,autoComplete:"off",className:G,disabled:y,max:j,min:k,onBlur:function(e){x?.(B)},onChange:function(e){let t=Number(e.target.value);K(t),A(t,e)},onKeyDown:function(e){if(h?.(e),e.key===t.Enter){e.preventDefault(),R?.(B,e),w.current?.blur();return}if(r(e.key)){e.preventDefault(),g?.(B,e),w.current?.blur();return}if(e.key===t.Minus){e.preventDefault();let t=-1*B;K(t),A(t,e);return}},ref:w,spellCheck:!1,step:a?"any":"1",type:"number",value:B})}export{p as RestrictedInput};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{KEY as r,isEscape as t}from"../common/keys.js";import{classes as n}from"../common/react.js";import{computeBoxClassName as u,computeBoxProps as o}from"../common/ui.js";import{inputDebounce as a}from"../common/timer.js";import{useEffect as c,useRef as l,useState as m}from"react";function i(i){let{autoFocus:s,autoSelect:f,className:g,disabled:p,dontUseTabForIndent:T,expensive:y,fluid:b,maxLength:v,monospace:d,onBlur:k,onChange:$,onEnter:h,onEscape:x,onKeyDown:j,placeholder:D,ref:E,selfClear:I,spellcheck:K=!1,userMarkup:C,value:A,...w}=i,B=l(null),L=E??B,[N,q]=m(A??"");c(()=>{(s||f)&&setTimeout(()=>{L.current?.focus(),f&&L.current?.select()},1)},[]),c(()=>{L.current&&document.activeElement!==L.current&&A!==N&&q(A??"")},[A]);let z=o(w),F=n(["Input","TextArea",b&&"Input--fluid",d&&"Input--monospace",p&&"Input--disabled",u(w),g]);return e("textarea",{...z,autoComplete:"off",className:F,maxLength:v,onBlur:function(e){k?.(N)},onChange:function(e){let r=e.currentTarget.value;q(r),$&&(y?a("number"==typeof y?y:250)(()=>$?.(r,e)):$(r,e))},onKeyDown:function(e){if(j?.(e),e.key===r.Enter&&!e.shiftKey){e.preventDefault(),h?.(e.currentTarget.value,e),I&&q(""),e.currentTarget.blur();return}if(t(e.key)){x?.(e.currentTarget.value,e),e.currentTarget.blur();return}if(!T&&e.key===r.Tab){e.preventDefault();let{value:r,selectionStart:t,selectionEnd:n}=e.currentTarget;q(`${r.substring(0,t)} ${r.substring(n)}`),e.currentTarget.selectionEnd=t+1,$?.(e.currentTarget.value,e);return}if(C&&(e.ctrlKey||e.metaKey)&&C[e.key]){e.preventDefault();let{selectionStart:r,selectionEnd:t,value:n}=e.currentTarget,u=C[e.key];q(`${n.substring(0,r)}${u}${n.substring(r,t)}${u}${n.substring(t)}`),e.currentTarget.selectionEnd=t+2*u.length,$?.(e.currentTarget.value,e);return}},placeholder:D,ref:L,spellCheck:K,value:N})}export{i as TextArea};
1
+ import{jsx as e}from"react/jsx-runtime";import{KEY as r,isEscape as t}from"../common/keys.js";import{classes as n}from"../common/react.js";import{computeBoxClassName as u,computeBoxProps as o}from"../common/ui.js";import{inputDebounce as a}from"../common/timer.js";import{useEffect as c,useId as l,useRef as m,useState as i}from"react";function s(s){let{autoFocus:f,autoSelect:g,className:p,disabled:T,dontUseTabForIndent:y,expensive:b,fluid:v,maxLength:d,monospace:k,onBlur:$,onChange:h,onEnter:x,onEscape:j,onKeyDown:D,placeholder:E,ref:I,selfClear:K,spellcheck:C=!1,userMarkup:A,value:w,...B}=s,L=m(null),N=I??L,[q,z]=i(w??""),F=l();c(()=>{(f||g)&&setTimeout(()=>{N.current?.focus(),g&&N.current?.select()},1)},[]),c(()=>{N.current&&document.activeElement!==N.current&&w!==q&&z(w??"")},[w]);let G=o(B),H=n(["Input","TextArea",v&&"Input--fluid",k&&"Input--monospace",T&&"Input--disabled",u(B),p]);return e("textarea",{...G,autoComplete:"off",className:H,maxLength:d,onBlur:function(e){$?.(q)},onChange:function(e){let r=e.currentTarget.value;z(r),h&&(b?a(F,"number"==typeof b?b:250)(()=>h?.(r,e)):h(r,e))},onKeyDown:function(e){if(D?.(e),e.key===r.Enter&&!e.shiftKey){e.preventDefault(),x?.(e.currentTarget.value,e),K&&z(""),e.currentTarget.blur();return}if(t(e.key)){j?.(e.currentTarget.value,e),e.currentTarget.blur();return}if(!y&&e.key===r.Tab){e.preventDefault();let{value:r,selectionStart:t,selectionEnd:n}=e.currentTarget;z(`${r.substring(0,t)} ${r.substring(n)}`),e.currentTarget.selectionEnd=t+1,h?.(e.currentTarget.value,e);return}if(A&&(e.ctrlKey||e.metaKey)&&A[e.key]){e.preventDefault();let{selectionStart:r,selectionEnd:t,value:n}=e.currentTarget,u=A[e.key];z(`${n.substring(0,r)}${u}${n.substring(r,t)}${u}${n.substring(t)}`),e.currentTarget.selectionEnd=t+2*u.length,h?.(e.currentTarget.value,e);return}},placeholder:E,ref:N,spellCheck:C,value:q})}export{s as TextArea};
package/package.json CHANGED
@@ -71,5 +71,5 @@
71
71
  "test": "bun test"
72
72
  },
73
73
  "type": "module",
74
- "version": "6.0.0"
74
+ "version": "6.1.0"
75
75
  }
@@ -8,7 +8,8 @@
8
8
  min-height: var(--button-height);
9
9
  padding: 0 var(--space-m);
10
10
  background-color: var(--progress-bar-background);
11
- border: var(--border-thickness-tiny) solid var(--progress-bar-color);
11
+ border: var(--border-thickness-tiny) solid;
12
+ border-color: var(--progress-bar-color);
12
13
  border-radius: var(--progress-bar-border-radius);
13
14
  transition: border-color var(--progress-bar-transition) ease-out;
14
15