@starasia/input 3.0.5 → 3.0.6
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/input.es.js +33 -28
- package/dist/input.umd.js +7 -2
- package/package.json +1 -1
package/dist/input.es.js
CHANGED
|
@@ -24,6 +24,7 @@ const Sn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
24
24
|
--sa-input-border-disabled: var(--sa-border-disabled, #0515240e);
|
|
25
25
|
|
|
26
26
|
--sa-input-bg-neutral: var(--sa-background-neutral, #f0f1f2);
|
|
27
|
+
--sa-input-bg-disable: var(--sa-background-disable, #17171708);
|
|
27
28
|
--sa-input-bg-error-subtlest: var(--sa-background-error-subtlest, #fff0f3);
|
|
28
29
|
--sa-input-bg-success-subtlest: var(--sa-background-success-subtlest, #ecfff6);
|
|
29
30
|
--sa-input-accent-subtle: var(--sa-background-neutral, #f0f1f2);
|
|
@@ -275,6 +276,10 @@ const Sn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
275
276
|
background: var(--sa-input-bg-neutral);
|
|
276
277
|
border-color: transparent;
|
|
277
278
|
}
|
|
279
|
+
.sa-tf-variant-outline.sa-tf-status-disable .sa-tf-box,
|
|
280
|
+
.sa-tf-variant-outline.sa-tf-disabled .sa-tf-box {
|
|
281
|
+
background: var(--sa-input-bg-disable);
|
|
282
|
+
}
|
|
278
283
|
.sa-tf-status-disable .sa-tf-input,
|
|
279
284
|
.sa-tf-disabled .sa-tf-input {
|
|
280
285
|
color: var(--sa-input-text-disable);
|
|
@@ -593,7 +598,7 @@ const Sn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
593
598
|
error: "var(--sa-text-error, #a4133c)",
|
|
594
599
|
success: "var(--sa-text-success, #208958)",
|
|
595
600
|
disable: "var(--sa-icon-disable, #181a198f)"
|
|
596
|
-
},
|
|
601
|
+
}, bn = (n, a) => a ? G.disable : G[n] ?? G.default;
|
|
597
602
|
function En(n) {
|
|
598
603
|
return Number(n.replace(/\./g, ""));
|
|
599
604
|
}
|
|
@@ -612,10 +617,10 @@ function Dn(n, a) {
|
|
|
612
617
|
}
|
|
613
618
|
const Fn = xn(
|
|
614
619
|
({ options: n, value: a, setValue: r, isComponentVisible: l, onOptionChange: d }, f) => {
|
|
615
|
-
const [
|
|
620
|
+
const [h, V] = I([]), c = L(null), u = () => {
|
|
616
621
|
if (f != null && f.current && c.current) {
|
|
617
|
-
const x = window.innerHeight,
|
|
618
|
-
c.current.style.left = `${
|
|
622
|
+
const x = window.innerHeight, b = f == null ? void 0 : f.current.getBoundingClientRect(), m = c.current.getBoundingClientRect(), w = b.bottom + m.height;
|
|
623
|
+
c.current.style.left = `${b.left}px`, c.current.style.width = `${b.width}px`, w >= x - 10 ? c.current.style.top = `${b.top - m.height - 5}px` : c.current.style.top = `${b.top + b.height}px`;
|
|
619
624
|
}
|
|
620
625
|
};
|
|
621
626
|
return O(() => (window.addEventListener("scroll", u), window.addEventListener("resize", u), () => {
|
|
@@ -642,7 +647,7 @@ const Fn = xn(
|
|
|
642
647
|
overflow: "auto",
|
|
643
648
|
zIndex: 5e4
|
|
644
649
|
},
|
|
645
|
-
children:
|
|
650
|
+
children: h == null ? void 0 : h.map(
|
|
646
651
|
(x) => Tn(x, a, r, d)
|
|
647
652
|
)
|
|
648
653
|
}
|
|
@@ -679,10 +684,10 @@ function On(n) {
|
|
|
679
684
|
document.removeEventListener("click", d, !0);
|
|
680
685
|
}), []), { ref: l, isComponentVisible: a, setIsComponentVisible: r };
|
|
681
686
|
}
|
|
682
|
-
const
|
|
683
|
-
if (!(typeof document > "u") && !document.getElementById(
|
|
687
|
+
const pn = "sa-input-styles", Vn = (n) => {
|
|
688
|
+
if (!(typeof document > "u") && !document.getElementById(pn)) {
|
|
684
689
|
const a = document.createElement("style");
|
|
685
|
-
a.id =
|
|
690
|
+
a.id = pn, a.textContent = n, document.head.appendChild(a);
|
|
686
691
|
}
|
|
687
692
|
};
|
|
688
693
|
Vn(Sn);
|
|
@@ -734,24 +739,24 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
734
739
|
variant: l = "outline",
|
|
735
740
|
status: d = "default",
|
|
736
741
|
label: f,
|
|
737
|
-
labelPosition:
|
|
742
|
+
labelPosition: h = "outside-top",
|
|
738
743
|
required: V,
|
|
739
744
|
optional: c,
|
|
740
745
|
description: u,
|
|
741
746
|
helperText: x,
|
|
742
|
-
errorText:
|
|
747
|
+
errorText: b,
|
|
743
748
|
leftIcon: m,
|
|
744
749
|
rightIcon: w,
|
|
745
750
|
leftAddons: B,
|
|
746
751
|
rightAddons: R,
|
|
747
752
|
onClickLeftIcon: Q,
|
|
748
753
|
onClickRightIcon: Z,
|
|
749
|
-
fullWidth:
|
|
754
|
+
fullWidth: gn = !1,
|
|
750
755
|
highlightPlaceholder: $,
|
|
751
756
|
currency: S,
|
|
752
757
|
options: E,
|
|
753
758
|
onOptionChange: j,
|
|
754
|
-
clearable:
|
|
759
|
+
clearable: hn = !0,
|
|
755
760
|
onClear: Y,
|
|
756
761
|
...e
|
|
757
762
|
} = n, A = e.value !== void 0, [W, y] = I(() => {
|
|
@@ -770,7 +775,7 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
770
775
|
if (!A)
|
|
771
776
|
return;
|
|
772
777
|
const t = e.value === void 0 || e.value === null ? "" : String(e.value), i = S ? J(t) : t;
|
|
773
|
-
y((
|
|
778
|
+
y((p) => p === i ? p : i);
|
|
774
779
|
}, [e.value, S, A]), un(() => {
|
|
775
780
|
if (k.current === null)
|
|
776
781
|
return;
|
|
@@ -781,17 +786,17 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
781
786
|
} catch {
|
|
782
787
|
}
|
|
783
788
|
}, [W]);
|
|
784
|
-
const N = W, D = N !== "" && N !== void 0, v = d === "disable" || e.disabled, P = v ? "disable" : d, H =
|
|
789
|
+
const N = W, D = N !== "" && N !== void 0, v = d === "disable" || e.disabled, P = v ? "disable" : d, H = h === "inside", wn = H && (D || nn), q = [
|
|
785
790
|
"sa-tf",
|
|
786
791
|
`sa-tf-variant-${l}`,
|
|
787
792
|
`sa-tf-size-${r}`,
|
|
788
793
|
`sa-tf-status-${P}`,
|
|
789
|
-
`sa-tf-label-${
|
|
794
|
+
`sa-tf-label-${h}`,
|
|
790
795
|
nn ? "sa-tf-focused" : "",
|
|
791
796
|
v ? "sa-tf-disabled" : "",
|
|
792
797
|
wn ? "sa-tf-floating" : "",
|
|
793
798
|
f ? "" : "sa-tf-no-label",
|
|
794
|
-
|
|
799
|
+
gn ? "sa-tf-fullwidth" : ""
|
|
795
800
|
].filter(Boolean).join(" "), yn = () => {
|
|
796
801
|
var t;
|
|
797
802
|
return (t = C.current) == null ? void 0 : t.focus();
|
|
@@ -803,12 +808,12 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
803
808
|
return;
|
|
804
809
|
}
|
|
805
810
|
const i = t.target.value;
|
|
806
|
-
let
|
|
811
|
+
let p = i, g = t.target.selectionStart ?? i.length;
|
|
807
812
|
if (mn === "Backspace") {
|
|
808
813
|
const T = W.replace(/\D/g, ""), In = i.replace(/\D/g, "");
|
|
809
|
-
T.length === In.length &&
|
|
814
|
+
T.length === In.length && g > 0 && (p = i.slice(0, g - 1) + i.slice(g), g -= 1);
|
|
810
815
|
}
|
|
811
|
-
const X = J(
|
|
816
|
+
const X = J(p), Cn = p.slice(0, g).replace(/\D/g, "").length, Nn = Dn(X, Cn);
|
|
812
817
|
k.current = Nn, y(X), (cn = e.onChange) == null || cn.call(e, {
|
|
813
818
|
...t,
|
|
814
819
|
target: {
|
|
@@ -830,7 +835,7 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
830
835
|
V ? /* @__PURE__ */ s("span", { className: "sa-tf-required", "aria-hidden": "true", children: "*" }) : null
|
|
831
836
|
] }) : null, _ = /* @__PURE__ */ o(Ln, { children: [
|
|
832
837
|
x ? /* @__PURE__ */ s("p", { className: "sa-tf-helper", children: x }) : null,
|
|
833
|
-
|
|
838
|
+
b && d === "error" ? /* @__PURE__ */ s("p", { className: "sa-tf-error", children: b }) : null
|
|
834
839
|
] }), F = (t, i) => /* @__PURE__ */ s(
|
|
835
840
|
"span",
|
|
836
841
|
{
|
|
@@ -839,8 +844,8 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
839
844
|
children: Bn.cloneElement(t, {
|
|
840
845
|
width: z(r),
|
|
841
846
|
height: z(r),
|
|
842
|
-
color:
|
|
843
|
-
style: { color:
|
|
847
|
+
color: bn(P, v),
|
|
848
|
+
style: { color: bn(P, v) }
|
|
844
849
|
})
|
|
845
850
|
}
|
|
846
851
|
), rn = d === "success" ? /* @__PURE__ */ s("span", { className: "sa-tf-icon sa-tf-success-mark", "aria-hidden": "true", children: /* @__PURE__ */ s(
|
|
@@ -849,7 +854,7 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
849
854
|
width: z(r),
|
|
850
855
|
height: z(r)
|
|
851
856
|
}
|
|
852
|
-
) }) : null, on =
|
|
857
|
+
) }) : null, on = hn && !v ? /* @__PURE__ */ s(
|
|
853
858
|
"button",
|
|
854
859
|
{
|
|
855
860
|
type: "button",
|
|
@@ -858,15 +863,15 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
858
863
|
"aria-hidden": !D,
|
|
859
864
|
tabIndex: -1,
|
|
860
865
|
onClick: (t) => {
|
|
861
|
-
var
|
|
866
|
+
var p;
|
|
862
867
|
t.stopPropagation(), A || y("");
|
|
863
868
|
const i = {
|
|
864
869
|
target: { value: "", name: e.name },
|
|
865
870
|
currentTarget: { value: "", name: e.name }
|
|
866
871
|
};
|
|
867
|
-
(
|
|
868
|
-
var
|
|
869
|
-
return (
|
|
872
|
+
(p = e.onChange) == null || p.call(e, i), Y == null || Y(), k.current = 0, requestAnimationFrame(() => {
|
|
873
|
+
var g;
|
|
874
|
+
return (g = C.current) == null ? void 0 : g.focus();
|
|
870
875
|
});
|
|
871
876
|
},
|
|
872
877
|
onMouseDown: (t) => t.preventDefault(),
|
|
@@ -951,7 +956,7 @@ const $n = (n) => /* @__PURE__ */ o(
|
|
|
951
956
|
R ? /* @__PURE__ */ s("div", { className: "sa-tf-addon sa-tf-addon-right", children: R }) : null,
|
|
952
957
|
dn
|
|
953
958
|
] });
|
|
954
|
-
return
|
|
959
|
+
return h === "outside-left" ? /* @__PURE__ */ o("div", { className: q, children: [
|
|
955
960
|
/* @__PURE__ */ o("div", { className: "sa-tf-label-col", children: [
|
|
956
961
|
K("sa-tf-label"),
|
|
957
962
|
u ? /* @__PURE__ */ s("p", { className: "sa-tf-desc-top", children: u }) : null
|
package/dist/input.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(x,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(x=typeof globalThis<"u"?globalThis:x||self,n(x.Input={},x.jsxRuntime,x.React))})(this,function(x,n,o){"use strict";const
|
|
1
|
+
(function(x,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],n):(x=typeof globalThis<"u"?globalThis:x||self,n(x.Input={},x.jsxRuntime,x.React))})(this,function(x,n,o){"use strict";const bn=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
/* Layer 3 — references Layer 2 semantic tokens */
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
--sa-input-border-disabled: var(--sa-border-disabled, #0515240e);
|
|
23
23
|
|
|
24
24
|
--sa-input-bg-neutral: var(--sa-background-neutral, #f0f1f2);
|
|
25
|
+
--sa-input-bg-disable: var(--sa-background-disable, #17171708);
|
|
25
26
|
--sa-input-bg-error-subtlest: var(--sa-background-error-subtlest, #fff0f3);
|
|
26
27
|
--sa-input-bg-success-subtlest: var(--sa-background-success-subtlest, #ecfff6);
|
|
27
28
|
--sa-input-accent-subtle: var(--sa-background-neutral, #f0f1f2);
|
|
@@ -273,6 +274,10 @@
|
|
|
273
274
|
background: var(--sa-input-bg-neutral);
|
|
274
275
|
border-color: transparent;
|
|
275
276
|
}
|
|
277
|
+
.sa-tf-variant-outline.sa-tf-status-disable .sa-tf-box,
|
|
278
|
+
.sa-tf-variant-outline.sa-tf-disabled .sa-tf-box {
|
|
279
|
+
background: var(--sa-input-bg-disable);
|
|
280
|
+
}
|
|
276
281
|
.sa-tf-status-disable .sa-tf-input,
|
|
277
282
|
.sa-tf-disabled .sa-tf-input {
|
|
278
283
|
color: var(--sa-input-text-disable);
|
|
@@ -586,4 +591,4 @@
|
|
|
586
591
|
.sa-tf-label-inside.sa-tf-floating.sa-tf-size-xl .sa-tf-box {
|
|
587
592
|
min-height: 80px;
|
|
588
593
|
}
|
|
589
|
-
`,y=t=>t==="lg"||t==="xl"?18:16,j={default:"var(--sa-color-gray-800, #505258)",error:"var(--sa-text-error, #a4133c)",success:"var(--sa-text-success, #208958)",disable:"var(--sa-icon-disable, #181a198f)"},J=(t,a)=>a?j.disable:j[t]??j.default;function
|
|
594
|
+
`,y=t=>t==="lg"||t==="xl"?18:16,j={default:"var(--sa-color-gray-800, #505258)",error:"var(--sa-text-error, #a4133c)",success:"var(--sa-text-success, #208958)",disable:"var(--sa-icon-disable, #181a198f)"},J=(t,a)=>a?j.disable:j[t]??j.default;function pn(t){return Number(t.replace(/\./g,""))}function O(t){let a=t.replace(/[^\d]/g,"");return a=a.replace(/^0+(?=\d)/,""),a.replace(/\B(?=(\d{3})+(?!\d))/g,".")}function xn(t,a){if(a<=0)return 0;let i=0;for(let l=0;l<t.length;l++)if(/\d/.test(t[l])&&(i+=1,i===a))return l+1;return t.length}const hn=o.forwardRef(({options:t,value:a,setValue:i,isComponentVisible:l,onOptionChange:d},f)=>{const[v,V]=o.useState([]),c=o.useRef(null),u=()=>{if(f!=null&&f.current&&c.current){const h=window.innerHeight,b=f==null?void 0:f.current.getBoundingClientRect(),m=c.current.getBoundingClientRect(),k=b.bottom+m.height;c.current.style.left=`${b.left}px`,c.current.style.width=`${b.width}px`,k>=h-10?c.current.style.top=`${b.top-m.height-5}px`:c.current.style.top=`${b.top+b.height}px`}};return o.useEffect(()=>(window.addEventListener("scroll",u),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}),[f,c]),o.useEffect(()=>{u()},[l]),o.useEffect(()=>{V((t==null?void 0:t.filter(h=>h.toLowerCase().startsWith(a.toLowerCase())))||[])},[a,t]),n.jsx("div",{ref:c,style:{position:"fixed",padding:"8px",boxSizing:"border-box",boxShadow:"0px 8px 12px 0px var(--sa-color-black-alpha-a8, #00000014)",borderRadius:"8px",background:"white",overflow:"auto",zIndex:5e4},children:v==null?void 0:v.map(h=>gn(h,a,i,d))})}),gn=(t,a,i,l)=>{const d=t.toLowerCase().indexOf(a.toLowerCase());return n.jsxs("p",{style:{fontFamily:"Poppins",color:"var(--sa-color-gray-400, #b7b9be)",fontWeight:500,padding:"8px 14px",cursor:"pointer"},onClick:()=>{i(t),l&&l(t)},children:[t.slice(0,d),n.jsx("span",{style:{color:"var(--sa-text-primary, #292a2e)"},children:t.slice(d,d+a.length)}),t.slice(d+a.length)]})};function vn(t){const[a,i]=o.useState(t),l=o.useRef(null),d=f=>{l.current&&!l.current.contains(f.target)&&i(!1)};return o.useEffect(()=>(document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}),[]),{ref:l,isComponentVisible:a,setIsComponentVisible:i}}const Q="sa-input-styles";(t=>{if(!(typeof document>"u")&&!document.getElementById(Q)){const a=document.createElement("style");a.id=Q,a.textContent=t,document.head.appendChild(a)}})(bn);const mn=t=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[n.jsx("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M5.2 8.2l1.8 1.8 3.8-4.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),wn=t=>n.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[n.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"currentColor",opacity:"0.2"}),n.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]}),Z=o.forwardRef((t,a)=>{const{size:i="md",variant:l="outline",status:d="default",label:f,labelPosition:v="outside-top",required:V,optional:c,description:u,helperText:h,errorText:b,leftIcon:m,rightIcon:k,leftAddons:S,rightAddons:L,onClickLeftIcon:R,onClickRightIcon:nn,fullWidth:kn=!1,highlightPlaceholder:$,currency:B,options:E,onOptionChange:Y,clearable:zn=!0,onClear:A,...s}=t,M=s.value!==void 0,[P,z]=o.useState(()=>{const e=s.value!==void 0?String(s.value??""):String(s.defaultValue??"");return B?O(e):e}),[tn,en]=o.useState(!1),[Cn,sn]=o.useState(""),C=o.useRef(null),N=o.useRef(null);o.useImperativeHandle(a,()=>N.current);const an=o.useRef(s.id??`sa-input-${Math.random().toString(36).slice(2,9)}`),{isComponentVisible:rn,ref:W,setIsComponentVisible:Nn}=vn(!1);o.useLayoutEffect(()=>{if(!M)return;const e=s.value===void 0||s.value===null?"":String(s.value),r=B?O(e):e;z(p=>p===r?p:r)},[s.value,B,M]),o.useLayoutEffect(()=>{if(C.current===null)return;const e=N.current,r=C.current;if(C.current=null,!!e)try{e.setSelectionRange(r,r)}catch{}},[P]);const I=P,T=I!==""&&I!==void 0,w=d==="disable"||s.disabled,q=w?"disable":d,H=v==="inside",In=H&&(T||tn),K=["sa-tf",`sa-tf-variant-${l}`,`sa-tf-size-${i}`,`sa-tf-status-${q}`,`sa-tf-label-${v}`,tn?"sa-tf-focused":"",w?"sa-tf-disabled":"",In?"sa-tf-floating":"",f?"":"sa-tf-no-label",kn?"sa-tf-fullwidth":""].filter(Boolean).join(" "),Sn=()=>{var e;return(e=N.current)==null?void 0:e.focus()},Ln=e=>{var cn,un;if(!B){const F=e.target.selectionStart;F!==null&&(C.current=F),z(e.target.value),(cn=s.onChange)==null||cn.call(s,e);return}const r=e.target.value;let p=r,g=e.target.selectionStart??r.length;if(Cn==="Backspace"){const F=P.replace(/\D/g,""),Fn=r.replace(/\D/g,"");F.length===Fn.length&&g>0&&(p=r.slice(0,g-1)+r.slice(g),g-=1)}const G=O(p),Tn=p.slice(0,g).replace(/\D/g,"").length,Dn=xn(G,Tn);C.current=Dn,z(G),(un=s.onChange)==null||un.call(s,{...e,target:{...e.target,value:String(pn(G)),name:e.target.name}}),sn("")},_=e=>f?n.jsxs("div",{className:e,children:[n.jsx("label",{htmlFor:an.current,style:{cursor:w?"not-allowed":"pointer"},children:f}),c?n.jsx("span",{className:"sa-tf-optional",children:"Optional"}):null,V?n.jsx("span",{className:"sa-tf-required","aria-hidden":"true",children:"*"}):null]}):null,U=n.jsxs(n.Fragment,{children:[h?n.jsx("p",{className:"sa-tf-helper",children:h}):null,b&&d==="error"?n.jsx("p",{className:"sa-tf-error",children:b}):null]}),D=(e,r)=>n.jsx("span",{className:`sa-tf-icon${r?" sa-tf-icon-clickable":""}`,onClick:r,children:o.cloneElement(e,{width:y(i),height:y(i),color:J(q,w),style:{color:J(q,w)}})}),on=d==="success"?n.jsx("span",{className:"sa-tf-icon sa-tf-success-mark","aria-hidden":"true",children:n.jsx(mn,{width:y(i),height:y(i)})}):null,Bn=e=>{var p;e.stopPropagation(),M||z("");const r={target:{value:"",name:s.name},currentTarget:{value:"",name:s.name}};(p=s.onChange)==null||p.call(s,r),A==null||A(),C.current=0,requestAnimationFrame(()=>{var g;return(g=N.current)==null?void 0:g.focus()})},ln=zn&&!w?n.jsx("button",{type:"button",className:`sa-tf-icon sa-tf-clear${T?"":" sa-tf-clear-hidden"}`,"aria-label":"Clear input","aria-hidden":!T,tabIndex:-1,onClick:Bn,onMouseDown:e=>e.preventDefault(),children:n.jsx(wn,{width:y(i),height:y(i)})}):null,En=!T&&!!s.placeholder&&!!$,dn=n.jsxs("div",{className:"sa-tf-field-wrap",children:[n.jsx("input",{...s,id:an.current,ref:N,className:"sa-tf-input",disabled:w,placeholder:$?"":s.placeholder,value:I,onFocus:e=>{var r;en(!0),Nn(!0),(r=s.onFocus)==null||r.call(s,e)},onBlur:e=>{var r;en(!1),(r=s.onBlur)==null||r.call(s,e)},onKeyDown:e=>{var r;e.key==="Backspace"&&sn(e.key),(r=s.onKeyDown)==null||r.call(s,e)},onChange:Ln}),En?yn(s.placeholder,$):null]}),fn=I&&rn&&(E!=null&&E.length)?n.jsx(hn,{options:E,value:I,setValue:z,ref:W,isComponentVisible:rn,onOptionChange:e=>{Y==null||Y(e),z(e)}}):null,X=H?n.jsxs("div",{className:"sa-tf-box",ref:W,onClick:Sn,children:[S?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-left",children:S}):null,n.jsxs("div",{className:"sa-tf-box-content",children:[m?D(m,R):null,n.jsxs("div",{className:"sa-tf-inside-stack",children:[_("sa-tf-inside-label-row"),n.jsx("div",{className:"sa-tf-inside-row",children:dn})]}),ln,on,k?D(k,nn):null]}),L?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-right",children:L}):null,fn]}):n.jsxs("div",{className:"sa-tf-box",ref:W,children:[S?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-left",children:S}):null,n.jsxs("div",{className:"sa-tf-box-content",children:[m?D(m,R):null,dn,ln,on,k?D(k,nn):null]}),L?n.jsx("div",{className:"sa-tf-addon sa-tf-addon-right",children:L}):null,fn]});return v==="outside-left"?n.jsxs("div",{className:K,children:[n.jsxs("div",{className:"sa-tf-label-col",children:[_("sa-tf-label"),u?n.jsx("p",{className:"sa-tf-desc-top",children:u}):null]}),n.jsxs("div",{className:"sa-tf-input-col",children:[X,U]})]}):H?n.jsxs("div",{className:K,children:[X,U]}):n.jsxs("div",{className:K,children:[_("sa-tf-label"),u?n.jsx("p",{className:"sa-tf-desc-top",children:u}):null,X,U]})}),yn=(t,a)=>{if(!t)return null;if(!a)return n.jsx("p",{className:"sa-tf-placeholder",children:t});const i=t.toLowerCase().indexOf(a.toLowerCase());return i===-1?n.jsx("p",{className:"sa-tf-placeholder",children:t}):n.jsxs("p",{className:"sa-tf-placeholder",children:[t.slice(0,i),n.jsx("span",{className:"sa-tf-placeholder-highlight",children:t.slice(i,i+a.length)}),t.slice(i+a.length)]})};Z.displayName="Input",x.Input=Z,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});
|