cosmic-ai-input 1.0.22 → 1.0.24

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 CHANGED
@@ -1,6 +1,6 @@
1
- // Generated at: 2026-04-04T08:28:33.494Z
1
+ // Generated at: 2026-04-04T08:47:22.082Z
2
2
  "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),c=require("react"),De=require("classnames"),ct=require("react-dom");var g=(r=>(r.INPUT="input",r.SELECT="select",r.MULTIPLE_SELECT="multiple-select",r.DATE_PICKER="date-picker",r.LABEL="label",r))(g||{});const P={BACKSPACE:"Backspace",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ENTER:"Enter"},je=c.forwardRef(({value:r,position:o,id:l,onChange:h},k)=>{const y=c.useRef(null),p=c.useRef(null);c.useEffect(()=>{typeof k=="function"?k(y.current):k&&(k.current=y.current)},[k]);const M=x=>{const m=x.target.value;h==null||h(m,g.DATE_PICKER)};c.useEffect(()=>{if(p.current)try{setTimeout(()=>{j()},100)}catch{}},[]);const j=()=>{if(p.current)try{p.current.showPicker()}catch{}},S=x=>{x.stopPropagation()};return u.jsx("div",{ref:y,id:l,style:{top:(o==null?void 0:o.top)||0,left:(o==null?void 0:o.left)||0},className:"cosmic-ai-input-datePicker",suppressHydrationWarning:!0,children:u.jsx("input",{ref:p,type:"date",value:r||"",onChange:M,onClick:S})})});je.displayName="DatePicker";function pe(r){const o=r.textContent||"",l=r.nextSibling;o.length?(l==null||l.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"):(l==null||l.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 W(r){if(r&&r.getAttribute("data-set-type")==="input"){const o=r.children[0];o.setAttribute("contenteditable","true"),requestAnimationFrame(()=>{o.focus()})}}function Pe(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 Be=c.forwardRef(({options:r,value:o,position:l,id:h,height:k=37,onChange:y},p)=>{const[M,j]=c.useState(o||""),S=c.useRef(null);c.useEffect(()=>{typeof p=="function"?p(S.current):p&&(p.current=S.current)},[p]);const x=T=>{const b=M.split(",").filter(E=>E)||[];let R="";b.includes(T)?R=b.filter(E=>E!==T).join(","):b.length?R=`${b.join(",")},${T}`:R=T,j(R),y==null||y(R,g.MULTIPLE_SELECT)},m=M.split(",")||[];return u.jsx("div",{ref:S,className:"cosmic-ai-input-selectFloatElement",id:h,style:{position:"absolute",top:(l==null?void 0:l.top)||0,left:(l==null?void 0:l.left)||0,zIndex:5e3,maxHeight:`${k}px`},children:r.map((T,b)=>u.jsx("div",{className:`selectOption ${m.includes(T)?"selected":""}`,onClick:()=>x(T),children:T},b))})});Be.displayName="MultipleSelect";const Me=c.forwardRef(({options:r,value:o,position:l,id:h,height:k=120,onChange:y},p)=>{const[M,j]=c.useState(o||""),S=c.useRef(null);c.useEffect(()=>{typeof p=="function"?p(S.current):p&&(p.current=S.current)},[p]);const x=m=>{j(m),y==null||y(m,g.SELECT)};return u.jsx("div",{ref:S,className:"cosmic-ai-input-selectFloatElement",id:h,style:{position:"absolute",top:(l==null?void 0:l.top)||0,left:(l==null?void 0:l.left)||0,zIndex:5e3,maxHeight:`${k}px`},children:r.length>0&&r.map((m,T)=>u.jsx("div",{className:`selectOption ${M===m?"selected":""}`,onClick:()=>x(m),children:m},T))})});Me.displayName="Select";function ke(r){const o=r instanceof Element?r:document.getElementById(r);return o&&o.children[0].textContent||""}function Oe(r,o){const l=r instanceof Element?r:document.getElementById(r);l&&(l.children[0].textContent=o)}function ee(r){const o=document.createRange(),l=window.getSelection();l&&(!r||!(r instanceof Node)||(o.selectNodeContents(r),o.collapse(!0),l.removeAllRanges(),l.addRange(o)))}function F(r){const o=document.createRange(),l=window.getSelection();l&&(!r||!(r instanceof Node)||(o.selectNodeContents(r),o.collapse(!1),l.removeAllRanges(),l.addRange(o)))}function he(r){const o=window.getSelection();if(!o||o.rangeCount===0)return 0;if(!r||!(r instanceof Node))return;const l=o.getRangeAt(0),h=l.cloneRange();return h.selectNodeContents(r),h.setEnd(l.startContainer,l.startOffset),h.toString().length}function ot(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const l=r.getRangeAt(0).startContainer;return l.nodeType===Node.TEXT_NODE?l.parentElement:l.nodeType===Node.ELEMENT_NODE?l:null}function at(){const r=window.getSelection();return!r||r.rangeCount===0?null:r.getRangeAt(0).getBoundingClientRect()}function dt(){return new Promise(r=>{requestAnimationFrame(()=>{r(at())})})}function ut(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const o=r.getRangeAt(0),l=o.startContainer,h=o.startOffset;return l.nodeType===Node.TEXT_NODE?h>0?l:l.previousSibling:l.nodeType===Node.ELEMENT_NODE?h>0?l.childNodes[h-1]:l.previousSibling:null}function ft(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const o=r.getRangeAt(0),l=o.startContainer,h=o.startOffset;return l.nodeType===Node.TEXT_NODE?h<l.length?l:l.nextSibling:l.nodeType===Node.ELEMENT_NODE?h<l.childNodes.length?l.childNodes[h]:l.nextSibling:null}function pt(r){return r&&!r.getAttribute("data-set-type")}function $e(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}const te=/iPhone|iPad|iPod/i.test(navigator.userAgent)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,ht=/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)||"ontouchend"in document,_e=c.forwardRef(({options:r,value:o,position:l,id:h,height:k=120,onChange:y},p)=>{const[M,j]=c.useState(o||""),[S,x]=c.useState(0),m=c.useRef(null),T=c.useRef(S),b=c.useCallback(R=>{j(R),y==null||y(R,g.LABEL)},[y]);return c.useEffect(()=>{typeof p=="function"?p(m.current):p&&(p.current=m.current)},[p]),c.useEffect(()=>{T.current=S},[S]),c.useEffect(()=>{x(0)},[r]),c.useEffect(()=>{const R=E=>{r.length!==0&&(E.key==="ArrowDown"?(E.preventDefault(),x(w=>w<r.length-1?w+1:w)):E.key==="ArrowUp"?(E.preventDefault(),x(w=>w>0?w-1:w)):E.key==="Enter"&&(E.preventDefault(),setTimeout(()=>{const w=T.current;w>=0&&r[w]&&b(r[w])},0)))};return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R)}},[r,b]),u.jsx("div",{ref:m,className:"cosmic-ai-input-selectFloatElement",id:h,style:{position:"absolute",top:(l==null?void 0:l.top)||0,left:(l==null?void 0:l.left)||0,zIndex:5e3,maxHeight:`${k}px`},children:r.length>0&&r.map((R,E)=>u.jsx("div",{className:`selectOption ${M===R?"selected":""} ${S===E?"highlighted":""}`,onClick:()=>b(R),onMouseEnter:()=>x(E),children:R},E))})});_e.displayName="Mention";const He=c.forwardRef((r,o)=>{const{value:l="",varList:h,placeholder:k="",maxLength:y,defaultRows:p=3,disabled:M=!1,defaultFocus:j=!1,textIndex:S=0,mentions:x=[],onFocus:m,onBlur:T,onChange:b,onClick:R,onSend:E,onKeyDown:w,onKeyUp:q,onMaxLengthExceeded:ne}=r,[gt,Et]=c.useState(l||""),[se,G]=c.useState(""),[yt,ie]=c.useState(""),[V,_]=c.useState(!1),[I,U]=c.useState({top:0,left:0}),[re,le]=c.useState([]),[X,ge]=c.useState(""),[C,ce]=c.useState(null),[oe,J]=c.useState(120),[Ee,ye]=c.useState(j),be=240,Ae=240,xe=240,Re=276,A=c.useRef(null),L=c.useRef(null),$=c.useRef(null),z=c.useRef(!1),D=(t,s)=>t.code===s||t.key===s,H=()=>{var s,e;let t=((e=(s=A.current)==null?void 0:s.innerText)==null?void 0:e.replace(/\u200B/g,""))||"";return t===`
3
3
  `&&(t=""),t},ae=()=>{var s;let t=((s=A.current)==null?void 0:s.innerHTML)||"";return t==="<br>"&&(t=""),t},We=t=>{const s=[];let e=0;const i=/\[([^\]]+)\]/g;let a;const d=$e();let f=0;if(t===""||!t||t===`
4
4
  `)return[{type:"text",content:"​",id:`text-${f++}-${d}`}];const O=new Set((h||[]).map(N=>N.name));for(;(a=i.exec(t))!==null;){if(a.index>e){const B=t.substring(e,a.index).split(`
5
5
  `);B.forEach((Y,lt)=>{Y&&s.push({type:"text",content:Y,id:`text-${f++}-${d}`}),lt<B.length-1&&s.push({type:"newline",id:`newline-${f++}-${d}`})})}const N=a[1];if(O.has(N)){const n=h.find(B=>B.name===N);(n==null?void 0:n.type)==="input"?s.push({type:"input",name:n==null?void 0:n.name,content:(n==null?void 0:n.content)||"",placeholder:(n==null?void 0:n.placeholder)||N,id:`input-${f++}-${d}`}):(n==null?void 0:n.type)==="label"?s.push({type:"label",name:n==null?void 0:n.name,content:(n==null?void 0:n.content)||"",id:`label-${f++}-${d}`}):(n==null?void 0:n.type)==="select"?s.push({type:"select",name:n==null?void 0:n.name,content:(n==null?void 0:n.content)||"",placeholder:(n==null?void 0:n.placeholder)||N,options:(n==null?void 0:n.options)||[],id:`select-${f++}-${d}`}):(n==null?void 0:n.type)==="multiple-select"?s.push({type:"multiple-select",name:n==null?void 0:n.name,content:(n==null?void 0:n.content)||"",placeholder:(n==null?void 0:n.placeholder)||N,options:(n==null?void 0:n.options)||[],id:`multiple-select-${f++}-${d}`}):(n==null?void 0:n.type)==="date-picker"&&s.push({type:"date-picker",name:n==null?void 0:n.name,content:(n==null?void 0:n.content)||"",placeholder:(n==null?void 0:n.placeholder)||N,id:`date-picker-${f++}-${d}`})}else s.push({type:"text",content:`[${N}]`,id:`text-${f++}-${d}`});e=i.lastIndex}if(e<t.length){const n=t.substring(e).split(`
6
- `);n.forEach((B,Y)=>{B&&s.push({type:"text",content:B,id:`text-${f++}`}),Y<n.length-1&&s.push({type:"newline",id:`newline-${f++}`})})}return s},de=()=>{var t;(t=A.current)==null||t.setAttribute("contenteditable","true"),L.current&&(v(L.current)&&L.current.children[0].setAttribute("contenteditable","false"),L.current=null),te||F(A.current)},Fe=t=>{R==null||R(t)},Ce=t=>{de()},K=t=>{var e,i;const s=t.nativeEvent;if(z.current||s!=null&&s.isComposing){H().length>0?(e=A.current)==null||e.classList.remove("is-empty"):(i=A.current)==null||i.classList.add("is-empty");return}G(H()),ie(ae()),b==null||b(H()),tt(t)},ve=t=>{var s,e;if(!(z.current||(s=t.nativeEvent)!=null&&s.isComposing)&&D(t,P.ENTER)&&!t.shiftKey&&!ht){t.preventDefault();const i=H();if(i.length===0||(e=A.current)!=null&&e.innerHTML.match(/^<span>[\s\u200B]*(<br\s*\/?>[\s\u200B]*)+<\/span>$/))return;y?i.length<=y?E==null||E(i):ne==null||ne(i,y):E==null||E(i)}},qe=t=>{var e;if(V&&(C==null?void 0:C.type)===g.LABEL&&(D(t,P.ARROW_UP)||D(t,P.ARROW_DOWN)||D(t,P.ENTER))){t.preventDefault();return}_(!1),w==null||w(t);const s=ot();if(s&&pt(s)){if(D(t,P.ARROW_LEFT)){const i=s==null?void 0:s.previousElementSibling,a=he(s);i&&a===0&&v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(D(t,P.ARROW_RIGHT)){const i=s==null?void 0:s.nextElementSibling,a=he(s);i&&a===((e=s.textContent)==null?void 0:e.length)&&v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{ee(i.children[0])}))}}if(D(t,P.BACKSPACE)&&t.target){const i=t.target;if(i.childElementCount===1&&i.children[0].tagName==="SPAN"){const a=i.children[0];i.childNodes.length===1&&(a.innerHTML==="​"&&t.preventDefault(),a.innerHTML==="<br>"&&(t.preventDefault(),a.innerHTML="​"))}}if(s&&s.getAttribute("data-set-type")==="container"){if(D(t,P.ARROW_LEFT)){const i=ut();v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(D(t,P.ARROW_RIGHT)){const i=ft();v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{ee(i.children[0])}))}}ve(t)},Ke=t=>{if(V&&(C==null?void 0:C.type)===g.LABEL&&(D(t,P.ARROW_UP)||D(t,P.ARROW_DOWN)||D(t,P.ENTER))){t.preventDefault();return}q==null||q(t)},Ve=t=>{const e=t.clipboardData.items;for(let i=0;i<e.length;i++)if(e[i].type.indexOf("image")!==-1){t.preventDefault();return}},Ue=t=>{t.preventDefault();const e=window.getSelection().toString();if(!e)return;const i=e.replace(/\u200B/g,"")||"",a=e.replace(/\u200B/g,"")||"";t.clipboardData.setData("text/plain",i),t.clipboardData.setData("text/html",a)},ze=t=>{m==null||m(t)},Ge=()=>{z.current=!0},Ie=()=>{setTimeout(()=>{G(H()),ie(ae()),b==null||b(H())},0)},Xe=(t,s)=>{s.stopPropagation()},me=(t,s)=>{var i;te||s.stopPropagation(),L.current&&Pe(L.current),(i=A.current)==null||i.setAttribute("contenteditable","false");const e=document.getElementById(t.id);L.current=e,requestAnimationFrame(()=>{W(e)})},Je=(t,s)=>{var a,d,f,O,N;w==null||w(s),s.stopPropagation();const e=s.target,i=he(e);if(D(s,P.BACKSPACE)&&i===0){const n=(a=e.parentElement)==null?void 0:a.previousElementSibling;n&&(v(n)&&n.children[0]&&((d=n.children[0].textContent)!=null&&d.length)?(L.current=n,W(n),F(n.children[0]),requestAnimationFrame(()=>{pe(n.children[0])})):(de(),F(n)))}if(D(s,P.ARROW_RIGHT)&&i===((f=e.textContent)==null?void 0:f.length)){const n=(O=e.parentElement)==null?void 0:O.nextElementSibling;n&&(v(n)&&n.children[0]&&((N=n.children[0].textContent)!=null&&N.length)?(L.current=n,W(n),ee(n.children[0]),requestAnimationFrame(()=>{pe(n.children[0])})):(de(),ee(n)))}D(s,P.ENTER)&&s.shiftKey&&s.preventDefault()},Qe=(t,s)=>{q==null||q(s);const e=s.target;pe(e)},we=(t,s)=>{var i;te||s.stopPropagation(),L.current&&Pe(L.current),(i=A.current)==null||i.setAttribute("contenteditable","false");const e=document.getElementById(t.id);L.current=e,requestAnimationFrame(()=>{W(e)})},Ze=(t,s)=>{G(H()),ie(ae()),b==null||b(H())},Ye=(t,s)=>{};c.useEffect(()=>{if(!V)return;const t=i=>{$.current&&!$.current.contains(i.target)&&_(!1)},s=i=>{$.current&&!$.current.contains(i.target)&&_(!1)},e=()=>{_(!1)};return document.addEventListener("mousedown",t),document.addEventListener("scroll",s,!0),window.addEventListener("resize",e),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("scroll",s,!0),window.removeEventListener("resize",e)}},[V]);const Q=(t,s)=>{if(C&&s!==g.LABEL&&Oe(C.id,t),s===g.SELECT&&(_(!1),K({})),s===g.LABEL&&(fe(),_(!1),requestAnimationFrame(()=>{const e=window.getSelection();e&&Z.current&&(e.removeAllRanges(),e.addRange(Z.current),setTimeout(()=>{var f;const i=document.createElement("span");i.contentEditable="false",i.setAttribute("data-set-type","label"),i.id=C.id;const a=document.createElement("span");a.contentEditable="false",a.textContent=t,i.appendChild(a);const d=(f=A.current)==null?void 0:f.children;if((d==null?void 0:d.length)===1&&d[0].tagName==="SPAN"&&d[0].innerHTML==="​[")A.current.innerHTML="",A.current.appendChild(i),setTimeout(()=>{K({}),fe()},0);else{document.execCommand("delete",!1,void 0);const O=Z.current;O.insertNode(i),O.setStartAfter(i),O.setEndAfter(i),e.removeAllRanges(),e.addRange(O),setTimeout(()=>{K({})},0)}},0))})),s===g.MULTIPLE_SELECT||s===g.DATE_PICKER){const e=document.getElementById(C.id);e&&e.children[0]&&e.children[1]&&(t.length>0?(e.children[0].setAttribute("style","display: inline"),e.children[0].setAttribute("contenteditable","false"),e.children[1].setAttribute("style","display: none"),e.children[1].setAttribute("contenteditable","true")):(e.children[0].setAttribute("style","display: none"),e.children[0].setAttribute("contenteditable","true"),e.children[1].setAttribute("style","display: inline"),e.children[1].setAttribute("contenteditable","true"))),K({})}},Z=c.useRef(null),et=(x==null?void 0:x.map(t=>t.prefix))||[],tt=t=>{const s=t==null?void 0:t.nativeEvent,e=s==null?void 0:s.data;et.includes(e)&&dt().then(i=>{var d;const a=window.getSelection();a&&a.rangeCount>0&&(Z.current=a.getRangeAt(0)),nt({options:((d=x.find(f=>f.prefix===e))==null?void 0:d.options)||[],value:"",type:g.LABEL,id:"label-"+$e()},i)})},nt=(t,s)=>{le(t.options),U({top:-999999,left:-999999999}),ce(t),J(Ae),_(!0),requestAnimationFrame(()=>{if($.current){const e=$.current.getBoundingClientRect();let i=s.left,a=s.top+s.height;window.innerWidth-s.right<be&&s.width<e.width&&(i=s.right-e.width),s.top<e.height&&(a=s.top+s.height),U({top:a,left:i}),J(e.height)}})},Te=(t,s)=>{const i=s.target.getBoundingClientRect();le(t.options),ge(t.value||ke(t.id)),U({top:-999999,left:-999999999}),ce(t),J(Ae),_(!0),requestAnimationFrame(()=>{if($.current){const a=$.current.getBoundingClientRect();let d=i.left,f=i.top+i.height;window.innerWidth-i.right<be&&i.width<a.width&&(d=i.right-a.width),i.top<a.height&&(f=i.top+i.height),U({top:f,left:d}),J(a.height)}})},st=(t,s)=>{const i=s.target.getBoundingClientRect();let a=i.left,d=i.top-Re;window.innerWidth-i.right<xe&&(a=a-xe+i.width),i.top<Re&&(d=i.top+i.height),le(t.options),ge(t.value||ke(t.id)),U({top:d,left:a}),ce(t),_(!0)},it=(t,s)=>{Oe(t,s);const e=document.getElementById(t);e&&e.children[0]&&e.children[1]&&(s.length>0?(e.children[0].setAttribute("style","display: inline"),e.children[0].setAttribute("contenteditable","false"),e.children[1].setAttribute("style","display: none"),e.children[1].setAttribute("contenteditable","true")):(e.children[0].setAttribute("style","display: none"),e.children[0].setAttribute("contenteditable","true"),e.children[1].setAttribute("style","display: inline"),e.children[1].setAttribute("contenteditable","true"))),K({})},[rt,Se]=c.useState([]),[ue,Le]=c.useState(!0),Ne=c.useCallback(()=>{Le(!1);const t=We(l),s=[];return t.forEach(e=>{var i,a,d,f,O,N;if(e.type==="text")s.push(u.jsx("span",{onKeyDown:n=>Ye(),children:e.content},e.id));else if(e.type==="newline")s.push(u.jsx("br",{},e.id));else if(e.type==="label")s.push(u.jsx("span",{id:e.id,"data-set-type":"label",contentEditable:!1,children:u.jsx("span",{contentEditable:!1,children:e.name})},e.id));else if(e.type==="input")s.push(u.jsxs("span",{id:e.id,"data-set-type":"input",contentEditable:!1,suppressContentEditableWarning:!0,onInput:n=>Ze(),onClick:n=>Xe(e,n),onMouseDown:n=>me(e,n),onTouchEnd:n=>me(e,n),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{className:"cosmic-ai-input-inputContent",style:{padding:(i=e.content)!=null&&i.length?"2px 4px":"2px 0 2px 4px"},contentEditable:!1,onKeyDown:n=>Je(e,n),onKeyUp:n=>Qe(e,n),children:e.content}),u.jsx("span",{contentEditable:!1,style:{display:(a=e.content)!=null&&a.length?"none":"inline"},className:"cosmic-ai-input-placeholder",onMouseDown:n=>we(e,n),onTouchEnd:n=>we(e,n),children:e.placeholder})]},e.id));else if(e.type===g.SELECT){const n=e.content||((d=e.options)==null?void 0:d[0])||e.placeholder;s.push(u.jsx("span",{id:e.id,"data-set-type":"select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:B=>Te(e,B),"data-cosmic-ai-input-placeholder":e.placeholder,children:u.jsx("span",{contentEditable:!1,children:n})},e.id))}else if(e.type===g.MULTIPLE_SELECT){const n=e.content||((f=e.options)==null?void 0:f[0]);s.push(u.jsxs("span",{id:e.id,"data-set-type":"multiple-select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:B=>Te(e,B),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{style:{display:n!=null&&n.length?"inline":"none"},contentEditable:!1,children:n}),u.jsx("span",{style:{display:n!=null&&n.length?"none":"inline"},className:"cosmic-ai-input-selectPlaceholder",contentEditable:!1,children:e.placeholder})]},e.id))}else e.type===g.DATE_PICKER&&s.push(u.jsxs("span",{id:e.id,"data-set-type":"date-picker",contentEditable:!1,suppressContentEditableWarning:!0,onClick:n=>st(e,n),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{style:{display:(O=e.content)!=null&&O.length?"inline":"none"},contentEditable:!1,children:e.content}),u.jsx("span",{style:{display:(N=e.content)!=null&&N.length?"none":"inline"},className:"cosmic-ai-input-datePickerPlaceholder",contentEditable:!1,children:e.placeholder}),te&&u.jsx("input",{className:"cosmic-ai-input-ios-date-picker",type:"date",onChange:n=>{it(e.id,n.target.value)}})]},e.id))}),setTimeout(()=>{Le(!0)},0),s},[l]);c.useEffect(()=>{ue&&setTimeout(()=>{F(A.current)},0)},[ue]),c.useEffect(()=>{l!==se&&z.current===!1?(Se(Ne()),G(l),ye(!0)):(l===""||!l)&&Se(Ne()),z.current=!1},[l,se]),c.useEffect(()=>{if(!j&&!Ee)return;const t=new MutationObserver(()=>{A.current&&document.contains(A.current)&&(requestAnimationFrame(()=>{F(A.current),ye(!1)}),t.disconnect())});return A.current&&t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()},[j,Ee]);const fe=()=>{A.current&&requestAnimationFrame(()=>{F(A.current)})};return c.useImperativeHandle(o,()=>({getCurrentValue:H,focus:fe})),u.jsxs("div",{className:De(`cosmic-ai-input-rows${p}`),style:{textIndent:S+"px"},children:[ue&&u.jsx("div",{"data-set-type":"container","data-cosmic-ai-input-placeholder":k,className:De("cosmic-ai-input",`cosmic-ai-input-rows${p}`,{"is-disabled":M},{"is-empty":se.length===0}),ref:A,contentEditable:!0,suppressContentEditableWarning:!0,onClick:t=>Fe(t),onFocus:t=>{ze(t)},onBlur:t=>{T==null||T(t)},onMouseDown:t=>Ce(),onTouchEnd:t=>Ce(),onKeyDown:t=>qe(t),onKeyUp:t=>Ke(t),onInput:t=>K(t),onCopy:t=>Ue(t),onPaste:t=>Ve(t),onCompositionStart:Ge,onCompositionEnd:Ie,children:rt}),V&&ct.createPortal((C==null?void 0:C.type)===g.MULTIPLE_SELECT?u.jsx(Be,{ref:$,options:re,value:X,position:I,height:oe,onChange:Q},g.MULTIPLE_SELECT):(C==null?void 0:C.type)===g.DATE_PICKER?u.jsx(je,{ref:$,value:X,position:I,onChange:Q},g.DATE_PICKER):(C==null?void 0:C.type)===g.LABEL?u.jsx(_e,{ref:$,options:re,value:X,position:I,height:oe,onChange:Q},g.LABEL):u.jsx(Me,{ref:$,options:re,value:X,position:I,height:oe,onChange:Q},g.SELECT),document.body)]})});He.displayName="AiInput";exports.default=He;
6
+ `);n.forEach((B,Y)=>{B&&s.push({type:"text",content:B,id:`text-${f++}`}),Y<n.length-1&&s.push({type:"newline",id:`newline-${f++}`})})}return s},de=()=>{var t;(t=A.current)==null||t.setAttribute("contenteditable","true"),L.current&&(v(L.current)&&L.current.children[0].setAttribute("contenteditable","false"),L.current=null),te||F(A.current)},Fe=t=>{R==null||R(t)},Ce=t=>{de()},K=t=>{var e,i;const s=t.nativeEvent;if(z.current||s!=null&&s.isComposing){H().length>0?(e=A.current)==null||e.classList.remove("is-empty"):(i=A.current)==null||i.classList.add("is-empty");return}G(H()),ie(ae()),b==null||b(H()),tt(t)},ve=t=>{var s,e;if(!(z.current||(s=t.nativeEvent)!=null&&s.isComposing)&&D(t,P.ENTER)&&!t.shiftKey&&!ht){t.preventDefault();const i=H();if(i.length===0||(e=A.current)!=null&&e.innerHTML.match(/^<span>[\s\u200B]*(<br\s*\/?>[\s\u200B]*)+<\/span>$/))return;y?i.length<=y?E==null||E(i):ne==null||ne(i,y):E==null||E(i)}},qe=t=>{var e;if(V&&(C==null?void 0:C.type)===g.LABEL&&(D(t,P.ARROW_UP)||D(t,P.ARROW_DOWN)||D(t,P.ENTER))){t.preventDefault();return}_(!1),w==null||w(t);const s=ot();if(s&&pt(s)){if(D(t,P.ARROW_LEFT)){const i=s==null?void 0:s.previousElementSibling,a=he(s);i&&a===0&&v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(D(t,P.ARROW_RIGHT)){const i=s==null?void 0:s.nextElementSibling,a=he(s);i&&a===((e=s.textContent)==null?void 0:e.length)&&v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{ee(i.children[0])}))}}if(D(t,P.BACKSPACE)&&t.target){const i=t.target;if(i.childElementCount===1&&i.children[0].tagName==="SPAN"){const a=i.children[0];i.childNodes.length===1&&(a.innerHTML==="​"&&t.preventDefault(),a.innerHTML==="<br>"&&(t.preventDefault(),a.innerHTML="​"))}}if(s&&s.getAttribute("data-set-type")==="container"){if(D(t,P.ARROW_LEFT)){const i=ut();v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(D(t,P.ARROW_RIGHT)){const i=ft();v(i)&&i.children[0]&&(L.current=i,W(i),requestAnimationFrame(()=>{ee(i.children[0])}))}}ve(t)},Ke=t=>{if(V&&(C==null?void 0:C.type)===g.LABEL&&(D(t,P.ARROW_UP)||D(t,P.ARROW_DOWN)||D(t,P.ENTER))){t.preventDefault();return}q==null||q(t)},Ve=t=>{const e=t.clipboardData.items;for(let i=0;i<e.length;i++)if(e[i].type.indexOf("image")!==-1){t.preventDefault();return}},Ue=t=>{t.preventDefault();const e=window.getSelection().toString();if(!e)return;const i=e.replace(/\u200B/g,"")||"",a=e.replace(/\u200B/g,"")||"";t.clipboardData.setData("text/plain",i),t.clipboardData.setData("text/html",a)},ze=t=>{m==null||m(t)},Ge=()=>{z.current=!0},Ie=()=>{setTimeout(()=>{G(H()),ie(ae()),b==null||b(H())},0)},Xe=(t,s)=>{s.stopPropagation()},me=(t,s)=>{var i;te||s.stopPropagation(),L.current&&Pe(L.current),(i=A.current)==null||i.setAttribute("contenteditable","false");const e=document.getElementById(t.id);L.current=e,requestAnimationFrame(()=>{W(e)})},Je=(t,s)=>{var a,d,f,O,N;w==null||w(s),s.stopPropagation();const e=s.target,i=he(e);if(D(s,P.BACKSPACE)&&i===0){const n=(a=e.parentElement)==null?void 0:a.previousElementSibling;n&&(v(n)&&n.children[0]&&((d=n.children[0].textContent)!=null&&d.length)?(L.current=n,W(n),F(n.children[0]),requestAnimationFrame(()=>{pe(n.children[0])})):(de(),F(n)))}if(D(s,P.ARROW_RIGHT)&&i===((f=e.textContent)==null?void 0:f.length)){const n=(O=e.parentElement)==null?void 0:O.nextElementSibling;n&&(v(n)&&n.children[0]&&((N=n.children[0].textContent)!=null&&N.length)?(L.current=n,W(n),ee(n.children[0]),requestAnimationFrame(()=>{pe(n.children[0])})):(de(),ee(n)))}D(s,P.ENTER)&&s.shiftKey&&s.preventDefault()},Qe=(t,s)=>{q==null||q(s);const e=s.target;pe(e)},we=(t,s)=>{var i;te||s.stopPropagation(),L.current&&Pe(L.current),(i=A.current)==null||i.setAttribute("contenteditable","false");const e=document.getElementById(t.id);L.current=e,requestAnimationFrame(()=>{W(e)})},Ze=(t,s)=>{G(H()),ie(ae()),b==null||b(H())},Ye=(t,s)=>{};c.useEffect(()=>{if(!V)return;const t=i=>{$.current&&!$.current.contains(i.target)&&_(!1)},s=i=>{$.current&&!$.current.contains(i.target)&&_(!1)},e=()=>{_(!1)};return document.addEventListener("mousedown",t),document.addEventListener("scroll",s,!0),window.addEventListener("resize",e),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("scroll",s,!0),window.removeEventListener("resize",e)}},[V]);const Q=(t,s)=>{if(C&&s!==g.LABEL&&Oe(C.id,t),s===g.SELECT&&(_(!1),K({})),s===g.LABEL&&(fe(),_(!1),requestAnimationFrame(()=>{const e=window.getSelection();e&&Z.current&&(e.removeAllRanges(),e.addRange(Z.current),setTimeout(()=>{var f;const i=document.createElement("span");i.contentEditable="false",i.setAttribute("data-set-type","label"),i.id=C.id;const a=document.createElement("span");a.contentEditable="false",a.textContent=t,i.appendChild(a);const d=(f=A.current)==null?void 0:f.children;if((d==null?void 0:d.length)===1&&d[0].tagName==="SPAN"&&d[0].innerHTML==="​[")A.current.innerHTML="",A.current.appendChild(i),setTimeout(()=>{K({}),fe()},0);else{document.execCommand("delete",!1,void 0);const O=Z.current;O.insertNode(i),O.setStartAfter(i),O.setEndAfter(i),e.removeAllRanges(),e.addRange(O),setTimeout(()=>{K({})},0)}},0))})),s===g.MULTIPLE_SELECT||s===g.DATE_PICKER){const e=document.getElementById(C.id);e&&e.children[0]&&e.children[1]&&(t.length>0?(e.children[0].setAttribute("style","display: inline"),e.children[0].setAttribute("contenteditable","false"),e.children[1].setAttribute("style","display: none"),e.children[1].setAttribute("contenteditable","true")):(e.children[0].setAttribute("style","display: none"),e.children[0].setAttribute("contenteditable","true"),e.children[1].setAttribute("style","display: inline"),e.children[1].setAttribute("contenteditable","true"))),K({})}},Z=c.useRef(null),et=(x==null?void 0:x.map(t=>t.prefix))||[],tt=t=>{const s=t==null?void 0:t.nativeEvent,e=s==null?void 0:s.data;et.includes(e)&&dt().then(i=>{var d;const a=window.getSelection();a&&a.rangeCount>0&&(Z.current=a.getRangeAt(0)),nt({options:((d=x.find(f=>f.prefix===e))==null?void 0:d.options)||[],value:"",type:g.LABEL,id:"label-"+$e()},i)})},nt=(t,s)=>{le(t.options),U({top:-999999,left:-999999999}),ce(t),J(Ae),_(!0),requestAnimationFrame(()=>{if($.current){const e=$.current.getBoundingClientRect();let i=s.left,a=s.top+s.height;window.innerWidth-s.right<be&&s.width<e.width&&(i=s.right-e.width),s.top<e.height&&(a=s.top+s.height),U({top:a,left:i}),J(e.height)}})},Te=(t,s)=>{const i=s.target.getBoundingClientRect();le(t.options),ge(t.value||ke(t.id)),U({top:-999999,left:-999999999}),ce(t),J(Ae),_(!0),requestAnimationFrame(()=>{if($.current){const a=$.current.getBoundingClientRect();let d=i.left,f=i.top+i.height;window.innerWidth-i.right<be&&i.width<a.width&&(d=i.right-a.width),i.top<a.height&&(f=i.top+i.height),U({top:f,left:d}),J(a.height)}})},st=(t,s)=>{const i=s.target.getBoundingClientRect();let a=i.left,d=i.top-Re;window.innerWidth-i.right<xe&&(a=a-xe+i.width),i.top<Re&&(d=i.top+i.height),le(t.options),ge(t.value||ke(t.id)),U({top:d,left:a}),ce(t),_(!0)},it=(t,s)=>{Oe(t,s);const e=document.getElementById(t);e&&e.children[0]&&e.children[1]&&(s.length>0?(e.children[0].setAttribute("style","display: inline"),e.children[0].setAttribute("contenteditable","false"),e.children[1].setAttribute("style","display: none"),e.children[1].setAttribute("contenteditable","true")):(e.children[0].setAttribute("style","display: none"),e.children[0].setAttribute("contenteditable","true"),e.children[1].setAttribute("style","display: inline"),e.children[1].setAttribute("contenteditable","true"))),K({})},[rt,Se]=c.useState([]),[ue,Le]=c.useState(!0),Ne=c.useCallback(()=>{Le(!1);const t=We(l),s=[];return t.forEach(e=>{var i,a,d,f,O,N;if(e.type==="text")s.push(u.jsx("span",{onKeyDown:n=>Ye(),children:e.content},e.id));else if(e.type==="newline")s.push(u.jsx("br",{},e.id));else if(e.type==="label")s.push(u.jsx("span",{id:e.id,"data-set-type":"label",contentEditable:!1,children:u.jsx("span",{contentEditable:!1,children:e.name})},e.id));else if(e.type==="input")s.push(u.jsxs("span",{id:e.id,"data-set-type":"input",contentEditable:!1,suppressContentEditableWarning:!0,onInput:n=>Ze(),onClick:n=>Xe(e,n),onMouseDown:n=>me(e,n),onTouchEnd:n=>me(e,n),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{className:"cosmic-ai-input-inputContent",style:{padding:(i=e.content)!=null&&i.length?"2px 4px":"2px 0 2px 4px"},contentEditable:!1,onKeyDown:n=>Je(e,n),onKeyUp:n=>Qe(e,n),children:e.content}),u.jsx("span",{contentEditable:!1,style:{display:(a=e.content)!=null&&a.length?"none":"inline"},className:"cosmic-ai-input-placeholder",onMouseDown:n=>we(e,n),onTouchEnd:n=>we(e,n),children:e.placeholder})]},e.id));else if(e.type===g.SELECT){const n=e.content||((d=e.options)==null?void 0:d[0])||e.placeholder;s.push(u.jsx("span",{id:e.id,"data-set-type":"select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:B=>Te(e,B),"data-cosmic-ai-input-placeholder":e.placeholder,children:u.jsx("span",{contentEditable:!1,children:n})},e.id))}else if(e.type===g.MULTIPLE_SELECT){const n=e.content||((f=e.options)==null?void 0:f[0]);s.push(u.jsxs("span",{id:e.id,"data-set-type":"multiple-select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:B=>Te(e,B),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{style:{display:n!=null&&n.length?"inline":"none"},contentEditable:!1,children:n}),u.jsx("span",{style:{display:n!=null&&n.length?"none":"inline"},className:"cosmic-ai-input-selectPlaceholder",contentEditable:!1,children:e.placeholder})]},e.id))}else e.type===g.DATE_PICKER&&s.push(u.jsxs("span",{id:e.id,"data-set-type":"date-picker",contentEditable:!1,suppressContentEditableWarning:!0,onClick:n=>st(e,n),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{style:{display:(O=e.content)!=null&&O.length?"inline":"none"},contentEditable:!1,children:e.content}),u.jsx("span",{style:{display:(N=e.content)!=null&&N.length?"none":"inline"},className:"cosmic-ai-input-datePickerPlaceholder",contentEditable:!1,children:e.placeholder}),te&&u.jsx("input",{style:{position:"absolute",left:0,opacity:0},type:"date",onChange:n=>{it(e.id,n.target.value)}})]},e.id))}),setTimeout(()=>{Le(!0)},0),s},[l]);c.useEffect(()=>{ue&&setTimeout(()=>{F(A.current)},0)},[ue]),c.useEffect(()=>{l!==se&&z.current===!1?(Se(Ne()),G(l),ye(!0)):(l===""||!l)&&Se(Ne()),z.current=!1},[l,se]),c.useEffect(()=>{if(!j&&!Ee)return;const t=new MutationObserver(()=>{A.current&&document.contains(A.current)&&(requestAnimationFrame(()=>{F(A.current),ye(!1)}),t.disconnect())});return A.current&&t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()},[j,Ee]);const fe=()=>{A.current&&requestAnimationFrame(()=>{F(A.current)})};return c.useImperativeHandle(o,()=>({getCurrentValue:H,focus:fe})),u.jsxs("div",{className:De(`cosmic-ai-input-rows${p}`),style:{textIndent:S+"px"},children:[ue&&u.jsx("div",{"data-set-type":"container","data-cosmic-ai-input-placeholder":k,className:De("cosmic-ai-input",`cosmic-ai-input-rows${p}`,{"is-disabled":M},{"is-empty":se.length===0}),ref:A,contentEditable:!0,suppressContentEditableWarning:!0,onClick:t=>Fe(t),onFocus:t=>{ze(t)},onBlur:t=>{T==null||T(t)},onMouseDown:t=>Ce(),onTouchEnd:t=>Ce(),onKeyDown:t=>qe(t),onKeyUp:t=>Ke(t),onInput:t=>K(t),onCopy:t=>Ue(t),onPaste:t=>Ve(t),onCompositionStart:Ge,onCompositionEnd:Ie,children:rt}),V&&ct.createPortal((C==null?void 0:C.type)===g.MULTIPLE_SELECT?u.jsx(Be,{ref:$,options:re,value:X,position:I,height:oe,onChange:Q},g.MULTIPLE_SELECT):(C==null?void 0:C.type)===g.DATE_PICKER?u.jsx(je,{ref:$,value:X,position:I,onChange:Q},g.DATE_PICKER):(C==null?void 0:C.type)===g.LABEL?u.jsx(_e,{ref:$,options:re,value:X,position:I,height:oe,onChange:Q},g.LABEL):u.jsx(Me,{ref:$,options:re,value:X,position:I,height:oe,onChange:Q},g.SELECT),document.body)]})});He.displayName="AiInput";exports.default=He;
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- // Generated at: 2026-04-04T08:28:32.786Z
1
+ // Generated at: 2026-04-04T08:47:21.405Z
2
2
  import { jsx as u, jsxs as ie } from "react/jsx-runtime";
3
3
  import { forwardRef as X, useRef as H, useEffect as B, useState as S, useCallback as We, useImperativeHandle as ut } from "react";
4
4
  import $e from "classnames";
@@ -775,9 +775,20 @@ const Ct = X((r, o) => {
775
775
  children: e.placeholder
776
776
  }
777
777
  ),
778
- re && /* @__PURE__ */ u("input", { className: "cosmic-ai-input-ios-date-picker", type: "date", onChange: (n) => {
779
- ct(e.id, n.target.value);
780
- } })
778
+ re && /* @__PURE__ */ u(
779
+ "input",
780
+ {
781
+ style: {
782
+ position: "absolute",
783
+ left: 0,
784
+ opacity: 0
785
+ },
786
+ type: "date",
787
+ onChange: (n) => {
788
+ ct(e.id, n.target.value);
789
+ }
790
+ }
791
+ )
781
792
  ]
782
793
  },
783
794
  e.id
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-ios-date-picker{position:absolute;left:0;opacity:0}.cosmic-ai-input-commonSlot{padding:2px 0}
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosmic-ai-input",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "A powerful AI conversation input component for React with TypeScript support",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",