cosmic-ai-input 1.0.16 → 1.0.18
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/index.cjs.js +4 -4
- package/dist/index.es.js +50 -51
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Generated at: 2026-04-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react/jsx-runtime"),o=require("react"),me=require("classnames"),nt=require("react-dom");var E=(r=>(r.INPUT="input",r.SELECT="select",r.MULTIPLE_SELECT="multiple-select",r.DATE_PICKER="date-picker",r.LABEL="label",r))(E||{});const Te=o.forwardRef(({value:r,position:a,id:i,onChange:h},B)=>{const[m,x]=o.useState(!0),$=o.useRef(null),k=o.useRef(null);o.useEffect(()=>{typeof B=="function"?B($.current):B&&(B.current=$.current)},[B]);const S=g=>{const y=g.target.value;h==null||h(y,E.DATE_PICKER)};o.useEffect(()=>{if(k.current)try{setTimeout(()=>{N()},100)}catch{}},[]);const N=()=>{if(k.current)try{k.current.showPicker()}catch{}},L=g=>{g.stopPropagation()};return m?p.jsx("div",{ref:$,id:i,style:{top:(a==null?void 0:a.top)||0,left:(a==null?void 0:a.left)||0},className:"cosmic-ai-input-datePicker",suppressHydrationWarning:!0,children:p.jsx("input",{ref:k,type:"date",value:r||"",onChange:S,onClick:L})}):null});Te.displayName="DatePicker";function de(r){const a=r.textContent||"",i=r.nextSibling;a.length?(i==null||i.setAttribute("style","display: none"),r.style.padding="2px 4px",r.style.borderTopLeftRadius="2px",r.style.borderBottomLeftRadius="2px",r.style.borderTopRightRadius="2px",r.style.borderBottomRightRadius="2px"):(i==null||i.setAttribute("style","display: inline"),r.style.padding="2px 0 2px 4px",r.style.borderTopLeftRadius="2px",r.style.borderBottomLeftRadius="2px",r.style.borderTopRightRadius="0",r.style.borderBottomRightRadius="0")}function O(r){if(r&&r.getAttribute("data-set-type")==="input"){const a=r.children[0];a.setAttribute("contenteditable","true"),requestAnimationFrame(()=>{a.focus()})}}function Le(r){r&&r.getAttribute("data-set-type")==="input"&&r.children[0].setAttribute("contenteditable","false")}function
|
|
3
|
-
`&&(e=""),e},ce=()=>{var n;let e=((n=
|
|
1
|
+
// Generated at: 2026-04-03T07:16:37.095Z
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("react/jsx-runtime"),o=require("react"),me=require("classnames"),nt=require("react-dom");var E=(r=>(r.INPUT="input",r.SELECT="select",r.MULTIPLE_SELECT="multiple-select",r.DATE_PICKER="date-picker",r.LABEL="label",r))(E||{});const Te=o.forwardRef(({value:r,position:a,id:i,onChange:h},B)=>{const[m,x]=o.useState(!0),$=o.useRef(null),k=o.useRef(null);o.useEffect(()=>{typeof B=="function"?B($.current):B&&(B.current=$.current)},[B]);const S=g=>{const y=g.target.value;h==null||h(y,E.DATE_PICKER)};o.useEffect(()=>{if(k.current)try{setTimeout(()=>{N()},100)}catch{}},[]);const N=()=>{if(k.current)try{k.current.showPicker()}catch{}},L=g=>{g.stopPropagation()};return m?p.jsx("div",{ref:$,id:i,style:{top:(a==null?void 0:a.top)||0,left:(a==null?void 0:a.left)||0},className:"cosmic-ai-input-datePicker",suppressHydrationWarning:!0,children:p.jsx("input",{ref:k,type:"date",value:r||"",onChange:S,onClick:L})}):null});Te.displayName="DatePicker";function de(r){const a=r.textContent||"",i=r.nextSibling;a.length?(i==null||i.setAttribute("style","display: none"),r.style.padding="2px 4px",r.style.borderTopLeftRadius="2px",r.style.borderBottomLeftRadius="2px",r.style.borderTopRightRadius="2px",r.style.borderBottomRightRadius="2px"):(i==null||i.setAttribute("style","display: inline"),r.style.padding="2px 0 2px 4px",r.style.borderTopLeftRadius="2px",r.style.borderBottomLeftRadius="2px",r.style.borderTopRightRadius="0",r.style.borderBottomRightRadius="0")}function O(r){if(r&&r.getAttribute("data-set-type")==="input"){const a=r.children[0];a.setAttribute("contenteditable","true"),requestAnimationFrame(()=>{a.focus()})}}function Le(r){r&&r.getAttribute("data-set-type")==="input"&&r.children[0].setAttribute("contenteditable","false")}function v(r){return r&&(r!=null&&r.getAttribute)?r.getAttribute("data-set-type")==="input":!1}const De=o.forwardRef(({options:r,value:a,position:i,id:h,height:B=37,onChange:m},x)=>{const[$,k]=o.useState(a||""),S=o.useRef(null);o.useEffect(()=>{typeof x=="function"?x(S.current):x&&(x.current=S.current)},[x]);const N=g=>{const y=$.split(",").filter(b=>b)||[];let w="";y.includes(g)?w=y.filter(b=>b!==g).join(","):y.length?w=`${y.join(",")},${g}`:w=g,k(w),m==null||m(w,E.MULTIPLE_SELECT)},L=$.split(",")||[];return p.jsx("div",{ref:S,className:"cosmic-ai-input-selectFloatElement",id:h,style:{position:"absolute",top:(i==null?void 0:i.top)||0,left:(i==null?void 0:i.left)||0,zIndex:5e3,maxHeight:`${B}px`},children:r.map((g,y)=>p.jsx("div",{className:`selectOption ${L.includes(g)?"selected":""}`,onClick:()=>N(g),children:g},y))})});De.displayName="MultipleSelect";const Ne=o.forwardRef(({options:r,value:a,position:i,id:h,height:B=120,onChange:m},x)=>{const[$,k]=o.useState(a||""),S=o.useRef(null);o.useEffect(()=>{typeof x=="function"?x(S.current):x&&(x.current=S.current)},[x]);const N=L=>{k(L),m==null||m(L,E.SELECT)};return p.jsx("div",{ref:S,className:"cosmic-ai-input-selectFloatElement",id:h,style:{position:"absolute",top:(i==null?void 0:i.top)||0,left:(i==null?void 0:i.left)||0,zIndex:5e3,maxHeight:`${B}px`},children:r.length>0&&r.map((L,g)=>p.jsx("div",{className:`selectOption ${$===L?"selected":""}`,onClick:()=>N(L),children:L},g))})});Ne.displayName="Select";function Re(r){const a=r instanceof Element?r:document.getElementById(r);return a&&a.children[0].textContent||""}function st(r,a){const i=r instanceof Element?r:document.getElementById(r);i&&(i.children[0].textContent=a)}function I(r){const a=document.createRange(),i=window.getSelection();i&&(!r||!(r instanceof Node)||(a.selectNodeContents(r),a.collapse(!0),i.removeAllRanges(),i.addRange(a)))}function F(r){const a=document.createRange(),i=window.getSelection();i&&(!r||!(r instanceof Node)||(a.selectNodeContents(r),a.collapse(!1),i.removeAllRanges(),i.addRange(a)))}function ue(r){const a=window.getSelection();if(!a||a.rangeCount===0)return 0;if(!r||!(r instanceof Node))return;const i=a.getRangeAt(0),h=i.cloneRange();return h.selectNodeContents(r),h.setEnd(i.startContainer,i.startOffset),h.toString().length}function rt(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const i=r.getRangeAt(0).startContainer;return i.nodeType===Node.TEXT_NODE?i.parentElement:i.nodeType===Node.ELEMENT_NODE?i:null}function it(){const r=window.getSelection();return!r||r.rangeCount===0?null:r.getRangeAt(0).getBoundingClientRect()}function ct(){return new Promise(r=>{requestAnimationFrame(()=>{r(it())})})}function lt(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const a=r.getRangeAt(0),i=a.startContainer,h=a.startOffset;return i.nodeType===Node.TEXT_NODE?h>0?i:i.previousSibling:i.nodeType===Node.ELEMENT_NODE?h>0?i.childNodes[h-1]:i.previousSibling:null}function ot(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const a=r.getRangeAt(0),i=a.startContainer,h=a.startOffset;return i.nodeType===Node.TEXT_NODE?h<i.length?i:i.nextSibling:i.nodeType===Node.ELEMENT_NODE?h<i.childNodes.length?i.childNodes[h]:i.nextSibling:null}function at(r){return r&&!r.getAttribute("data-set-type")}function Se(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}const ke=o.forwardRef(({options:r,value:a,position:i,id:h,height:B=120,onChange:m},x)=>{const[$,k]=o.useState(a||""),[S,N]=o.useState(0),L=o.useRef(null),g=o.useRef(S),y=o.useCallback(w=>{k(w),m==null||m(w,E.LABEL)},[m]);return o.useEffect(()=>{typeof x=="function"?x(L.current):x&&(x.current=L.current)},[x]),o.useEffect(()=>{g.current=S},[S]),o.useEffect(()=>{N(0)},[r]),o.useEffect(()=>{const w=b=>{r.length!==0&&(b.key==="ArrowDown"?(b.preventDefault(),N(R=>R<r.length-1?R+1:R)):b.key==="ArrowUp"?(b.preventDefault(),N(R=>R>0?R-1:R)):b.key==="Enter"&&(b.preventDefault(),setTimeout(()=>{const R=g.current;R>=0&&r[R]&&y(r[R])},0)))};return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[r,y]),p.jsx("div",{ref:L,className:"cosmic-ai-input-selectFloatElement",id:h,style:{position:"absolute",top:(i==null?void 0:i.top)||0,left:(i==null?void 0:i.left)||0,zIndex:5e3,maxHeight:`${B}px`},children:r.length>0&&r.map((w,b)=>p.jsx("div",{className:`selectOption ${$===w?"selected":""} ${S===b?"highlighted":""}`,onClick:()=>y(w),onMouseEnter:()=>N(b),children:w},b))})});ke.displayName="Mention";const Pe=o.forwardRef((r,a)=>{const{value:i="",varList:h,placeholder:B="",maxLength:m,defaultRows:x=3,disabled:$=!1,defaultFocus:k=!1,textIndex:S=0,mentions:N=[],onFocus:L,onBlur:g,onChange:y,onClick:w,onSend:b,onKeyDown:R,onKeyUp:q,onMaxLengthExceeded:Y}=r,[dt,ut]=o.useState(i||""),[ee,U]=o.useState(""),[ft,te]=o.useState(""),[V,M]=o.useState(!1),[W,_]=o.useState({top:0,left:0}),[ne,se]=o.useState([]),[z,fe]=o.useState(""),[C,re]=o.useState(null),[ie,X]=o.useState(120),[pe,he]=o.useState(k),ge=240,Ee=240,ye=240,xe=276,A=o.useRef(null),T=o.useRef(null),j=o.useRef(null),G=o.useRef(!1),H=()=>{var n,t;let e=((t=(n=A.current)==null?void 0:n.innerText)==null?void 0:t.replace(/\u200B/g,""))||"";return e===`
|
|
3
|
+
`&&(e=""),e},ce=()=>{var n;let e=((n=A.current)==null?void 0:n.innerHTML)||"";return e==="<br>"&&(e=""),e},Be=e=>{const n=[];let t=0;const l=/\[([^\]]+)\]/g;let d;const c=Se();let u=0;if(e===""||!e||e===`
|
|
4
4
|
`)return[{type:"text",content:"",id:`text-${u++}-${c}`}];const P=new Set((h||[]).map(D=>D.name));for(;(d=l.exec(e))!==null;){if(d.index>t){const f=e.substring(t,d.index).split(`
|
|
5
5
|
`);f.forEach((Z,tt)=>{Z&&n.push({type:"text",content:Z,id:`text-${u++}-${c}`}),tt<f.length-1&&n.push({type:"newline",id:`newline-${u++}-${c}`})})}const D=d[1];if(P.has(D)){const s=h.find(f=>f.name===D);(s==null?void 0:s.type)==="input"?n.push({type:"input",name:s==null?void 0:s.name,content:(s==null?void 0:s.content)||"",placeholder:(s==null?void 0:s.placeholder)||D,id:`input-${u++}-${c}`}):(s==null?void 0:s.type)==="label"?n.push({type:"label",name:s==null?void 0:s.name,content:(s==null?void 0:s.content)||"",id:`label-${u++}-${c}`}):(s==null?void 0:s.type)==="select"?n.push({type:"select",name:s==null?void 0:s.name,content:(s==null?void 0:s.content)||"",placeholder:(s==null?void 0:s.placeholder)||D,options:(s==null?void 0:s.options)||[],id:`select-${u++}-${c}`}):(s==null?void 0:s.type)==="multiple-select"?n.push({type:"multiple-select",name:s==null?void 0:s.name,content:(s==null?void 0:s.content)||"",placeholder:(s==null?void 0:s.placeholder)||D,options:(s==null?void 0:s.options)||[],id:`multiple-select-${u++}-${c}`}):(s==null?void 0:s.type)==="date-picker"&&n.push({type:"date-picker",name:s==null?void 0:s.name,content:(s==null?void 0:s.content)||"",placeholder:(s==null?void 0:s.placeholder)||D,id:`date-picker-${u++}-${c}`})}else n.push({type:"text",content:`[${D}]`,id:`text-${u++}-${c}`});t=l.lastIndex}if(t<e.length){const s=e.substring(t).split(`
|
|
6
|
-
`);s.forEach((f,Z)=>{f&&n.push({type:"text",content:f,id:`text-${u++}`}),Z<s.length-1&&n.push({type:"newline",id:`newline-${u++}`})})}return n},le=()=>{var e;(e=w.current)==null||e.setAttribute("contenteditable","true"),T.current&&(F(T.current)&&T.current.children[0].setAttribute("contenteditable","false"),T.current=null),v(w.current)},$e=e=>{C==null||C(e)},je=e=>{le()},K=e=>{var n,t;if(G.current){H().length>0?(n=w.current)==null||n.classList.remove("is-empty"):(t=w.current)==null||t.classList.add("is-empty");return}U(H()),te(ce()),y==null||y(H()),Ze(e)},Me=e=>{var n;if(!G.current&&e.code==="Enter"&&!e.shiftKey){e.preventDefault();const t=H();if(t.length===0||(n=w.current)!=null&&n.innerHTML.match(/^<span>[\s\u200B]*(<br\s*\/?>[\s\u200B]*)+<\/span>$/))return;m?t.length<=m?b==null||b(t):Y==null||Y(t,m):b==null||b(t)}},He=e=>{var t,l,d;if(V&&(A==null?void 0:A.type)===E.LABEL&&(e.code==="ArrowUp"||e.code==="ArrowDown"||e.code==="Enter")){e.preventDefault();return}M(!1),R==null||R(e);const n=rt();if(n&&at(n)){if(e.code==="ArrowLeft"){const c=n==null?void 0:n.previousElementSibling,u=ue(n);c&&u===0&&F(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{v(c.children[0])}))}if(e.code==="ArrowRight"){const c=n==null?void 0:n.nextElementSibling,u=ue(n);c&&u===((t=n.textContent)==null?void 0:t.length)&&F(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{I(c.children[0])}))}(e.code==="Backspace"||((l=e==null?void 0:e.nativeEvent)==null?void 0:l.key)==="Backspace")&&(n.innerHTML===""&&e.preventDefault(),n.innerHTML==="<br>"&&(e.preventDefault(),n.innerHTML=""))}if((e.code==="Backspace"||((d=e==null?void 0:e.nativeEvent)==null?void 0:d.key)==="Backspace")&&e.target){const c=e.target;if(c.childElementCount===1&&c.children[0].tagName==="SPAN"){const u=c.children[0];c.childNodes.length===1&&(u.innerHTML===""&&e.preventDefault(),u.innerHTML==="<br>"&&(e.preventDefault(),u.innerHTML=""))}}if(n&&n.getAttribute("data-set-type")==="container"){if(e.code==="ArrowLeft"){const c=lt();F(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{v(c.children[0])}))}if(e.code==="ArrowRight"){const c=ot();F(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{I(c.children[0])}))}}Me(e)},Oe=e=>{if(V&&(A==null?void 0:A.type)===E.LABEL&&(e.code==="ArrowUp"||e.code==="ArrowDown"||e.code==="Enter")){e.preventDefault();return}q==null||q(e)},ve=e=>{const t=e.clipboardData.items;for(let l=0;l<t.length;l++)if(t[l].type.indexOf("image")!==-1){e.preventDefault();return}},Fe=e=>{e.preventDefault();const t=window.getSelection().toString();if(!t)return;const l=t.replace(/\u200B/g,"")||"",d=t.replace(/\u200B/g,"")||"";e.clipboardData.setData("text/plain",l),e.clipboardData.setData("text/html",d)},qe=e=>{L==null||L(e)},Ve=()=>{G.current=!0},_e=()=>{setTimeout(()=>{G.current=!1,U(H()),te(ce()),y==null||y(H())},0)},Ke=(e,n)=>{n.stopPropagation()},Ue=(e,n)=>{var l;n.stopPropagation(),T.current&&Le(T.current),(l=w.current)==null||l.setAttribute("contenteditable","false");const t=document.getElementById(e.id);T.current=t,requestAnimationFrame(()=>{O(t)})},We=(e,n)=>{var d,c,u,P,D,s;R==null||R(n),n.stopPropagation();const t=n.target,l=ue(t);if((n.code==="Backspace"||((d=n==null?void 0:n.nativeEvent)==null?void 0:d.key)==="Backspace")&&l===0){const f=(c=t.parentElement)==null?void 0:c.previousElementSibling;f&&(F(f)&&f.children[0]&&((u=f.children[0].textContent)!=null&&u.length)?(T.current=f,O(f),v(f.children[0]),requestAnimationFrame(()=>{de(f.children[0])})):(le(),v(f)))}if(n.code==="ArrowRight"&&l===((P=t.textContent)==null?void 0:P.length)){const f=(D=t.parentElement)==null?void 0:D.nextElementSibling;f&&(F(f)&&f.children[0]&&((s=f.children[0].textContent)!=null&&s.length)?(T.current=f,O(f),I(f.children[0]),requestAnimationFrame(()=>{de(f.children[0])})):(le(),I(f)))}n.code==="Enter"&&n.shiftKey&&n.preventDefault()},ze=(e,n)=>{q==null||q(n);const t=n.target;de(t)},Xe=(e,n)=>{var l;n.stopPropagation(),T.current&&Le(T.current),(l=w.current)==null||l.setAttribute("contenteditable","false");const t=document.getElementById(e.id);T.current=t,requestAnimationFrame(()=>{O(t)})},Ge=(e,n)=>{U(H()),te(ce()),y==null||y(H())},Je=(e,n)=>{};o.useEffect(()=>{if(!V)return;const e=l=>{j.current&&!j.current.contains(l.target)&&M(!1)},n=l=>{j.current&&!j.current.contains(l.target)&&M(!1)},t=()=>{M(!1)};return document.addEventListener("mousedown",e),document.addEventListener("scroll",n,!0),window.addEventListener("resize",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("scroll",n,!0),window.removeEventListener("resize",t)}},[V]);const J=(e,n)=>{if(A&&n!==E.LABEL&&st(A.id,e),n===E.SELECT&&(M(!1),K({})),n===E.LABEL&&(ae(),M(!1),requestAnimationFrame(()=>{const t=window.getSelection();t&&Q.current&&(t.removeAllRanges(),t.addRange(Q.current),setTimeout(()=>{var u;const l=document.createElement("span");l.contentEditable="false",l.setAttribute("data-set-type","label"),l.id=A.id;const d=document.createElement("span");d.contentEditable="false",d.textContent=e,l.appendChild(d);const c=(u=w.current)==null?void 0:u.children;if((c==null?void 0:c.length)===1&&c[0].tagName==="SPAN"&&c[0].innerHTML==="[")w.current.innerHTML="",w.current.appendChild(l),setTimeout(()=>{K({}),ae()},0);else{document.execCommand("delete",!1,void 0);const P=Q.current;P.insertNode(l),P.setStartAfter(l),P.setEndAfter(l),t.removeAllRanges(),t.addRange(P),setTimeout(()=>{K({})},0)}},0))})),n===E.MULTIPLE_SELECT||n===E.DATE_PICKER){const t=document.getElementById(A.id);t&&t.children[0]&&t.children[1]&&(e.length>0?(t.children[0].setAttribute("style","display: inline"),t.children[0].setAttribute("contenteditable","false"),t.children[1].setAttribute("style","display: none"),t.children[1].setAttribute("contenteditable","true")):(t.children[0].setAttribute("style","display: none"),t.children[0].setAttribute("contenteditable","true"),t.children[1].setAttribute("style","display: inline"),t.children[1].setAttribute("contenteditable","true"))),K({})}},Q=o.useRef(null),Qe=(N==null?void 0:N.map(e=>e.prefix))||[],Ze=e=>{const n=e==null?void 0:e.nativeEvent,t=n==null?void 0:n.data;Qe.includes(t)&&ct().then(l=>{var c;const d=window.getSelection();d&&d.rangeCount>0&&(Q.current=d.getRangeAt(0)),Ie({options:((c=N.find(u=>u.prefix===t))==null?void 0:c.options)||[],value:"",type:E.LABEL,id:"label-"+Se()},l)})},Ie=(e,n)=>{se(e.options),_({top:-999999,left:-999999999}),re(e),X(Ee),M(!0),requestAnimationFrame(()=>{if(j.current){const t=j.current.getBoundingClientRect();let l=n.left,d=n.top+n.height;window.innerWidth-n.right<ge&&n.width<t.width&&(l=n.right-t.width),n.top<t.height&&(d=n.top+n.height),_({top:d,left:l}),X(t.height)}})},be=(e,n)=>{const l=n.target.getBoundingClientRect();se(e.options),fe(e.value||Re(e.id)),_({top:-999999,left:-999999999}),re(e),X(Ee),M(!0),requestAnimationFrame(()=>{if(j.current){const d=j.current.getBoundingClientRect();let c=l.left,u=l.top+l.height;window.innerWidth-l.right<ge&&l.width<d.width&&(c=l.right-d.width),l.top<d.height&&(u=l.top+l.height),_({top:u,left:c}),X(d.height)}})},Ye=(e,n)=>{const l=n.target.getBoundingClientRect();let d=l.left,c=l.top-xe;window.innerWidth-l.right<ye&&(d=d-ye+l.width),l.top<xe&&(c=l.top+l.height),se(e.options),fe(e.value||Re(e.id)),_({top:c,left:d}),re(e),M(!0)},[et,we]=o.useState([]),[oe,Ce]=o.useState(!0),Ae=o.useCallback(()=>{Ce(!1);const e=Be(i),n=[];return e.forEach(t=>{var l,d,c,u,P,D;if(t.type==="text")n.push(p.jsx("span",{onKeyDown:s=>Je(),children:t.content},t.id));else if(t.type==="newline")n.push(p.jsx("br",{},t.id));else if(t.type==="label")n.push(p.jsx("span",{id:t.id,"data-set-type":"label",contentEditable:!1,children:p.jsx("span",{contentEditable:!1,children:t.name})},t.id));else if(t.type==="input")n.push(p.jsxs("span",{id:t.id,"data-set-type":"input",contentEditable:!1,suppressContentEditableWarning:!0,onInput:s=>Ge(),onClick:s=>Ke(t,s),onMouseDown:s=>Ue(t,s),"data-cosmic-ai-input-placeholder":t.placeholder,children:[p.jsx("span",{className:"cosmic-ai-input-inputContent",style:{padding:(l=t.content)!=null&&l.length?"2px 4px":"2px 0 2px 4px"},contentEditable:!1,onKeyDown:s=>We(t,s),onKeyUp:s=>ze(t,s),children:t.content}),p.jsx("span",{contentEditable:!1,style:{display:(d=t.content)!=null&&d.length?"none":"inline"},className:"cosmic-ai-input-placeholder",onMouseDown:s=>Xe(t,s),children:t.placeholder})]},t.id));else if(t.type===E.SELECT){const s=t.content||((c=t.options)==null?void 0:c[0])||t.placeholder;n.push(p.jsx("span",{id:t.id,"data-set-type":"select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:f=>be(t,f),"data-cosmic-ai-input-placeholder":t.placeholder,children:p.jsx("span",{contentEditable:!1,children:s})},t.id))}else if(t.type===E.MULTIPLE_SELECT){const s=t.content||((u=t.options)==null?void 0:u[0]);n.push(p.jsxs("span",{id:t.id,"data-set-type":"multiple-select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:f=>be(t,f),"data-cosmic-ai-input-placeholder":t.placeholder,children:[p.jsx("span",{style:{display:s!=null&&s.length?"inline":"none"},contentEditable:!1,children:s}),p.jsx("span",{style:{display:s!=null&&s.length?"none":"inline"},className:"cosmic-ai-input-selectPlaceholder",contentEditable:!1,children:t.placeholder})]},t.id))}else t.type===E.DATE_PICKER&&n.push(p.jsxs("span",{id:t.id,"data-set-type":"date-picker",contentEditable:!1,suppressContentEditableWarning:!0,onClick:s=>Ye(t,s),"data-cosmic-ai-input-placeholder":t.placeholder,children:[p.jsx("span",{style:{display:(P=t.content)!=null&&P.length?"inline":"none"},contentEditable:!1,children:t.content}),p.jsx("span",{style:{display:(D=t.content)!=null&&D.length?"none":"inline"},className:"cosmic-ai-input-datePickerPlaceholder",contentEditable:!1,children:t.placeholder})]},t.id))}),setTimeout(()=>{Ce(!0)},0),n},[i]);o.useEffect(()=>{oe&&setTimeout(()=>{v(w.current)},0)},[oe]),o.useEffect(()=>{i!==ee?(we(Ae()),U(i),he(!0)):(i===""||!i)&&we(Ae())},[i,ee]),o.useEffect(()=>{if(!k&&!pe)return;const e=new MutationObserver(()=>{w.current&&document.contains(w.current)&&(requestAnimationFrame(()=>{v(w.current),he(!1)}),e.disconnect())});return w.current&&e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()},[k,pe]);const ae=()=>{w.current&&requestAnimationFrame(()=>{v(w.current)})};return o.useImperativeHandle(a,()=>({getCurrentValue:H,focus:ae})),p.jsxs("div",{className:me(`cosmic-ai-input-rows${x}`),style:{textIndent:S+"px"},children:[oe&&p.jsx("div",{"data-set-type":"container","data-cosmic-ai-input-placeholder":B,className:me("cosmic-ai-input",`cosmic-ai-input-rows${x}`,{"is-disabled":$},{"is-empty":ee.length===0}),ref:w,contentEditable:!0,suppressContentEditableWarning:!0,onClick:e=>$e(e),onFocus:e=>{qe(e)},onBlur:e=>{g==null||g(e)},onMouseDown:e=>je(),onKeyDown:e=>He(e),onKeyUp:e=>Oe(e),onInput:e=>K(e),onCopy:e=>Fe(e),onPaste:e=>ve(e),onCompositionStart:Ve,onCompositionEnd:_e,children:et}),V&&nt.createPortal((A==null?void 0:A.type)===E.MULTIPLE_SELECT?p.jsx(De,{ref:j,options:ne,value:z,position:W,height:ie,onChange:J},E.MULTIPLE_SELECT):(A==null?void 0:A.type)===E.DATE_PICKER?p.jsx(Te,{ref:j,value:z,position:W,onChange:J},E.DATE_PICKER):(A==null?void 0:A.type)===E.LABEL?p.jsx(ke,{ref:j,options:ne,value:z,position:W,height:ie,onChange:J},E.LABEL):p.jsx(Ne,{ref:j,options:ne,value:z,position:W,height:ie,onChange:J},E.SELECT),document.body)]})});Pe.displayName="AiInput";exports.default=Pe;
|
|
6
|
+
`);s.forEach((f,Z)=>{f&&n.push({type:"text",content:f,id:`text-${u++}`}),Z<s.length-1&&n.push({type:"newline",id:`newline-${u++}`})})}return n},le=()=>{var e;(e=A.current)==null||e.setAttribute("contenteditable","true"),T.current&&(v(T.current)&&T.current.children[0].setAttribute("contenteditable","false"),T.current=null),F(A.current)},$e=e=>{w==null||w(e)},je=e=>{le()},K=e=>{var n,t;if(G.current){H().length>0?(n=A.current)==null||n.classList.remove("is-empty"):(t=A.current)==null||t.classList.add("is-empty");return}U(H()),te(ce()),y==null||y(H()),Ze(e)},Me=e=>{var n;if(!G.current&&e.code==="Enter"&&!e.shiftKey){e.preventDefault();const t=H();if(t.length===0||(n=A.current)!=null&&n.innerHTML.match(/^<span>[\s\u200B]*(<br\s*\/?>[\s\u200B]*)+<\/span>$/))return;m?t.length<=m?b==null||b(t):Y==null||Y(t,m):b==null||b(t)}},He=e=>{var t,l,d;if(V&&(C==null?void 0:C.type)===E.LABEL&&(e.code==="ArrowUp"||e.code==="ArrowDown"||e.code==="Enter")){e.preventDefault();return}M(!1),R==null||R(e);const n=rt();if(n&&at(n)){if(e.code==="ArrowLeft"){const c=n==null?void 0:n.previousElementSibling,u=ue(n);c&&u===0&&v(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{F(c.children[0])}))}if(e.code==="ArrowRight"){const c=n==null?void 0:n.nextElementSibling,u=ue(n);c&&u===((t=n.textContent)==null?void 0:t.length)&&v(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{I(c.children[0])}))}(e.code==="Backspace"||((l=e==null?void 0:e.nativeEvent)==null?void 0:l.key)==="Backspace")&&(n.innerHTML===""&&e.preventDefault(),n.innerHTML==="<br>"&&(e.preventDefault(),n.innerHTML=""))}if((e.code==="Backspace"||((d=e==null?void 0:e.nativeEvent)==null?void 0:d.key)==="Backspace")&&e.target){const c=e.target;if(c.childElementCount===1&&c.children[0].tagName==="SPAN"){const u=c.children[0];c.childNodes.length===1&&(u.innerHTML===""&&e.preventDefault(),u.innerHTML==="<br>"&&(e.preventDefault(),u.innerHTML=""))}}if(n&&n.getAttribute("data-set-type")==="container"){if(e.code==="ArrowLeft"){const c=lt();v(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{F(c.children[0])}))}if(e.code==="ArrowRight"){const c=ot();v(c)&&c.children[0]&&(T.current=c,O(c),requestAnimationFrame(()=>{I(c.children[0])}))}}Me(e)},Oe=e=>{if(V&&(C==null?void 0:C.type)===E.LABEL&&(e.code==="ArrowUp"||e.code==="ArrowDown"||e.code==="Enter")){e.preventDefault();return}q==null||q(e)},ve=e=>{const t=e.clipboardData.items;for(let l=0;l<t.length;l++)if(t[l].type.indexOf("image")!==-1){e.preventDefault();return}},Fe=e=>{e.preventDefault();const t=window.getSelection().toString();if(!t)return;const l=t.replace(/\u200B/g,"")||"",d=t.replace(/\u200B/g,"")||"";e.clipboardData.setData("text/plain",l),e.clipboardData.setData("text/html",d)},qe=e=>{L==null||L(e)},Ve=()=>{G.current=!0},_e=()=>{setTimeout(()=>{G.current=!1,U(H()),te(ce()),y==null||y(H())},0)},Ke=(e,n)=>{n.stopPropagation()},Ue=(e,n)=>{var l;n.stopPropagation(),T.current&&Le(T.current),(l=A.current)==null||l.setAttribute("contenteditable","false");const t=document.getElementById(e.id);T.current=t,requestAnimationFrame(()=>{O(t)})},We=(e,n)=>{var d,c,u,P,D,s;R==null||R(n),n.stopPropagation();const t=n.target,l=ue(t);if((n.code==="Backspace"||((d=n==null?void 0:n.nativeEvent)==null?void 0:d.key)==="Backspace")&&l===0){const f=(c=t.parentElement)==null?void 0:c.previousElementSibling;f&&(v(f)&&f.children[0]&&((u=f.children[0].textContent)!=null&&u.length)?(T.current=f,O(f),F(f.children[0]),requestAnimationFrame(()=>{de(f.children[0])})):(le(),F(f)))}if(n.code==="ArrowRight"&&l===((P=t.textContent)==null?void 0:P.length)){const f=(D=t.parentElement)==null?void 0:D.nextElementSibling;f&&(v(f)&&f.children[0]&&((s=f.children[0].textContent)!=null&&s.length)?(T.current=f,O(f),I(f.children[0]),requestAnimationFrame(()=>{de(f.children[0])})):(le(),I(f)))}n.code==="Enter"&&n.shiftKey&&n.preventDefault()},ze=(e,n)=>{q==null||q(n);const t=n.target;de(t)},Xe=(e,n)=>{var l;n.stopPropagation(),T.current&&Le(T.current),(l=A.current)==null||l.setAttribute("contenteditable","false");const t=document.getElementById(e.id);T.current=t,requestAnimationFrame(()=>{O(t)})},Ge=(e,n)=>{U(H()),te(ce()),y==null||y(H())},Je=(e,n)=>{};o.useEffect(()=>{if(!V)return;const e=l=>{j.current&&!j.current.contains(l.target)&&M(!1)},n=l=>{j.current&&!j.current.contains(l.target)&&M(!1)},t=()=>{M(!1)};return document.addEventListener("mousedown",e),document.addEventListener("scroll",n,!0),window.addEventListener("resize",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("scroll",n,!0),window.removeEventListener("resize",t)}},[V]);const J=(e,n)=>{if(C&&n!==E.LABEL&&st(C.id,e),n===E.SELECT&&(M(!1),K({})),n===E.LABEL&&(ae(),M(!1),requestAnimationFrame(()=>{const t=window.getSelection();t&&Q.current&&(t.removeAllRanges(),t.addRange(Q.current),setTimeout(()=>{var u;const l=document.createElement("span");l.contentEditable="false",l.setAttribute("data-set-type","label"),l.id=C.id;const d=document.createElement("span");d.contentEditable="false",d.textContent=e,l.appendChild(d);const c=(u=A.current)==null?void 0:u.children;if((c==null?void 0:c.length)===1&&c[0].tagName==="SPAN"&&c[0].innerHTML==="[")A.current.innerHTML="",A.current.appendChild(l),setTimeout(()=>{K({}),ae()},0);else{document.execCommand("delete",!1,void 0);const P=Q.current;P.insertNode(l),P.setStartAfter(l),P.setEndAfter(l),t.removeAllRanges(),t.addRange(P),setTimeout(()=>{K({})},0)}},0))})),n===E.MULTIPLE_SELECT||n===E.DATE_PICKER){const t=document.getElementById(C.id);t&&t.children[0]&&t.children[1]&&(e.length>0?(t.children[0].setAttribute("style","display: inline"),t.children[0].setAttribute("contenteditable","false"),t.children[1].setAttribute("style","display: none"),t.children[1].setAttribute("contenteditable","true")):(t.children[0].setAttribute("style","display: none"),t.children[0].setAttribute("contenteditable","true"),t.children[1].setAttribute("style","display: inline"),t.children[1].setAttribute("contenteditable","true"))),K({})}},Q=o.useRef(null),Qe=(N==null?void 0:N.map(e=>e.prefix))||[],Ze=e=>{const n=e==null?void 0:e.nativeEvent,t=n==null?void 0:n.data;Qe.includes(t)&&ct().then(l=>{var c;const d=window.getSelection();d&&d.rangeCount>0&&(Q.current=d.getRangeAt(0)),Ie({options:((c=N.find(u=>u.prefix===t))==null?void 0:c.options)||[],value:"",type:E.LABEL,id:"label-"+Se()},l)})},Ie=(e,n)=>{se(e.options),_({top:-999999,left:-999999999}),re(e),X(Ee),M(!0),requestAnimationFrame(()=>{if(j.current){const t=j.current.getBoundingClientRect();let l=n.left,d=n.top+n.height;window.innerWidth-n.right<ge&&n.width<t.width&&(l=n.right-t.width),n.top<t.height&&(d=n.top+n.height),_({top:d,left:l}),X(t.height)}})},be=(e,n)=>{const l=n.target.getBoundingClientRect();se(e.options),fe(e.value||Re(e.id)),_({top:-999999,left:-999999999}),re(e),X(Ee),M(!0),requestAnimationFrame(()=>{if(j.current){const d=j.current.getBoundingClientRect();let c=l.left,u=l.top+l.height;window.innerWidth-l.right<ge&&l.width<d.width&&(c=l.right-d.width),l.top<d.height&&(u=l.top+l.height),_({top:u,left:c}),X(d.height)}})},Ye=(e,n)=>{const l=n.target.getBoundingClientRect();let d=l.left,c=l.top-xe;window.innerWidth-l.right<ye&&(d=d-ye+l.width),l.top<xe&&(c=l.top+l.height),se(e.options),fe(e.value||Re(e.id)),_({top:c,left:d}),re(e),M(!0)},[et,we]=o.useState([]),[oe,Ce]=o.useState(!0),Ae=o.useCallback(()=>{Ce(!1);const e=Be(i),n=[];return e.forEach(t=>{var l,d,c,u,P,D;if(t.type==="text")n.push(p.jsx("span",{onKeyDown:s=>Je(),children:t.content},t.id));else if(t.type==="newline")n.push(p.jsx("br",{},t.id));else if(t.type==="label")n.push(p.jsx("span",{id:t.id,"data-set-type":"label",contentEditable:!1,children:p.jsx("span",{contentEditable:!1,children:t.name})},t.id));else if(t.type==="input")n.push(p.jsxs("span",{id:t.id,"data-set-type":"input",contentEditable:!1,suppressContentEditableWarning:!0,onInput:s=>Ge(),onClick:s=>Ke(t,s),onMouseDown:s=>Ue(t,s),"data-cosmic-ai-input-placeholder":t.placeholder,children:[p.jsx("span",{className:"cosmic-ai-input-inputContent",style:{padding:(l=t.content)!=null&&l.length?"2px 4px":"2px 0 2px 4px"},contentEditable:!1,onKeyDown:s=>We(t,s),onKeyUp:s=>ze(t,s),children:t.content}),p.jsx("span",{contentEditable:!1,style:{display:(d=t.content)!=null&&d.length?"none":"inline"},className:"cosmic-ai-input-placeholder",onMouseDown:s=>Xe(t,s),children:t.placeholder})]},t.id));else if(t.type===E.SELECT){const s=t.content||((c=t.options)==null?void 0:c[0])||t.placeholder;n.push(p.jsx("span",{id:t.id,"data-set-type":"select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:f=>be(t,f),"data-cosmic-ai-input-placeholder":t.placeholder,children:p.jsx("span",{contentEditable:!1,children:s})},t.id))}else if(t.type===E.MULTIPLE_SELECT){const s=t.content||((u=t.options)==null?void 0:u[0]);n.push(p.jsxs("span",{id:t.id,"data-set-type":"multiple-select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:f=>be(t,f),"data-cosmic-ai-input-placeholder":t.placeholder,children:[p.jsx("span",{style:{display:s!=null&&s.length?"inline":"none"},contentEditable:!1,children:s}),p.jsx("span",{style:{display:s!=null&&s.length?"none":"inline"},className:"cosmic-ai-input-selectPlaceholder",contentEditable:!1,children:t.placeholder})]},t.id))}else t.type===E.DATE_PICKER&&n.push(p.jsxs("span",{id:t.id,"data-set-type":"date-picker",contentEditable:!1,suppressContentEditableWarning:!0,onClick:s=>Ye(t,s),"data-cosmic-ai-input-placeholder":t.placeholder,children:[p.jsx("span",{style:{display:(P=t.content)!=null&&P.length?"inline":"none"},contentEditable:!1,children:t.content}),p.jsx("span",{style:{display:(D=t.content)!=null&&D.length?"none":"inline"},className:"cosmic-ai-input-datePickerPlaceholder",contentEditable:!1,children:t.placeholder})]},t.id))}),setTimeout(()=>{Ce(!0)},0),n},[i]);o.useEffect(()=>{oe&&setTimeout(()=>{F(A.current)},0)},[oe]),o.useEffect(()=>{i!==ee?(we(Ae()),U(i),he(!0)):(i===""||!i)&&we(Ae())},[i,ee]),o.useEffect(()=>{if(!k&&!pe)return;const e=new MutationObserver(()=>{A.current&&document.contains(A.current)&&(requestAnimationFrame(()=>{F(A.current),he(!1)}),e.disconnect())});return A.current&&e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()},[k,pe]);const ae=()=>{A.current&&requestAnimationFrame(()=>{})};return o.useImperativeHandle(a,()=>({getCurrentValue:H,focus:ae})),p.jsxs("div",{className:me(`cosmic-ai-input-rows${x}`),style:{textIndent:S+"px"},children:[oe&&p.jsx("div",{"data-set-type":"container","data-cosmic-ai-input-placeholder":B,className:me("cosmic-ai-input",`cosmic-ai-input-rows${x}`,{"is-disabled":$},{"is-empty":ee.length===0}),ref:A,contentEditable:!0,suppressContentEditableWarning:!0,onClick:e=>$e(e),onFocus:e=>{qe(e)},onBlur:e=>{g==null||g(e)},onMouseDown:e=>je(),onKeyDown:e=>He(e),onKeyUp:e=>Oe(e),onInput:e=>K(e),onCopy:e=>Fe(e),onPaste:e=>ve(e),onCompositionStart:Ve,onCompositionEnd:_e,children:et}),V&&nt.createPortal((C==null?void 0:C.type)===E.MULTIPLE_SELECT?p.jsx(De,{ref:j,options:ne,value:z,position:W,height:ie,onChange:J},E.MULTIPLE_SELECT):(C==null?void 0:C.type)===E.DATE_PICKER?p.jsx(Te,{ref:j,value:z,position:W,onChange:J},E.DATE_PICKER):(C==null?void 0:C.type)===E.LABEL?p.jsx(ke,{ref:j,options:ne,value:z,position:W,height:ie,onChange:J},E.LABEL):p.jsx(Ne,{ref:j,options:ne,value:z,position:W,height:ie,onChange:J},E.SELECT),document.body)]})});Pe.displayName="AiInput";exports.default=Pe;
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated at: 2026-04-
|
|
1
|
+
// Generated at: 2026-04-03T07:16:36.590Z
|
|
2
2
|
import { jsx as f, jsxs as te } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as j, useState as T, useRef as O, useEffect as H, useCallback as Pe, useImperativeHandle as st } from "react";
|
|
4
4
|
import De from "classnames";
|
|
@@ -73,7 +73,7 @@ function V(r) {
|
|
|
73
73
|
function Se(r) {
|
|
74
74
|
r && r.getAttribute("data-set-type") === "input" && r.children[0].setAttribute("contenteditable", "false");
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function q(r) {
|
|
77
77
|
return r && (r != null && r.getAttribute) ? r.getAttribute("data-set-type") === "input" : !1;
|
|
78
78
|
}
|
|
79
79
|
const $e = j(({
|
|
@@ -90,8 +90,8 @@ const $e = j(({
|
|
|
90
90
|
}, [y]);
|
|
91
91
|
const N = (h) => {
|
|
92
92
|
const E = $.split(",").filter((b) => b) || [];
|
|
93
|
-
let
|
|
94
|
-
E.includes(h) ?
|
|
93
|
+
let m = "";
|
|
94
|
+
E.includes(h) ? m = E.filter((b) => b !== h).join(",") : E.length ? m = `${E.join(",")},${h}` : m = h, k(m), A == null || A(m, g.MULTIPLE_SELECT);
|
|
95
95
|
}, x = $.split(",") || [];
|
|
96
96
|
return /* @__PURE__ */ f(
|
|
97
97
|
"div",
|
|
@@ -172,7 +172,7 @@ function ne(r) {
|
|
|
172
172
|
const o = document.createRange(), l = window.getSelection();
|
|
173
173
|
l && (!r || !(r instanceof Node) || (o.selectNodeContents(r), o.collapse(!0), l.removeAllRanges(), l.addRange(o)));
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function _(r) {
|
|
176
176
|
const o = document.createRange(), l = window.getSelection();
|
|
177
177
|
l && (!r || !(r instanceof Node) || (o.selectNodeContents(r), o.collapse(!1), l.removeAllRanges(), l.addRange(o)));
|
|
178
178
|
}
|
|
@@ -229,8 +229,8 @@ const He = j(({
|
|
|
229
229
|
height: B = 120,
|
|
230
230
|
onChange: A
|
|
231
231
|
}, y) => {
|
|
232
|
-
const [$, k] = T(o || ""), [R, N] = T(0), x = O(null), h = O(R), E = Pe((
|
|
233
|
-
k(
|
|
232
|
+
const [$, k] = T(o || ""), [R, N] = T(0), x = O(null), h = O(R), E = Pe((m) => {
|
|
233
|
+
k(m), A == null || A(m, g.LABEL);
|
|
234
234
|
}, [A]);
|
|
235
235
|
return H(() => {
|
|
236
236
|
typeof y == "function" ? y(x.current) : y && (y.current = x.current);
|
|
@@ -239,14 +239,14 @@ const He = j(({
|
|
|
239
239
|
}, [R]), H(() => {
|
|
240
240
|
N(0);
|
|
241
241
|
}, [r]), H(() => {
|
|
242
|
-
const
|
|
242
|
+
const m = (b) => {
|
|
243
243
|
r.length !== 0 && (b.key === "ArrowDown" ? (b.preventDefault(), N((L) => L < r.length - 1 ? L + 1 : L)) : b.key === "ArrowUp" ? (b.preventDefault(), N((L) => L > 0 ? L - 1 : L)) : b.key === "Enter" && (b.preventDefault(), setTimeout(() => {
|
|
244
244
|
const L = h.current;
|
|
245
245
|
L >= 0 && r[L] && E(r[L]);
|
|
246
246
|
}, 0)));
|
|
247
247
|
};
|
|
248
|
-
return document.addEventListener("keydown",
|
|
249
|
-
document.removeEventListener("keydown",
|
|
248
|
+
return document.addEventListener("keydown", m), () => {
|
|
249
|
+
document.removeEventListener("keydown", m);
|
|
250
250
|
};
|
|
251
251
|
}, [r, E]), /* @__PURE__ */ f(
|
|
252
252
|
"div",
|
|
@@ -261,13 +261,13 @@ const He = j(({
|
|
|
261
261
|
zIndex: 5e3,
|
|
262
262
|
maxHeight: `${B}px`
|
|
263
263
|
},
|
|
264
|
-
children: r.length > 0 && r.map((
|
|
264
|
+
children: r.length > 0 && r.map((m, b) => /* @__PURE__ */ f(
|
|
265
265
|
"div",
|
|
266
266
|
{
|
|
267
|
-
className: `selectOption ${$ ===
|
|
268
|
-
onClick: () => E(
|
|
267
|
+
className: `selectOption ${$ === m ? "selected" : ""} ${R === b ? "highlighted" : ""}`,
|
|
268
|
+
onClick: () => E(m),
|
|
269
269
|
onMouseEnter: () => N(b),
|
|
270
|
-
children:
|
|
270
|
+
children: m
|
|
271
271
|
},
|
|
272
272
|
b
|
|
273
273
|
))
|
|
@@ -289,19 +289,19 @@ const gt = j((r, o) => {
|
|
|
289
289
|
onFocus: x,
|
|
290
290
|
onBlur: h,
|
|
291
291
|
onChange: E,
|
|
292
|
-
onClick:
|
|
292
|
+
onClick: m,
|
|
293
293
|
onSend: b,
|
|
294
294
|
onKeyDown: L,
|
|
295
295
|
onKeyUp: K,
|
|
296
296
|
onMaxLengthExceeded: ie
|
|
297
|
-
} = r, [Et, yt] = T(l || ""), [re, X] = T(""), [bt, le] = T(""), [U, F] = T(!1), [G, W] = T({ top: 0, left: 0 }), [se, ce] = T([]), [J, Ee] = T(""), [
|
|
297
|
+
} = r, [Et, yt] = T(l || ""), [re, X] = T(""), [bt, le] = T(""), [U, F] = T(!1), [G, W] = T({ top: 0, left: 0 }), [se, ce] = T([]), [J, Ee] = T(""), [w, oe] = T(null), [ae, Q] = T(120), [ye, be] = T(k), me = 240, we = 240, Ce = 240, Ae = 276, C = O(null), D = O(null), M = O(null), Z = O(!1), v = () => {
|
|
298
298
|
var n, t;
|
|
299
|
-
let e = ((t = (n =
|
|
299
|
+
let e = ((t = (n = C.current) == null ? void 0 : n.innerText) == null ? void 0 : t.replace(/\u200B/g, "")) || "";
|
|
300
300
|
return e === `
|
|
301
301
|
` && (e = ""), e;
|
|
302
302
|
}, de = () => {
|
|
303
303
|
var n;
|
|
304
|
-
let e = ((n =
|
|
304
|
+
let e = ((n = C.current) == null ? void 0 : n.innerHTML) || "";
|
|
305
305
|
return e === "<br>" && (e = ""), e;
|
|
306
306
|
}, Oe = (e) => {
|
|
307
307
|
const n = [];
|
|
@@ -395,18 +395,18 @@ const gt = j((r, o) => {
|
|
|
395
395
|
return n;
|
|
396
396
|
}, ue = () => {
|
|
397
397
|
var e;
|
|
398
|
-
(e =
|
|
398
|
+
(e = C.current) == null || e.setAttribute("contenteditable", "true"), D.current && (q(D.current) && D.current.children[0].setAttribute(
|
|
399
399
|
"contenteditable",
|
|
400
400
|
"false"
|
|
401
|
-
), D.current = null),
|
|
401
|
+
), D.current = null), _(C.current);
|
|
402
402
|
}, Fe = (e) => {
|
|
403
|
-
|
|
403
|
+
m == null || m(e);
|
|
404
404
|
}, ve = (e) => {
|
|
405
405
|
ue();
|
|
406
406
|
}, z = (e) => {
|
|
407
407
|
var n, t;
|
|
408
408
|
if (Z.current) {
|
|
409
|
-
v().length > 0 ? (n =
|
|
409
|
+
v().length > 0 ? (n = C.current) == null || n.classList.remove("is-empty") : (t = C.current) == null || t.classList.add("is-empty");
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
412
412
|
X(v()), le(de()), E == null || E(v()), tt(e);
|
|
@@ -415,7 +415,7 @@ const gt = j((r, o) => {
|
|
|
415
415
|
if (!Z.current && e.code === "Enter" && !e.shiftKey) {
|
|
416
416
|
e.preventDefault();
|
|
417
417
|
const t = v();
|
|
418
|
-
if (t.length === 0 || (n =
|
|
418
|
+
if (t.length === 0 || (n = C.current) != null && n.innerHTML.match(
|
|
419
419
|
/^<span>[\s\u200B]*(<br\s*\/?>[\s\u200B]*)+<\/span>$/
|
|
420
420
|
))
|
|
421
421
|
return;
|
|
@@ -423,7 +423,7 @@ const gt = j((r, o) => {
|
|
|
423
423
|
}
|
|
424
424
|
}, qe = (e) => {
|
|
425
425
|
var t, c, a;
|
|
426
|
-
if (U && (
|
|
426
|
+
if (U && (w == null ? void 0 : w.type) === g.LABEL && (e.code === "ArrowUp" || e.code === "ArrowDown" || e.code === "Enter")) {
|
|
427
427
|
e.preventDefault();
|
|
428
428
|
return;
|
|
429
429
|
}
|
|
@@ -432,13 +432,13 @@ const gt = j((r, o) => {
|
|
|
432
432
|
if (n && ht(n)) {
|
|
433
433
|
if (e.code === "ArrowLeft") {
|
|
434
434
|
const s = n == null ? void 0 : n.previousElementSibling, d = ge(n);
|
|
435
|
-
s && d === 0 &&
|
|
436
|
-
|
|
435
|
+
s && d === 0 && q(s) && s.children[0] && (D.current = s, V(s), requestAnimationFrame(() => {
|
|
436
|
+
_(s.children[0]);
|
|
437
437
|
}));
|
|
438
438
|
}
|
|
439
439
|
if (e.code === "ArrowRight") {
|
|
440
440
|
const s = n == null ? void 0 : n.nextElementSibling, d = ge(n);
|
|
441
|
-
s && d === ((t = n.textContent) == null ? void 0 : t.length) &&
|
|
441
|
+
s && d === ((t = n.textContent) == null ? void 0 : t.length) && q(s) && s.children[0] && (D.current = s, V(s), requestAnimationFrame(() => {
|
|
442
442
|
ne(s.children[0]);
|
|
443
443
|
}));
|
|
444
444
|
}
|
|
@@ -454,20 +454,20 @@ const gt = j((r, o) => {
|
|
|
454
454
|
if (n && n.getAttribute("data-set-type") === "container") {
|
|
455
455
|
if (e.code === "ArrowLeft") {
|
|
456
456
|
const s = ft();
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
q(s) && s.children[0] && (D.current = s, V(s), requestAnimationFrame(() => {
|
|
458
|
+
_(s.children[0]);
|
|
459
459
|
}));
|
|
460
460
|
}
|
|
461
461
|
if (e.code === "ArrowRight") {
|
|
462
462
|
const s = pt();
|
|
463
|
-
|
|
463
|
+
q(s) && s.children[0] && (D.current = s, V(s), requestAnimationFrame(() => {
|
|
464
464
|
ne(s.children[0]);
|
|
465
465
|
}));
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
Ve(e);
|
|
469
469
|
}, _e = (e) => {
|
|
470
|
-
if (U && (
|
|
470
|
+
if (U && (w == null ? void 0 : w.type) === g.LABEL && (e.code === "ArrowUp" || e.code === "ArrowDown" || e.code === "Enter")) {
|
|
471
471
|
e.preventDefault();
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
@@ -497,7 +497,7 @@ const gt = j((r, o) => {
|
|
|
497
497
|
n.stopPropagation();
|
|
498
498
|
}, Ge = (e, n) => {
|
|
499
499
|
var c;
|
|
500
|
-
n.stopPropagation(), D.current && Se(D.current), (c =
|
|
500
|
+
n.stopPropagation(), D.current && Se(D.current), (c = C.current) == null || c.setAttribute("contenteditable", "false");
|
|
501
501
|
const t = document.getElementById(e.id);
|
|
502
502
|
D.current = t, requestAnimationFrame(() => {
|
|
503
503
|
V(t);
|
|
@@ -508,13 +508,13 @@ const gt = j((r, o) => {
|
|
|
508
508
|
const t = n.target, c = ge(t);
|
|
509
509
|
if ((n.code === "Backspace" || ((a = n == null ? void 0 : n.nativeEvent) == null ? void 0 : a.key) === "Backspace") && c === 0) {
|
|
510
510
|
const u = (s = t.parentElement) == null ? void 0 : s.previousElementSibling;
|
|
511
|
-
u && (
|
|
511
|
+
u && (q(u) && u.children[0] && ((d = u.children[0].textContent) != null && d.length) ? (D.current = u, V(u), _(u.children[0]), requestAnimationFrame(() => {
|
|
512
512
|
he(u.children[0]);
|
|
513
|
-
})) : (ue(),
|
|
513
|
+
})) : (ue(), _(u)));
|
|
514
514
|
}
|
|
515
515
|
if (n.code === "ArrowRight" && c === ((P = t.textContent) == null ? void 0 : P.length)) {
|
|
516
516
|
const u = (S = t.parentElement) == null ? void 0 : S.nextElementSibling;
|
|
517
|
-
u && (
|
|
517
|
+
u && (q(u) && u.children[0] && ((i = u.children[0].textContent) != null && i.length) ? (D.current = u, V(u), ne(u.children[0]), requestAnimationFrame(() => {
|
|
518
518
|
he(u.children[0]);
|
|
519
519
|
})) : (ue(), ne(u)));
|
|
520
520
|
}
|
|
@@ -525,7 +525,7 @@ const gt = j((r, o) => {
|
|
|
525
525
|
he(t);
|
|
526
526
|
}, Ze = (e, n) => {
|
|
527
527
|
var c;
|
|
528
|
-
n.stopPropagation(), D.current && Se(D.current), (c =
|
|
528
|
+
n.stopPropagation(), D.current && Se(D.current), (c = C.current) == null || c.setAttribute("contenteditable", "false");
|
|
529
529
|
const t = document.getElementById(e.id);
|
|
530
530
|
D.current = t, requestAnimationFrame(() => {
|
|
531
531
|
V(t);
|
|
@@ -548,17 +548,17 @@ const gt = j((r, o) => {
|
|
|
548
548
|
};
|
|
549
549
|
}, [U]);
|
|
550
550
|
const I = (e, n) => {
|
|
551
|
-
if (
|
|
551
|
+
if (w && n !== g.LABEL && ot(w.id, e), n === g.SELECT && (F(!1), z({})), n === g.LABEL && (pe(), F(!1), requestAnimationFrame(() => {
|
|
552
552
|
const t = window.getSelection();
|
|
553
553
|
t && Y.current && (t.removeAllRanges(), t.addRange(Y.current), setTimeout(() => {
|
|
554
554
|
var d;
|
|
555
555
|
const c = document.createElement("span");
|
|
556
|
-
c.contentEditable = "false", c.setAttribute("data-set-type", "label"), c.id =
|
|
556
|
+
c.contentEditable = "false", c.setAttribute("data-set-type", "label"), c.id = w.id;
|
|
557
557
|
const a = document.createElement("span");
|
|
558
558
|
a.contentEditable = "false", a.textContent = e, c.appendChild(a);
|
|
559
|
-
const s = (d =
|
|
559
|
+
const s = (d = C.current) == null ? void 0 : d.children;
|
|
560
560
|
if ((s == null ? void 0 : s.length) === 1 && s[0].tagName === "SPAN" && s[0].innerHTML === "[")
|
|
561
|
-
|
|
561
|
+
C.current.innerHTML = "", C.current.appendChild(c), setTimeout(() => {
|
|
562
562
|
z({}), pe();
|
|
563
563
|
}, 0);
|
|
564
564
|
else {
|
|
@@ -571,7 +571,7 @@ const gt = j((r, o) => {
|
|
|
571
571
|
}, 0));
|
|
572
572
|
})), n === g.MULTIPLE_SELECT || n === g.DATE_PICKER) {
|
|
573
573
|
const t = document.getElementById(
|
|
574
|
-
|
|
574
|
+
w.id
|
|
575
575
|
);
|
|
576
576
|
t && t.children[0] && t.children[1] && (e.length > 0 ? (t.children[0].setAttribute("style", "display: inline"), t.children[0].setAttribute("contenteditable", "false"), t.children[1].setAttribute("style", "display: none"), t.children[1].setAttribute("contenteditable", "true")) : (t.children[0].setAttribute("style", "display: none"), t.children[0].setAttribute("contenteditable", "true"), t.children[1].setAttribute("style", "display: inline"), t.children[1].setAttribute("contenteditable", "true"))), z({});
|
|
577
577
|
}
|
|
@@ -771,22 +771,21 @@ const gt = j((r, o) => {
|
|
|
771
771
|
}, [l]);
|
|
772
772
|
H(() => {
|
|
773
773
|
fe && setTimeout(() => {
|
|
774
|
-
|
|
774
|
+
_(C.current);
|
|
775
775
|
}, 0);
|
|
776
776
|
}, [fe]), H(() => {
|
|
777
777
|
l !== re ? (Le(Re()), X(l), be(!0)) : (l === "" || !l) && Le(Re());
|
|
778
778
|
}, [l, re]), H(() => {
|
|
779
779
|
if (!k && !ye) return;
|
|
780
780
|
const e = new MutationObserver(() => {
|
|
781
|
-
|
|
782
|
-
|
|
781
|
+
C.current && document.contains(C.current) && (requestAnimationFrame(() => {
|
|
782
|
+
_(C.current), be(!1);
|
|
783
783
|
}), e.disconnect());
|
|
784
784
|
});
|
|
785
|
-
return
|
|
785
|
+
return C.current && e.observe(document.body, { childList: !0, subtree: !0 }), () => e.disconnect();
|
|
786
786
|
}, [k, ye]);
|
|
787
787
|
const pe = () => {
|
|
788
|
-
|
|
789
|
-
q(m.current);
|
|
788
|
+
C.current && requestAnimationFrame(() => {
|
|
790
789
|
});
|
|
791
790
|
};
|
|
792
791
|
return st(o, () => ({
|
|
@@ -805,7 +804,7 @@ const gt = j((r, o) => {
|
|
|
805
804
|
{ "is-disabled": $ },
|
|
806
805
|
{ "is-empty": re.length === 0 }
|
|
807
806
|
),
|
|
808
|
-
ref:
|
|
807
|
+
ref: C,
|
|
809
808
|
contentEditable: !0,
|
|
810
809
|
suppressContentEditableWarning: !0,
|
|
811
810
|
onClick: (e) => Fe(e),
|
|
@@ -827,7 +826,7 @@ const gt = j((r, o) => {
|
|
|
827
826
|
}
|
|
828
827
|
),
|
|
829
828
|
U && ct(
|
|
830
|
-
(
|
|
829
|
+
(w == null ? void 0 : w.type) === g.MULTIPLE_SELECT ? /* @__PURE__ */ f(
|
|
831
830
|
$e,
|
|
832
831
|
{
|
|
833
832
|
ref: M,
|
|
@@ -838,7 +837,7 @@ const gt = j((r, o) => {
|
|
|
838
837
|
onChange: I
|
|
839
838
|
},
|
|
840
839
|
g.MULTIPLE_SELECT
|
|
841
|
-
) : (
|
|
840
|
+
) : (w == null ? void 0 : w.type) === g.DATE_PICKER ? /* @__PURE__ */ f(
|
|
842
841
|
Be,
|
|
843
842
|
{
|
|
844
843
|
ref: M,
|
|
@@ -847,7 +846,7 @@ const gt = j((r, o) => {
|
|
|
847
846
|
onChange: I
|
|
848
847
|
},
|
|
849
848
|
g.DATE_PICKER
|
|
850
|
-
) : (
|
|
849
|
+
) : (w == null ? void 0 : w.type) === g.LABEL ? /* @__PURE__ */ f(
|
|
851
850
|
He,
|
|
852
851
|
{
|
|
853
852
|
ref: M,
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.cosmic-ai-input{font-size:14px;outline:none;line-height:26px}.cosmic-ai-input p{margin:0}.cosmic-ai-input span{word-break:break-all}.cosmic-ai-input [data-set-type=input]{color:#b4c5fc;padding:0 2px;caret-color:#000}.cosmic-ai-input [data-set-type=label]{padding:0 2px;outline:none;cursor:pointer;position:relative;display:inline-block;cursor:text}.cosmic-ai-input [data-set-type=label] span{color:#2356f6;outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:0 4px;display:inline-block}.cosmic-ai-input [data-set-type=select]{padding:0 2px;outline:none;color:#2356f6;cursor:pointer;position:relative;display:inline-block}.cosmic-ai-input [data-set-type=select] span{outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:0 16px 0 4px;display:inline-block}.cosmic-ai-input [data-set-type=select]:after{content:"";position:absolute;right:6px;top:50%;transform:translateY(-50%);width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #2356f6;pointer-events:none}.cosmic-ai-input [data-set-type=multiple-select]{padding:0 2px;outline:none;color:#2356f6;cursor:pointer;position:relative;display:inline-block}.cosmic-ai-input [data-set-type=multiple-select] span{outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:2px 16px 2px 4px;display:inline-block}.cosmic-ai-input [data-set-type=multiple-select]:after{content:"";position:absolute;right:6px;top:50%;transform:translateY(-50%);width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #2356f6;pointer-events:none}.cosmic-ai-input [data-set-type=date-picker]{padding:0 2px;outline:none;color:#2356f6;cursor:pointer;position:relative;display:inline-block}.cosmic-ai-input [data-set-type=date-picker] span{outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:2px 16px 2px 4px;display:inline-block}.cosmic-ai-input [data-set-type=date-picker]:after{content:"";position:absolute;right:6px;top:50%;transform:translateY(-50%);width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #2356f6;pointer-events:none}.cosmic-ai-input.is-empty:after{content:attr(data-cosmic-ai-input-placeholder);color:#999;pointer-events:none;text-indent:0;white-space:pre-wrap;word-break:break-all;overflow-wrap:break-word}.cosmic-ai-input.is-disabled{opacity:.5;pointer-events:none;cursor:not-allowed}.cosmic-ai-input-displayNone{display:none}.cosmic-ai-input-inputContent{outline:none;color:#2356f6;background-color:#f2f5fe;border-radius:2px}.cosmic-ai-input-placeholder{background-color:#f2f5fe;padding:2px 4px 2px 0;border-top-right-radius:2px;border-bottom-right-radius:2px}.cosmic-ai-input-selectPlaceholder,.cosmic-ai-input-datePickerPlaceholder{color:#b4c5fc}.cosmic-ai-input-rows1{min-height:auto}.cosmic-ai-input-rows2{min-height:46px}.cosmic-ai-input-rows3{min-height:69px}.cosmic-ai-input-rows4{min-height:92px}.cosmic-ai-input-selectFloatElement{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;box-shadow:0 2px 8px #00000026;overflow-y:auto;z-index:5000;max-width:240px}.cosmic-ai-input-selectFloatElement .selectOption{padding:8px 12px;cursor:pointer;transition:background-color .2s ease;border-bottom:1px solid #f0f0f0;font-size:14px;color:#333;box-sizing:border-box;word-wrap:break-word;word-break:break-all;display:flex;align-items:center;justify-content:space-between}.cosmic-ai-input-selectFloatElement .selectOption:last-child{border-bottom:none}.cosmic-ai-input-selectFloatElement .selectOption:hover{background-color:#f5f5f5}.cosmic-ai-input-selectFloatElement .selectOption.selected{background-color:#e6f0ff;color:#2356f6;font-weight:500}.cosmic-ai-input-selectFloatElement .selectOption.selected:after{content:"✓";color:#2356f6;padding-left:6px}.cosmic-ai-input-selectFloatElement .selectOption.highlighted{background-color:#f0f0f0;font-weight:500}.cosmic-ai-input-datePicker{position:absolute;z-index:5000}.cosmic-ai-input-datePicker input[type=date]{visibility:hidden;height:0!important;box-sizing:border-box;border:none!important;position:relative;top:-10px}.cosmic-ai-input-commonSlot{padding:2px 0}
|
|
1
|
+
.cosmic-ai-input{font-size:14px;outline:none;line-height:26px;touch-action:manipulation;-webkit-overflow-scrolling:auto}.cosmic-ai-input p{margin:0}.cosmic-ai-input span{word-break:break-all}.cosmic-ai-input [data-set-type=input]{color:#b4c5fc;padding:0 2px;caret-color:#000}.cosmic-ai-input [data-set-type=label]{padding:0 2px;outline:none;cursor:pointer;position:relative;display:inline-block;cursor:text}.cosmic-ai-input [data-set-type=label] span{color:#2356f6;outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:0 4px;display:inline-block}.cosmic-ai-input [data-set-type=select]{padding:0 2px;outline:none;color:#2356f6;cursor:pointer;position:relative;display:inline-block}.cosmic-ai-input [data-set-type=select] span{outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:0 16px 0 4px;display:inline-block}.cosmic-ai-input [data-set-type=select]:after{content:"";position:absolute;right:6px;top:50%;transform:translateY(-50%);width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #2356f6;pointer-events:none}.cosmic-ai-input [data-set-type=multiple-select]{padding:0 2px;outline:none;color:#2356f6;cursor:pointer;position:relative;display:inline-block}.cosmic-ai-input [data-set-type=multiple-select] span{outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:2px 16px 2px 4px;display:inline-block}.cosmic-ai-input [data-set-type=multiple-select]:after{content:"";position:absolute;right:6px;top:50%;transform:translateY(-50%);width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #2356f6;pointer-events:none}.cosmic-ai-input [data-set-type=date-picker]{padding:0 2px;outline:none;color:#2356f6;cursor:pointer;position:relative;display:inline-block}.cosmic-ai-input [data-set-type=date-picker] span{outline:none;background-color:#f2f5fe;border-radius:2px;white-space:nowrap;padding:2px 16px 2px 4px;display:inline-block}.cosmic-ai-input [data-set-type=date-picker]:after{content:"";position:absolute;right:6px;top:50%;transform:translateY(-50%);width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid #2356f6;pointer-events:none}.cosmic-ai-input.is-empty:after{content:attr(data-cosmic-ai-input-placeholder);color:#999;pointer-events:none;text-indent:0;white-space:pre-wrap;word-break:break-all;overflow-wrap:break-word}.cosmic-ai-input.is-disabled{opacity:.5;pointer-events:none;cursor:not-allowed}.cosmic-ai-input-displayNone{display:none}.cosmic-ai-input-inputContent{outline:none;color:#2356f6;background-color:#f2f5fe;border-radius:2px}.cosmic-ai-input-placeholder{background-color:#f2f5fe;padding:2px 4px 2px 0;border-top-right-radius:2px;border-bottom-right-radius:2px}.cosmic-ai-input-selectPlaceholder,.cosmic-ai-input-datePickerPlaceholder{color:#b4c5fc}.cosmic-ai-input-rows1{min-height:auto}.cosmic-ai-input-rows2{min-height:46px}.cosmic-ai-input-rows3{min-height:69px}.cosmic-ai-input-rows4{min-height:92px}.cosmic-ai-input-selectFloatElement{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;box-shadow:0 2px 8px #00000026;overflow-y:auto;z-index:5000;max-width:240px;touch-action:manipulation;-webkit-overflow-scrolling:auto}.cosmic-ai-input-selectFloatElement .selectOption{padding:8px 12px;cursor:pointer;transition:background-color .2s ease;border-bottom:1px solid #f0f0f0;font-size:14px;color:#333;box-sizing:border-box;word-wrap:break-word;word-break:break-all;display:flex;align-items:center;justify-content:space-between}.cosmic-ai-input-selectFloatElement .selectOption:last-child{border-bottom:none}.cosmic-ai-input-selectFloatElement .selectOption:hover{background-color:#f5f5f5}.cosmic-ai-input-selectFloatElement .selectOption.selected{background-color:#e6f0ff;color:#2356f6;font-weight:500}.cosmic-ai-input-selectFloatElement .selectOption.selected:after{content:"✓";color:#2356f6;padding-left:6px}.cosmic-ai-input-selectFloatElement .selectOption.highlighted{background-color:#f0f0f0;font-weight:500}.cosmic-ai-input-datePicker{position:absolute;z-index:5000;touch-action:manipulation;-webkit-overflow-scrolling:auto}.cosmic-ai-input-datePicker input[type=date]{visibility:hidden;height:0!important;box-sizing:border-box;border:none!important;position:relative;top:-10px}.cosmic-ai-input-commonSlot{padding:2px 0}
|
package/package.json
CHANGED