cosmic-ai-input 1.0.12 → 1.0.13
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/README.md +95 -4
- package/dist/index.cjs.js +6 -6
- package/dist/index.d.ts +26 -6
- package/dist/index.es.js +603 -444
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ import 'cosmic-ai-input/dist/style.css';
|
|
|
36
36
|
|
|
37
37
|
const App = () => {
|
|
38
38
|
const aiInputRef = useRef(null);
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
const varList = [
|
|
41
41
|
{
|
|
42
42
|
type: 'input',
|
|
@@ -63,6 +63,22 @@ const App = () => {
|
|
|
63
63
|
name: 'birthday',
|
|
64
64
|
content: '',
|
|
65
65
|
placeholder: 'Select birthday'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'label',
|
|
69
|
+
name: 'tags',
|
|
70
|
+
content: ''
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const mentions = [
|
|
75
|
+
{
|
|
76
|
+
prefix: '@',
|
|
77
|
+
options: ['User1', 'User2', 'User3']
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
prefix: '[',
|
|
81
|
+
options: ['name', 'gender', 'hobbies', 'birthday', 'tags']
|
|
66
82
|
}
|
|
67
83
|
];
|
|
68
84
|
|
|
@@ -78,17 +94,25 @@ const App = () => {
|
|
|
78
94
|
}
|
|
79
95
|
};
|
|
80
96
|
|
|
97
|
+
const handleFocus = () => {
|
|
98
|
+
if (aiInputRef.current) {
|
|
99
|
+
aiInputRef.current.focus();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
81
103
|
return (
|
|
82
104
|
<div>
|
|
83
105
|
<h1>AI 对话输入组件示例</h1>
|
|
84
106
|
<AiInput
|
|
85
107
|
ref={aiInputRef}
|
|
86
108
|
varList={varList}
|
|
109
|
+
mentions={mentions}
|
|
87
110
|
value="你好 [name],你的性别是 [gender],爱好是 [hobbies],生日是 [birthday]"
|
|
88
111
|
placeholder="在这里输入你的消息..."
|
|
89
112
|
onSend={handleSend}
|
|
90
113
|
/>
|
|
91
114
|
<button onClick={handleGetValue}>获取当前值</button>
|
|
115
|
+
<button onClick={handleFocus}>获得焦点</button>
|
|
92
116
|
</div>
|
|
93
117
|
);
|
|
94
118
|
};
|
|
@@ -96,6 +120,15 @@ const App = () => {
|
|
|
96
120
|
export default App;
|
|
97
121
|
```
|
|
98
122
|
|
|
123
|
+
## 键盘快捷键
|
|
124
|
+
|
|
125
|
+
| 快捷键 | 行为 |
|
|
126
|
+
|--------|------|
|
|
127
|
+
| Enter | 发送消息(触发 onSend 回调) |
|
|
128
|
+
| Shift + Enter | 不再换行,直接发送消息 |
|
|
129
|
+
| 上下箭头 | 在提及选项列表中导航 |
|
|
130
|
+
| Escape | 关闭打开的下拉菜单 |
|
|
131
|
+
|
|
99
132
|
## API
|
|
100
133
|
|
|
101
134
|
### AiInputProps
|
|
@@ -103,15 +136,16 @@ export default App;
|
|
|
103
136
|
| 属性 | 类型 | 默认值 | 描述 |
|
|
104
137
|
|------|------|--------|------|
|
|
105
138
|
| value | string | - | 输入框的值,支持使用 `[变量名]` 格式引用变量 |
|
|
106
|
-
| varList | VarItem[] | - |
|
|
139
|
+
| varList | VarItem[] | - | 变量列表,包含输入框、选择框、多选框、日期选择器和标签等 |
|
|
107
140
|
| placeholder | string | '' | 占位符文本 |
|
|
108
141
|
| maxLength | 1 \| 2 \| 3 \| 4 \| undefined | - | 最大行数限制 |
|
|
109
142
|
| defaultRows | number | 3 | 默认显示行数 |
|
|
110
143
|
| disabled | boolean | false | 是否禁用输入框 |
|
|
111
144
|
| defaultFocus | boolean | false | 是否默认获得焦点 |
|
|
112
145
|
| textIndex | number | 0 | 文本缩进距离(单位:像素) |
|
|
146
|
+
| mentions | MentionItem[] | [] | 提及配置,支持自定义前缀触发选项列表 |
|
|
113
147
|
| onParse | (parsedValue: string) => void | - | 解析输入值时的回调函数 |
|
|
114
|
-
| onSend | (value: string) => void | - |
|
|
148
|
+
| onSend | (value: string) => void | - | 发送消息时的回调函数(按 Enter 键触发) |
|
|
115
149
|
| onMaxLengthExceeded | (value: string, maxLength: number) => void | - | 超过最大长度时的回调函数 |
|
|
116
150
|
| onFocus | (e: React.FocusEvent) => void | - | 获得焦点时的回调函数 |
|
|
117
151
|
| onBlur | (e: React.FocusEvent) => void | - | 失去焦点时的回调函数 |
|
|
@@ -173,6 +207,49 @@ interface DatePickerItem extends BaseInputItem {
|
|
|
173
207
|
}
|
|
174
208
|
```
|
|
175
209
|
|
|
210
|
+
### LabelItem
|
|
211
|
+
|
|
212
|
+
标签项:
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
interface LabelItem {
|
|
216
|
+
type: 'label'; // 类型为 label
|
|
217
|
+
name: string; // 变量名,用于在 value 中引用
|
|
218
|
+
content: string; // 标签内容
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### MentionItem
|
|
223
|
+
|
|
224
|
+
提及配置项:
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
interface MentionItem {
|
|
228
|
+
prefix: string; // 触发前缀,如 '@' 或 '['
|
|
229
|
+
title?: string; // 可选的标题
|
|
230
|
+
options: string[]; // 选项列表
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**使用示例:**
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
<AiInput
|
|
238
|
+
mentions={[
|
|
239
|
+
{
|
|
240
|
+
prefix: '@',
|
|
241
|
+
options: ['用户1', '用户2', '用户3']
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
prefix: '[',
|
|
245
|
+
options: ['话题1', '话题2', '话题3']
|
|
246
|
+
}
|
|
247
|
+
]}
|
|
248
|
+
// 当用户输入 @ 或 [ 时,会显示对应的选项列表
|
|
249
|
+
// 支持键盘上下箭头导航,回车选择
|
|
250
|
+
/>
|
|
251
|
+
```
|
|
252
|
+
|
|
176
253
|
### AiInputRef
|
|
177
254
|
|
|
178
255
|
通过 ref 可以访问的方法:
|
|
@@ -180,6 +257,7 @@ interface DatePickerItem extends BaseInputItem {
|
|
|
180
257
|
| 方法 | 类型 | 描述 |
|
|
181
258
|
|------|------|------|
|
|
182
259
|
| getCurrentValue | () => string | 获取当前输入框的值(包含变量替换后的完整文本) |
|
|
260
|
+
| focus | () => void | 让输入框获得焦点 |
|
|
183
261
|
|
|
184
262
|
## TypeScript 支持
|
|
185
263
|
|
|
@@ -214,7 +292,19 @@ export interface DatePickerItem extends BaseInputItem {
|
|
|
214
292
|
type: 'date-picker';
|
|
215
293
|
}
|
|
216
294
|
|
|
217
|
-
export
|
|
295
|
+
export interface LabelItem {
|
|
296
|
+
type: 'label';
|
|
297
|
+
name: string;
|
|
298
|
+
content: string;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface MentionItem {
|
|
302
|
+
prefix: string;
|
|
303
|
+
title?: string;
|
|
304
|
+
options: string[];
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export type VarItem = InputItem | SelectItem | MultipleSelectItem | DatePickerItem | LabelItem;
|
|
218
308
|
|
|
219
309
|
export interface AiInputProps {
|
|
220
310
|
value?: string;
|
|
@@ -225,6 +315,7 @@ export interface AiInputProps {
|
|
|
225
315
|
disabled?: boolean;
|
|
226
316
|
defaultFocus?: boolean;
|
|
227
317
|
textIndex?: number;
|
|
318
|
+
mentions?: MentionItem[];
|
|
228
319
|
onParse?: (parsedValue: string) => void;
|
|
229
320
|
onSend?: (value: string) => void;
|
|
230
321
|
onMaxLengthExceeded?: (value: string, maxLength: number) => void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Generated at: 2026-
|
|
2
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
3
|
-
`&&(n=""),n},
|
|
4
|
-
`)return[{type:"text",content:"",id:`text-${
|
|
5
|
-
`);
|
|
6
|
-
`);e.forEach((N,V)=>{N&&s.push({type:"text",content:N,id:`text-${h++}`}),V<e.length-1&&s.push({type:"newline",id:`newline-${h++}`})})}return s},J=()=>{var n;(n=b.current)==null||n.setAttribute("contenteditable","true"),g.current&&(P(g.current)&&g.current.children[0].setAttribute("contenteditable","false"),g.current=null),F(b.current)},Te=n=>{m==null||m(n)},ke=n=>{J()},fe=n=>{z(H()),ee(ue()),u==null||u(H())},De=n=>{var s;if(n.code==="Enter"&&!n.shiftKey){n.preventDefault();const t=H();if(t.length===0||(s=b.current)!=null&&s.innerHTML.match(/^<span>[\s\u200B]*(<br\s*\/?>[\s\u200B]*)+<\/span>$/))return;w?t.length<=w?R==null||R(t):_==null||_(t,w):R==null||R(t)}},$e=n=>{var t;M==null||M(n);const s=Ue();if(s&&Qe(s)){if(n.code==="ArrowLeft"){const i=s==null?void 0:s.previousElementSibling,a=I(s);i&&a===0&&P(i)&&i.children[0]&&(g.current=i,L(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(n.code==="ArrowRight"){const i=s==null?void 0:s.nextElementSibling,a=I(s);i&&a===((t=s.textContent)==null?void 0:t.length)&&P(i)&&i.children[0]&&(g.current=i,L(i),requestAnimationFrame(()=>{W(i.children[0])}))}n.code==="Backspace"&&(s.innerHTML===""&&n.preventDefault(),s.innerHTML==="<br>"&&(n.preventDefault(),s.innerHTML=""))}if(s&&s.getAttribute("data-set-type")==="container"){if(n.code==="ArrowLeft"){const i=Ge();P(i)&&i.children[0]&&(g.current=i,L(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(n.code==="ArrowRight"){const i=Je();P(i)&&i.children[0]&&(g.current=i,L(i),requestAnimationFrame(()=>{W(i.children[0])}))}}De(n)},je=n=>{O==null||O(n)},Le=n=>{n.preventDefault();const t=window.getSelection().toString();if(!t)return;const i=t,a=t;n.clipboardData.setData("text/plain",i),n.clipboardData.setData("text/html",a)},Fe=n=>{k==null||k(n)},Pe=(n,s)=>{s.stopPropagation()},Me=(n,s)=>{var i;s.stopPropagation(),g.current&&be(g.current),(i=b.current)==null||i.setAttribute("contenteditable","false");const t=document.getElementById(n.id);g.current=t,requestAnimationFrame(()=>{L(t)})},Oe=(n,s)=>{var a,p,h,j,y;M==null||M(s),s.stopPropagation();const t=s.target,i=I(t);if(s.code==="Backspace"&&i===0){const e=(a=t.parentElement)==null?void 0:a.previousElementSibling;e&&(P(e)&&e.children[0]&&((p=e.children[0].textContent)!=null&&p.length)?(g.current=e,L(e),F(e.children[0]),requestAnimationFrame(()=>{Z(e.children[0])})):(J(),F(e)))}if(s.code==="ArrowRight"&&i===((h=t.textContent)==null?void 0:h.length)){const e=(j=t.parentElement)==null?void 0:j.nextElementSibling;e&&(P(e)&&e.children[0]&&((y=e.children[0].textContent)!=null&&y.length)?(g.current=e,L(e),W(e.children[0]),requestAnimationFrame(()=>{Z(e.children[0])})):(J(),W(e)))}},Be=(n,s)=>{O==null||O(s);const t=s.target;Z(t)},He=(n,s)=>{var i;s.stopPropagation(),g.current&&be(g.current),(i=b.current)==null||i.setAttribute("contenteditable","false");const t=document.getElementById(n.id);g.current=t,requestAnimationFrame(()=>{L(t)})},qe=(n,s)=>{z(H()),ee(ue()),u==null||u(H())},Ve=(n,s)=>{};o.useEffect(()=>{if(!K)return;const n=i=>{$.current&&!$.current.contains(i.target)&&B(!1)},s=i=>{$.current&&!$.current.contains(i.target)&&B(!1)},t=()=>{B(!1)};return document.addEventListener("mousedown",n),document.addEventListener("scroll",s,!0),window.addEventListener("resize",t),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("scroll",s,!0),window.removeEventListener("resize",t)}},[K]);const Q=(n,s)=>{if(D&&Xe(D.id,n),s==="select"&&B(!1),s==="multiple-select"||s==="date-picker"){const t=document.getElementById(D.id);t&&t.children[0]&&t.children[1]&&(n.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")))}fe()},pe=(n,s)=>{const i=s.target.getBoundingClientRect();ne(n.options),se(n.value||Ee(n.id)),U({top:-999999,left:-999999999}),ce(n),ie(Ae),B(!0),requestAnimationFrame(()=>{if($.current){const a=$.current.getBoundingClientRect();let p=i.left,h=i.top+i.height;window.innerWidth-i.right<Se&&i.width<a.width&&(p=i.right-a.width),i.top<a.height&&(h=i.top+i.height),U({top:h,left:p}),ie(a.height)}})},We=(n,s)=>{const i=s.target.getBoundingClientRect();let a=i.left,p=i.top-de;window.innerWidth-i.right<ae&&(a=a-ae+i.width),i.top<de&&(p=i.top+i.height),ne(n.options),se(n.value||Ee(n.id)),U({top:p,left:a}),ce(n),B(!0)},[_e,he]=o.useState([]),[Y,ge]=o.useState(!0),ye=o.useCallback(()=>{ge(!1);const n=Ne(l),s=[];return n.forEach(t=>{var i,a,p,h,j,y;if(t.type==="text")s.push(d.jsx("span",{onKeyDown:e=>Ve(),children:t.content},t.id));else if(t.type==="newline")s.push(d.jsx("br",{},t.id));else if(t.type==="input")s.push(d.jsxs("span",{id:t.id,"data-set-type":"input",contentEditable:!1,suppressContentEditableWarning:!0,onInput:e=>qe(),onClick:e=>Pe(t,e),onMouseDown:e=>Me(t,e),"data-cosmic-ai-input-placeholder":t.placeholder,children:[d.jsx("span",{className:"cosmic-ai-input-inputContent",style:{padding:(i=t.content)!=null&&i.length?"2px 4px":"2px 0 2px 4px"},contentEditable:!1,onKeyDown:e=>Oe(t,e),onKeyUp:e=>Be(t,e),children:t.content}),d.jsx("span",{contentEditable:!1,style:{display:(a=t.content)!=null&&a.length?"none":"inline"},className:"cosmic-ai-input-placeholder",onMouseDown:e=>He(t,e),children:t.placeholder})]},t.id));else if(t.type==="select"){const e=t.content||((p=t.options)==null?void 0:p[0])||t.placeholder;s.push(d.jsx("span",{id:t.id,"data-set-type":"select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:N=>pe(t,N),"data-cosmic-ai-input-placeholder":t.placeholder,children:d.jsx("span",{contentEditable:!1,children:e})},t.id))}else if(t.type==="multiple-select"){const e=t.content||((h=t.options)==null?void 0:h[0]);s.push(d.jsxs("span",{id:t.id,"data-set-type":"multiple-select",contentEditable:!1,suppressContentEditableWarning:!0,onClick:N=>pe(t,N),"data-cosmic-ai-input-placeholder":t.placeholder,children:[d.jsx("span",{style:{display:e!=null&&e.length?"inline":"none"},contentEditable:!1,children:e}),d.jsx("span",{style:{display:e!=null&&e.length?"none":"inline"},className:"cosmic-ai-input-selectPlaceholder",contentEditable:!1,children:t.placeholder})]},t.id))}else t.type==="date-picker"&&s.push(d.jsxs("span",{id:t.id,"data-set-type":"date-picker",contentEditable:!1,suppressContentEditableWarning:!0,onClick:e=>We(t,e),"data-cosmic-ai-input-placeholder":t.placeholder,children:[d.jsx("span",{style:{display:(j=t.content)!=null&&j.length?"inline":"none"},contentEditable:!1,children:t.content}),d.jsx("span",{style:{display:(y=t.content)!=null&&y.length?"none":"inline"},className:"cosmic-ai-input-datePickerPlaceholder",contentEditable:!1,children:t.placeholder})]},t.id))}),setTimeout(()=>{ge(!0)},0),s},[l]);o.useEffect(()=>{Y&&setTimeout(()=>{F(b.current)},0)},[Y]),o.useEffect(()=>{l!==v?(he(ye()),z(l),oe(!0)):(l===""||!l)&&he(ye())},[l,v]),o.useEffect(()=>{if(!C&&!re)return;const n=new MutationObserver(()=>{b.current&&document.contains(b.current)&&(requestAnimationFrame(()=>{F(b.current),oe(!1)}),n.disconnect())});return b.current&&n.observe(document.body,{childList:!0,subtree:!0}),()=>n.disconnect()},[C,re]);const ve=()=>{b.current&&requestAnimationFrame(()=>{F(b.current)})};return o.useImperativeHandle(r,()=>({getCurrentValue:H,focus:ve})),d.jsxs("div",{className:xe(`cosmic-ai-input-rows${x}`),style:{textIndent:A+"px"},children:[Y&&d.jsx("div",{"data-set-type":"container","data-cosmic-ai-input-placeholder":S,className:xe("cosmic-ai-input",`cosmic-ai-input-rows${x}`,{"is-disabled":T},{"is-empty":v.length===0}),ref:b,contentEditable:!0,suppressContentEditableWarning:!0,onClick:n=>Te(n),onFocus:n=>{Fe(n)},onBlur:n=>{E==null||E(n)},onMouseDown:n=>ke(),onKeyDown:n=>$e(n),onKeyUp:n=>je(n),onInput:n=>fe(),onCopy:n=>Le(n),children:_e}),K&&Ke.createPortal((D==null?void 0:D.type)==="multiple-select"?d.jsx(Ce,{ref:$,options:te,value:G,position:X,height:le,onChange:Q},"multiple-select"):(D==null?void 0:D.type)==="date-picker"?d.jsx(we,{ref:$,value:G,position:X,onChange:Q},"date-picker"):d.jsx(me,{ref:$,options:te,value:G,position:X,height:le,onChange:Q},"select"),document.body)]})});Re.displayName="AiInput";exports.default=Re;
|
|
1
|
+
// Generated at: 2026-03-10T07:58:48.707Z
|
|
2
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),c=require("react"),Re=require("classnames"),tt=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 Te=c.forwardRef(({value:r,position:o,id:l,onChange:p},k)=>{const[C,E]=c.useState(!0),$=c.useRef(null),N=c.useRef(null);c.useEffect(()=>{typeof k=="function"?k($.current):k&&(k.current=$.current)},[k]);const L=h=>{const x=h.target.value;p==null||p(x,g.DATE_PICKER)};c.useEffect(()=>{if(N.current)try{setTimeout(()=>{D()},100)}catch{}},[]);const D=()=>{if(N.current)try{N.current.showPicker()}catch{}},A=h=>{h.stopPropagation()};return C?u.jsx("div",{ref:$,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:N,type:"date",value:r||"",onChange:L,onClick:A})}):null});Te.displayName="DatePicker";function oe(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 H(r){if(r&&r.getAttribute("data-set-type")==="input"){const o=r.children[0];o.setAttribute("contenteditable","true"),requestAnimationFrame(()=>{o.focus()})}}function me(r){r&&r.getAttribute("data-set-type")==="input"&&r.children[0].setAttribute("contenteditable","false")}function O(r){return r&&(r!=null&&r.getAttribute)?r.getAttribute("data-set-type")==="input":!1}const De=c.forwardRef(({options:r,value:o,position:l,id:p,height:k=37,onChange:C},E)=>{const[$,N]=c.useState(o||""),L=c.useRef(null);c.useEffect(()=>{typeof E=="function"?E(L.current):E&&(E.current=L.current)},[E]);const D=h=>{const x=$.split(",").filter(y=>y)||[];let b="";x.includes(h)?b=x.filter(y=>y!==h).join(","):x.length?b=`${x.join(",")},${h}`:b=h,N(b),C==null||C(b,g.MULTIPLE_SELECT)},A=$.split(",")||[];return u.jsx("div",{ref:L,className:"cosmic-ai-input-selectFloatElement",id:p,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((h,x)=>u.jsx("div",{className:`selectOption ${A.includes(h)?"selected":""}`,onClick:()=>D(h),children:h},x))})});De.displayName="MultipleSelect";const Ne=c.forwardRef(({options:r,value:o,position:l,id:p,height:k=120,onChange:C},E)=>{const[$,N]=c.useState(o||""),L=c.useRef(null);c.useEffect(()=>{typeof E=="function"?E(L.current):E&&(E.current=L.current)},[E]);const D=A=>{N(A),C==null||C(A,g.SELECT)};return u.jsx("div",{ref:L,className:"cosmic-ai-input-selectFloatElement",id:p,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((A,h)=>u.jsx("div",{className:`selectOption ${$===A?"selected":""}`,onClick:()=>D(A),children:A},h))})});Ne.displayName="Select";function Le(r){const o=r instanceof Element?r:document.getElementById(r);return o&&o.children[0].textContent||""}function nt(r,o){const l=r instanceof Element?r:document.getElementById(r);l&&(l.children[0].textContent=o)}function Q(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 ae(r){const o=window.getSelection();if(!o||o.rangeCount===0)return 0;if(!r||!(r instanceof Node))return;const l=o.getRangeAt(0),p=l.cloneRange();return p.selectNodeContents(r),p.setEnd(l.startContainer,l.startOffset),p.toString().length}function st(){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 rt(){const r=window.getSelection();return!r||r.rangeCount===0?null:r.getRangeAt(0).getBoundingClientRect()}function it(){return new Promise(r=>{requestAnimationFrame(()=>{r(rt())})})}function lt(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const o=r.getRangeAt(0),l=o.startContainer,p=o.startOffset;return l.nodeType===Node.TEXT_NODE?p>0?l:l.previousSibling:l.nodeType===Node.ELEMENT_NODE?p>0?l.childNodes[p-1]:l.previousSibling:null}function ct(){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const o=r.getRangeAt(0),l=o.startContainer,p=o.startOffset;return l.nodeType===Node.TEXT_NODE?p<l.length?l:l.nextSibling:l.nodeType===Node.ELEMENT_NODE?p<l.childNodes.length?l.childNodes[p]:l.nextSibling:null}function ot(r){return r&&!r.getAttribute("data-set-type")}function Se(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}const ke=c.forwardRef(({options:r,value:o,position:l,id:p,height:k=120,onChange:C},E)=>{const[$,N]=c.useState(o||""),[L,D]=c.useState(0),A=c.useRef(null),h=c.useRef(L),x=c.useCallback(b=>{N(b),C==null||C(b,g.LABEL)},[C]);return c.useEffect(()=>{typeof E=="function"?E(A.current):E&&(E.current=A.current)},[E]),c.useEffect(()=>{h.current=L},[L]),c.useEffect(()=>{D(0)},[r]),c.useEffect(()=>{const b=y=>{r.length!==0&&(y.key==="ArrowDown"?(y.preventDefault(),D(R=>R<r.length-1?R+1:R)):y.key==="ArrowUp"?(y.preventDefault(),D(R=>R>0?R-1:R)):y.key==="Enter"&&(y.preventDefault(),setTimeout(()=>{const R=h.current;R>=0&&r[R]&&x(r[R])},0)))};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[r,x]),u.jsx("div",{ref:A,className:"cosmic-ai-input-selectFloatElement",id:p,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((b,y)=>u.jsx("div",{className:`selectOption ${$===b?"selected":""} ${L===y?"highlighted":""}`,onClick:()=>x(b),onMouseEnter:()=>D(y),children:b},y))})});ke.displayName="Mention";const Pe=c.forwardRef((r,o)=>{const{value:l="",varList:p,placeholder:k="",maxLength:C,defaultRows:E=3,disabled:$=!1,defaultFocus:N=!1,textIndex:L=0,mentions:D=[],onFocus:A,onBlur:h,onChange:x,onClick:b,onSend:y,onKeyDown:R,onKeyUp:q,onMaxLengthExceeded:Z}=r,[at,dt]=c.useState(l||""),[I,Y]=c.useState(""),[ut,de]=c.useState(""),[_,B]=c.useState(!1),[U,v]=c.useState({top:0,left:0}),[ee,te]=c.useState([]),[W,ue]=c.useState(""),[w,ne]=c.useState(null),[se,z]=c.useState(120),[fe,pe]=c.useState(N),he=240,ge=240,Ee=240,ye=276,m=c.useRef(null),S=c.useRef(null),j=c.useRef(null),re=c.useRef(!1),V=()=>{var s,e;let n=((e=(s=m.current)==null?void 0:s.innerText)==null?void 0:e.replace(/\u200B/g,""))||"";return n===`
|
|
3
|
+
`&&(n=""),n},xe=()=>{var s;let n=((s=m.current)==null?void 0:s.innerHTML)||"";return n==="<br>"&&(n=""),n},$e=n=>{const s=[];let e=0;const i=/\[([^\]]+)\]/g;let a;const d=Se();let f=0;if(n===""||!n||n===`
|
|
4
|
+
`)return[{type:"text",content:"",id:`text-${f++}-${d}`}];const P=new Set((p||[]).map(T=>T.name));for(;(a=i.exec(n))!==null;){if(a.index>e){const M=n.substring(e,a.index).split(`
|
|
5
|
+
`);M.forEach((J,et)=>{J&&s.push({type:"text",content:J,id:`text-${f++}-${d}`}),et<M.length-1&&s.push({type:"newline",id:`newline-${f++}-${d}`})})}const T=a[1];if(P.has(T)){const t=p.find(M=>M.name===T);(t==null?void 0:t.type)==="input"?s.push({type:"input",name:t==null?void 0:t.name,content:(t==null?void 0:t.content)||"",placeholder:(t==null?void 0:t.placeholder)||T,id:`input-${f++}-${d}`}):(t==null?void 0:t.type)==="label"?s.push({type:"label",name:t==null?void 0:t.name,content:(t==null?void 0:t.content)||"",id:`label-${f++}-${d}`}):(t==null?void 0:t.type)==="select"?s.push({type:"select",name:t==null?void 0:t.name,content:(t==null?void 0:t.content)||"",placeholder:(t==null?void 0:t.placeholder)||T,options:(t==null?void 0:t.options)||[],id:`select-${f++}-${d}`}):(t==null?void 0:t.type)==="multiple-select"?s.push({type:"multiple-select",name:t==null?void 0:t.name,content:(t==null?void 0:t.content)||"",placeholder:(t==null?void 0:t.placeholder)||T,options:(t==null?void 0:t.options)||[],id:`multiple-select-${f++}-${d}`}):(t==null?void 0:t.type)==="date-picker"&&s.push({type:"date-picker",name:t==null?void 0:t.name,content:(t==null?void 0:t.content)||"",placeholder:(t==null?void 0:t.placeholder)||T,id:`date-picker-${f++}-${d}`})}else s.push({type:"text",content:`[${T}]`,id:`text-${f++}-${d}`});e=i.lastIndex}if(e<n.length){const t=n.substring(e).split(`
|
|
6
|
+
`);t.forEach((M,J)=>{M&&s.push({type:"text",content:M,id:`text-${f++}`}),J<t.length-1&&s.push({type:"newline",id:`newline-${f++}`})})}return s},ie=()=>{var n;(n=m.current)==null||n.setAttribute("contenteditable","true"),S.current&&(O(S.current)&&S.current.children[0].setAttribute("contenteditable","false"),S.current=null),F(m.current)},je=n=>{b==null||b(n)},Me=n=>{ie()},K=n=>{Y(V()),de(xe()),x==null||x(V()),Qe(n)},Be=n=>{var s;if(!re.current&&n.code==="Enter"&&!n.shiftKey){n.preventDefault();const e=V();if(e.length===0||(s=m.current)!=null&&s.innerHTML.match(/^<span>[\s\u200B]*(<br\s*\/?>[\s\u200B]*)+<\/span>$/))return;C?e.length<=C?y==null||y(e):Z==null||Z(e,C):y==null||y(e)}},He=n=>{var e;if(_&&(w==null?void 0:w.type)===g.LABEL&&(n.code==="ArrowUp"||n.code==="ArrowDown"||n.code==="Enter")){n.preventDefault();return}B(!1),R==null||R(n);const s=st();if(s&&ot(s)){if(n.code==="ArrowLeft"){const i=s==null?void 0:s.previousElementSibling,a=ae(s);i&&a===0&&O(i)&&i.children[0]&&(S.current=i,H(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(n.code==="ArrowRight"){const i=s==null?void 0:s.nextElementSibling,a=ae(s);i&&a===((e=s.textContent)==null?void 0:e.length)&&O(i)&&i.children[0]&&(S.current=i,H(i),requestAnimationFrame(()=>{Q(i.children[0])}))}n.code==="Backspace"&&(s.innerHTML===""&&n.preventDefault(),s.innerHTML==="<br>"&&(n.preventDefault(),s.innerHTML=""))}if(s&&s.getAttribute("data-set-type")==="container"){if(n.code==="ArrowLeft"){const i=lt();O(i)&&i.children[0]&&(S.current=i,H(i),requestAnimationFrame(()=>{F(i.children[0])}))}if(n.code==="ArrowRight"){const i=ct();O(i)&&i.children[0]&&(S.current=i,H(i),requestAnimationFrame(()=>{Q(i.children[0])}))}}Be(n)},Fe=n=>{if(_&&(w==null?void 0:w.type)===g.LABEL&&(n.code==="ArrowUp"||n.code==="ArrowDown"||n.code==="Enter")){n.preventDefault();return}q==null||q(n)},Oe=n=>{n.preventDefault();const e=window.getSelection().toString();if(!e)return;const i=e,a=e;n.clipboardData.setData("text/plain",i),n.clipboardData.setData("text/html",a)},qe=n=>{A==null||A(n)},Ve=()=>{re.current=!0},_e=()=>{re.current=!1},ve=(n,s)=>{s.stopPropagation()},Ke=(n,s)=>{var i;s.stopPropagation(),S.current&&me(S.current),(i=m.current)==null||i.setAttribute("contenteditable","false");const e=document.getElementById(n.id);S.current=e,requestAnimationFrame(()=>{H(e)})},Ue=(n,s)=>{var a,d,f,P,T;R==null||R(s),s.stopPropagation();const e=s.target,i=ae(e);if(s.code==="Backspace"&&i===0){const t=(a=e.parentElement)==null?void 0:a.previousElementSibling;t&&(O(t)&&t.children[0]&&((d=t.children[0].textContent)!=null&&d.length)?(S.current=t,H(t),F(t.children[0]),requestAnimationFrame(()=>{oe(t.children[0])})):(ie(),F(t)))}if(s.code==="ArrowRight"&&i===((f=e.textContent)==null?void 0:f.length)){const t=(P=e.parentElement)==null?void 0:P.nextElementSibling;t&&(O(t)&&t.children[0]&&((T=t.children[0].textContent)!=null&&T.length)?(S.current=t,H(t),Q(t.children[0]),requestAnimationFrame(()=>{oe(t.children[0])})):(ie(),Q(t)))}s.code==="Enter"&&s.shiftKey&&s.preventDefault()},We=(n,s)=>{q==null||q(s);const e=s.target;oe(e)},ze=(n,s)=>{var i;s.stopPropagation(),S.current&&me(S.current),(i=m.current)==null||i.setAttribute("contenteditable","false");const e=document.getElementById(n.id);S.current=e,requestAnimationFrame(()=>{H(e)})},Xe=(n,s)=>{Y(V()),de(xe()),x==null||x(V())},Ge=(n,s)=>{};c.useEffect(()=>{if(!_)return;const n=i=>{j.current&&!j.current.contains(i.target)&&B(!1)},s=i=>{j.current&&!j.current.contains(i.target)&&B(!1)},e=()=>{B(!1)};return document.addEventListener("mousedown",n),document.addEventListener("scroll",s,!0),window.addEventListener("resize",e),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("scroll",s,!0),window.removeEventListener("resize",e)}},[_]);const X=(n,s)=>{if(w&&s!==g.LABEL&&nt(w.id,n),s===g.SELECT&&(B(!1),K({})),s===g.LABEL&&(ce(),B(!1),requestAnimationFrame(()=>{const e=window.getSelection();e&&G.current&&(e.removeAllRanges(),e.addRange(G.current),setTimeout(()=>{var f;const i=document.createElement("span");i.contentEditable="false",i.setAttribute("data-set-type","label"),i.id=w.id;const a=document.createElement("span");a.contentEditable="false",a.textContent=n,i.appendChild(a);const d=(f=m.current)==null?void 0:f.children;if((d==null?void 0:d.length)===1&&d[0].tagName==="SPAN"&&d[0].innerHTML==="[")m.current.innerHTML="",m.current.appendChild(i),setTimeout(()=>{K({}),ce()},0);else{document.execCommand("delete",!1,void 0);const P=G.current;P.insertNode(i),P.setStartAfter(i),P.setEndAfter(i),e.removeAllRanges(),e.addRange(P),setTimeout(()=>{K({})},0)}},0))})),s===g.MULTIPLE_SELECT||s===g.DATE_PICKER){const e=document.getElementById(w.id);e&&e.children[0]&&e.children[1]&&(n.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({})}},G=c.useRef(null),Je=(D==null?void 0:D.map(n=>n.prefix))||[],Qe=n=>{const s=n==null?void 0:n.nativeEvent,e=s==null?void 0:s.data;Je.includes(e)&&it().then(i=>{var d;const a=window.getSelection();a&&a.rangeCount>0&&(G.current=a.getRangeAt(0)),Ze({options:((d=D.find(f=>f.prefix===e))==null?void 0:d.options)||[],value:"",type:g.LABEL,id:"label-"+Se()},i)})},Ze=(n,s)=>{te(n.options),v({top:-999999,left:-999999999}),ne(n),z(ge),B(!0),requestAnimationFrame(()=>{if(j.current){const e=j.current.getBoundingClientRect();let i=s.left,a=s.top+s.height;window.innerWidth-s.right<he&&s.width<e.width&&(i=s.right-e.width),s.top<e.height&&(a=s.top+s.height),v({top:a,left:i}),z(e.height)}})},be=(n,s)=>{const i=s.target.getBoundingClientRect();te(n.options),ue(n.value||Le(n.id)),v({top:-999999,left:-999999999}),ne(n),z(ge),B(!0),requestAnimationFrame(()=>{if(j.current){const a=j.current.getBoundingClientRect();let d=i.left,f=i.top+i.height;window.innerWidth-i.right<he&&i.width<a.width&&(d=i.right-a.width),i.top<a.height&&(f=i.top+i.height),v({top:f,left:d}),z(a.height)}})},Ie=(n,s)=>{const i=s.target.getBoundingClientRect();let a=i.left,d=i.top-ye;window.innerWidth-i.right<Ee&&(a=a-Ee+i.width),i.top<ye&&(d=i.top+i.height),te(n.options),ue(n.value||Le(n.id)),v({top:d,left:a}),ne(n),B(!0)},[Ye,we]=c.useState([]),[le,Ce]=c.useState(!0),Ae=c.useCallback(()=>{Ce(!1);const n=$e(l),s=[];return n.forEach(e=>{var i,a,d,f,P,T;if(e.type==="text")s.push(u.jsx("span",{onKeyDown:t=>Ge(),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:t=>Xe(),onClick:t=>ve(e,t),onMouseDown:t=>Ke(e,t),"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:t=>Ue(e,t),onKeyUp:t=>We(e,t),children:e.content}),u.jsx("span",{contentEditable:!1,style:{display:(a=e.content)!=null&&a.length?"none":"inline"},className:"cosmic-ai-input-placeholder",onMouseDown:t=>ze(e,t),children:e.placeholder})]},e.id));else if(e.type===g.SELECT){const t=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:M=>be(e,M),"data-cosmic-ai-input-placeholder":e.placeholder,children:u.jsx("span",{contentEditable:!1,children:t})},e.id))}else if(e.type===g.MULTIPLE_SELECT){const t=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:M=>be(e,M),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{style:{display:t!=null&&t.length?"inline":"none"},contentEditable:!1,children:t}),u.jsx("span",{style:{display:t!=null&&t.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:t=>Ie(e,t),"data-cosmic-ai-input-placeholder":e.placeholder,children:[u.jsx("span",{style:{display:(P=e.content)!=null&&P.length?"inline":"none"},contentEditable:!1,children:e.content}),u.jsx("span",{style:{display:(T=e.content)!=null&&T.length?"none":"inline"},className:"cosmic-ai-input-datePickerPlaceholder",contentEditable:!1,children:e.placeholder})]},e.id))}),setTimeout(()=>{Ce(!0)},0),s},[l]);c.useEffect(()=>{le&&setTimeout(()=>{F(m.current)},0)},[le]),c.useEffect(()=>{l!==I?(we(Ae()),Y(l),pe(!0)):(l===""||!l)&&we(Ae())},[l,I]),c.useEffect(()=>{if(!N&&!fe)return;const n=new MutationObserver(()=>{m.current&&document.contains(m.current)&&(requestAnimationFrame(()=>{F(m.current),pe(!1)}),n.disconnect())});return m.current&&n.observe(document.body,{childList:!0,subtree:!0}),()=>n.disconnect()},[N,fe]);const ce=()=>{m.current&&requestAnimationFrame(()=>{F(m.current)})};return c.useImperativeHandle(o,()=>({getCurrentValue:V,focus:ce})),u.jsxs("div",{className:Re(`cosmic-ai-input-rows${E}`),style:{textIndent:L+"px"},children:[le&&u.jsx("div",{"data-set-type":"container","data-cosmic-ai-input-placeholder":k,className:Re("cosmic-ai-input",`cosmic-ai-input-rows${E}`,{"is-disabled":$},{"is-empty":I.length===0}),ref:m,contentEditable:!0,suppressContentEditableWarning:!0,onClick:n=>je(n),onFocus:n=>{qe(n)},onBlur:n=>{h==null||h(n)},onMouseDown:n=>Me(),onKeyDown:n=>He(n),onKeyUp:n=>Fe(n),onInput:n=>K(n),onCopy:n=>Oe(n),onCompositionStart:Ve,onCompositionEnd:_e,children:Ye}),_&&tt.createPortal((w==null?void 0:w.type)===g.MULTIPLE_SELECT?u.jsx(De,{ref:j,options:ee,value:W,position:U,height:se,onChange:X},g.MULTIPLE_SELECT):(w==null?void 0:w.type)===g.DATE_PICKER?u.jsx(Te,{ref:j,value:W,position:U,onChange:X},g.DATE_PICKER):(w==null?void 0:w.type)===g.LABEL?u.jsx(ke,{ref:j,options:ee,value:W,position:U,height:se,onChange:X},g.LABEL):u.jsx(Ne,{ref:j,options:ee,value:W,position:U,height:se,onChange:X},g.SELECT),document.body)]})});Pe.displayName="AiInput";exports.default=Pe;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,14 +5,14 @@ export default AiInput;
|
|
|
5
5
|
|
|
6
6
|
declare interface AiInputProps {
|
|
7
7
|
value?: string;
|
|
8
|
-
varList: (InputItem | SelectItem | MultipleSelectItem | DatePickerItem)[];
|
|
8
|
+
varList: (InputItem | SelectItem | MultipleSelectItem | DatePickerItem | LabelItem)[];
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
maxLength?: number;
|
|
11
11
|
defaultRows?: number;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
defaultFocus?: boolean;
|
|
14
14
|
textIndex?: number;
|
|
15
|
-
|
|
15
|
+
mentions?: MentionItem[];
|
|
16
16
|
onSend?: (value: string) => void;
|
|
17
17
|
onMaxLengthExceeded?: (value: string, maxLength: number) => void;
|
|
18
18
|
onFocus?: (e: default_2.FocusEvent) => void;
|
|
@@ -29,25 +29,45 @@ export declare interface AiInputRef {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
declare interface DatePickerItem {
|
|
32
|
-
type:
|
|
32
|
+
type: ITEM_TYPE.DATE_PICKER;
|
|
33
33
|
name: string;
|
|
34
34
|
content: string;
|
|
35
35
|
placeholder: string;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
declare interface InputItem {
|
|
39
|
-
type:
|
|
39
|
+
type: ITEM_TYPE.INPUT;
|
|
40
40
|
name: string;
|
|
41
41
|
content: string;
|
|
42
42
|
placeholder: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
declare enum ITEM_TYPE {
|
|
46
|
+
INPUT = "input",
|
|
47
|
+
SELECT = "select",
|
|
48
|
+
MULTIPLE_SELECT = "multiple-select",
|
|
49
|
+
DATE_PICKER = "date-picker",
|
|
50
|
+
LABEL = "label"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare interface LabelItem {
|
|
54
|
+
type: ITEM_TYPE.LABEL;
|
|
55
|
+
name: string;
|
|
56
|
+
content: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare interface MentionItem {
|
|
60
|
+
prefix: string;
|
|
61
|
+
title?: string;
|
|
62
|
+
options: string[];
|
|
63
|
+
}
|
|
64
|
+
|
|
45
65
|
declare interface MultipleSelectItem extends Omit<SelectItem, "type"> {
|
|
46
|
-
type:
|
|
66
|
+
type: ITEM_TYPE.MULTIPLE_SELECT;
|
|
47
67
|
}
|
|
48
68
|
|
|
49
69
|
declare interface SelectItem {
|
|
50
|
-
type:
|
|
70
|
+
type: ITEM_TYPE.SELECT;
|
|
51
71
|
name: string;
|
|
52
72
|
content: string;
|
|
53
73
|
placeholder: string;
|