@alifd/chat 0.3.32 → 0.3.33-beta.1

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.
@@ -95,3 +95,7 @@ $color-data1-10: var(--color-data1-10, #6f9200) !default; // ?
95
95
 
96
96
  $color-bg-1: var(--color-bg-1, #ffffff) !default; // ?
97
97
 
98
+
99
+ $color-error-3: var(--color-error-3, rgb(255, 82, 25)) !default;
100
+
101
+ $color-success-3: var(--color-success-3, #00b042) !default;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @component 输入框
3
+ * @en Input
4
+ * @type 通用 - General
5
+ * @remarks 同 Next Input,按钮用于开始一个即时操作。- Same as Next.Input, Input used to trigger an action.
6
+ * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Inputs are used for emphasizing important functions on your page.
7
+ * @others
8
+ * ## 无障碍键盘操作指南
9
+ * | 按键 | 说明 |
10
+ * | :---- | :---------- |
11
+ * | Enter | 触发 onClick 事件 |
12
+ * | SPACE | 触发 onClick 事件 |
13
+ * @othersEn
14
+ * ## ARIA and KeyBoard
15
+ * | KeyBoard | Description |
16
+ * | :---------- | :------------------------------ |
17
+ * | Enter | Trigger the onClick event |
18
+ * | SPACE | Trigger the onClick event |
19
+ */
20
+ import React from 'react';
21
+ export * from './types';
22
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<Pick<any, string | number | symbol> & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/input").InputProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>> & Pick<import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>, "focus" | "getInputNode">>, string | number | symbol> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<import("@alifd/next/types/input").InputProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>> & Pick<import("@alifd/next/types/input/input").default<import("@alifd/next/types/input").InputProps>, "focus" | "getInputNode">, {}>;
23
+ export default _default;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @component 输入框
3
+ * @en Input
4
+ * @type 通用 - General
5
+ * @remarks 同 Next Input,按钮用于开始一个即时操作。- Same as Next.Input, Input used to trigger an action.
6
+ * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Inputs are used for emphasizing important functions on your page.
7
+ * @others
8
+ * ## 无障碍键盘操作指南
9
+ * | 按键 | 说明 |
10
+ * | :---- | :---------- |
11
+ * | Enter | 触发 onClick 事件 |
12
+ * | SPACE | 触发 onClick 事件 |
13
+ * @othersEn
14
+ * ## ARIA and KeyBoard
15
+ * | KeyBoard | Description |
16
+ * | :---------- | :------------------------------ |
17
+ * | Enter | Trigger the onClick event |
18
+ * | SPACE | Trigger the onClick event |
19
+ */
20
+ import { __rest } from "tslib";
21
+ import React, { forwardRef } from 'react';
22
+ import { Input as NextInput, ConfigProvider } from '@alifd/next';
23
+ import cs from 'classnames';
24
+ import { PREFIX_DEFAULT, assignSubComponent } from '../utils';
25
+ const Input = forwardRef((_a, ref) => {
26
+ var { className, size = 'medium' } = _a, props = __rest(_a, ["className", "size"]);
27
+ return (React.createElement(NextInput, Object.assign({}, props, { className: cs(`${PREFIX_DEFAULT}input`, className), size: size, ref: ref })));
28
+ });
29
+ const InputWithSub = assignSubComponent(Input, {
30
+ displayName: 'Input',
31
+ });
32
+ export * from './types';
33
+ export default ConfigProvider.config(InputWithSub);
@@ -0,0 +1,5 @@
1
+ @import "../core/variables.scss";
2
+
3
+ .#{$prefix}input {
4
+
5
+ }
@@ -0,0 +1 @@
1
+ import '@alifd/next/lib/input/style2';
@@ -0,0 +1 @@
1
+ import '@alifd/next/lib/input/style2';
@@ -0,0 +1,518 @@
1
+ import type React from 'react';
2
+ import type { CommonProps } from '@alifd/next';
3
+ import type { Locale } from '@alifd/next';
4
+ interface InputCommonHTMLAttributes extends Omit<React.InputHTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange' | 'onKeyDown' | 'size' | 'maxLength' | 'value'> {
5
+ [key: `data-${string}`]: string;
6
+ }
7
+ interface CommonPropsWithoutLocale extends Omit<CommonProps, 'locale'> {
8
+ }
9
+ /**
10
+ * @api
11
+ */
12
+ export interface OnKeyDownOpts {
13
+ /**
14
+ * 输入的空格被清理
15
+ * @en Input space is cleared
16
+ */
17
+ beTrimed?: boolean;
18
+ /**
19
+ * 已超出最大长度
20
+ * @en Exceeded maximum length
21
+ */
22
+ overMaxLength?: boolean;
23
+ }
24
+ /**
25
+ * @api Input.TextArea
26
+ * @order 2
27
+ */
28
+ export interface TextAreaProps extends InputCommonHTMLAttributes, CommonPropsWithoutLocale {
29
+ /**
30
+ * 当前值(受控)
31
+ * @en Current value (controlled)
32
+ */
33
+ value?: string | number | null;
34
+ /**
35
+ * 默认值(非受控)
36
+ * @en Default value (uncontrolled)
37
+ */
38
+ defaultValue?: string | number | null;
39
+ /**
40
+ * 发生改变的时候触发的回调
41
+ * @en Callback when value changed
42
+ */
43
+ onChange?: (value: string, e: React.ChangeEvent<HTMLTextAreaElement>, type?: string) => void;
44
+ /**
45
+ * 键盘按下的时候触发的回调
46
+ * @en Callback when key down
47
+ */
48
+ onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>, opts: OnKeyDownOpts) => void;
49
+ /**
50
+ * 禁用状态
51
+ * @en Disabled of Input
52
+ * @defaultValue false
53
+ */
54
+ disabled?: boolean;
55
+ /**
56
+ * 最大长度
57
+ * @en Max length
58
+ */
59
+ maxLength?: number;
60
+ /**
61
+ * 是否展现最大长度样式
62
+ * @en Show limit hint
63
+ * @deprecated use hasLimitHint, will be removed in 2.x
64
+ * @defaultValue false
65
+ */
66
+ hasLimitHint?: boolean;
67
+ /**
68
+ * 是否展现最大长度样式
69
+ * @en Show limit hint
70
+ * @defaultValue false
71
+ */
72
+ showLimitHint?: boolean;
73
+ /**
74
+ * 当设置了 maxLength 时,是否截断超出的字符串
75
+ * @en Cut string when maxLength is exceeded
76
+ * @defaultValue true
77
+ */
78
+ cutString?: boolean;
79
+ /**
80
+ * 只读
81
+ * @en Read only
82
+ * @defaultValue false
83
+ */
84
+ readOnly?: boolean;
85
+ /**
86
+ * onChange 返回会自动去除头尾空字符
87
+ * @en onChange return will automatically remove head and tail empty characters
88
+ * @defaultValue false
89
+ */
90
+ trim?: boolean;
91
+ /**
92
+ * 输入提示
93
+ * @en Placeholder
94
+ */
95
+ placeholder?: string;
96
+ /**
97
+ * 获取焦点时候触发的回调
98
+ * @en Callback when focus
99
+ */
100
+ onFocus?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
101
+ /**
102
+ * 失去焦点时候触发的回调
103
+ * @en Callback when blur
104
+ */
105
+ onBlur?: (e: React.FocusEvent<HTMLTextAreaElement>) => void;
106
+ /**
107
+ * 自定义字符串计算长度方式
108
+ * @en Custom calculation method of string length
109
+ */
110
+ getValueLength?: (value: string) => number | void;
111
+ /**
112
+ * 自定义 class
113
+ * @en Custom className
114
+ */
115
+ className?: string;
116
+ /**
117
+ * 自定义内联样式
118
+ * @en Custom inline style
119
+ */
120
+ style?: React.CSSProperties;
121
+ /**
122
+ * 原生 type
123
+ * @en Native type
124
+ */
125
+ htmlType?: string;
126
+ /**
127
+ * name
128
+ * @en name
129
+ */
130
+ name?: string;
131
+ /**
132
+ * 状态
133
+ * @en State
134
+ */
135
+ state?: 'error' | 'warning' | 'loading';
136
+ /**
137
+ * 是否有边框
138
+ * @en Show border
139
+ * @defaultValue true
140
+ */
141
+ hasBorder?: boolean;
142
+ /**
143
+ * 根据内容自动改变高度
144
+ * @en Auto height
145
+ * @defaultValue false
146
+ */
147
+ autoHeight?: boolean | {
148
+ minRows?: number | string;
149
+ maxRows?: number | string;
150
+ };
151
+ /**
152
+ * 多行文本框高度
153
+ * @en Height of multi-line text box
154
+ * @defaultValue 4
155
+ */
156
+ rows?: number;
157
+ /**
158
+ * 是否为预览态
159
+ * @en Is preview
160
+ * @defaultValue false
161
+ */
162
+ isPreview?: boolean;
163
+ /**
164
+ * 自定义预览态内容
165
+ * @en Custom preview content
166
+ */
167
+ renderPreview?: (value: string | number | undefined | null, props: TextAreaProps) => React.ReactNode;
168
+ /**
169
+ * 开启后会过滤输入法中间字母状态,文字输入完成后才会触发 onChange
170
+ * @en Will filter the input method middle letter status, and only trigger onChange after the text input is completed
171
+ * @version 1.23
172
+ * @defaultValue false
173
+ */
174
+ composition?: boolean;
175
+ /**
176
+ * 是否出现 clear 按钮
177
+ * @en Show clear button
178
+ */
179
+ hasClear?: boolean;
180
+ /**
181
+ * 多语言文案
182
+ * @en Locale
183
+ * @skip
184
+ */
185
+ locale?: Locale['TextArea'];
186
+ /**
187
+ * 尺寸
188
+ * @en Size
189
+ * @defaultValue 'medium'
190
+ */
191
+ size?: 'small' | 'medium' | 'large';
192
+ }
193
+ /**
194
+ * @api Input.Group
195
+ * @order 3
196
+ */
197
+ export interface GroupProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
198
+ /**
199
+ * 输入框前附加内容
200
+ * @en Addon Content before input
201
+ */
202
+ addonBefore?: React.ReactNode;
203
+ /**
204
+ * 输入框前附加内容的类名
205
+ * @en Addon Content className before input
206
+ *
207
+ */
208
+ addonBeforeClassName?: string;
209
+ /**
210
+ * 输入框后附加内容
211
+ * @en Addon Content after input
212
+ */
213
+ addonAfter?: React.ReactNode;
214
+ /**
215
+ * 输入框后附加内容的类名
216
+ * @en Addon Content className after input
217
+ */
218
+ addonAfterClassName?: string;
219
+ /**
220
+ * rtl
221
+ * @en rtl
222
+ */
223
+ rtl?: boolean;
224
+ /**
225
+ * 禁用状态
226
+ * @en Disabled
227
+ */
228
+ disabled?: boolean;
229
+ }
230
+ /**
231
+ * @api Input
232
+ * @order 1
233
+ */
234
+ export interface InputProps extends InputCommonHTMLAttributes, CommonPropsWithoutLocale {
235
+ /**
236
+ * 当前值(受控)
237
+ * @en Current value (controlled)
238
+ */
239
+ value?: string | number | null;
240
+ /**
241
+ * 默认值(非受控)
242
+ * @en Default value (uncontrolled)
243
+ */
244
+ defaultValue?: string | number | null;
245
+ /**
246
+ * 发生改变的时候触发的回调
247
+ * @en Callback when value changed
248
+ */
249
+ onChange?: (value: string | number, e: React.ChangeEvent<HTMLInputElement> | React.CompositionEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>, reason?: string) => void;
250
+ /**
251
+ * 键盘按下的时候触发的回调
252
+ * @en Callback when key down
253
+ */
254
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>, opts: OnKeyDownOpts) => void;
255
+ /**
256
+ * 禁用状态
257
+ * @en Disabled of Input
258
+ * @defaultValue false
259
+ */
260
+ disabled?: boolean;
261
+ /**
262
+ * 最大长度
263
+ * @en Max length
264
+ */
265
+ maxLength?: number;
266
+ /**
267
+ * 是否展现最大长度样式
268
+ * @en Show limit hint
269
+ * @deprecated use hasLimitHint, will be removed in 2.x
270
+ * @defaultValue false
271
+ */
272
+ hasLimitHint?: boolean;
273
+ /**
274
+ * 是否展现最大长度样式
275
+ * @en Show limit hint
276
+ * @defaultValue false
277
+ */
278
+ showLimitHint?: boolean;
279
+ /**
280
+ * 当设置了 maxLength 时,是否截断超出的字符串
281
+ * @en Cut string when maxLength is exceeded
282
+ * @defaultValue true
283
+ */
284
+ cutString?: boolean;
285
+ /**
286
+ * 只读
287
+ * @en Read only
288
+ * @defaultValue false
289
+ */
290
+ readOnly?: boolean;
291
+ /**
292
+ * onChange 返回会自动去除头尾空字符
293
+ * @en onChange return will automatically remove head and tail empty characters
294
+ * @defaultValue false
295
+ */
296
+ trim?: boolean;
297
+ /**
298
+ * 输入提示
299
+ * @en Placeholder
300
+ */
301
+ placeholder?: string;
302
+ /**
303
+ * 获取焦点时候触发的回调
304
+ * @en Callback when focus
305
+ */
306
+ onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
307
+ /**
308
+ * 失去焦点时候触发的回调
309
+ * @en Callback when blur
310
+ */
311
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
312
+ /**
313
+ * 自定义字符串计算长度方式
314
+ * @en Custom calculation method of string length
315
+ */
316
+ getValueLength?: (value: string) => number | void;
317
+ /**
318
+ * 自定义 class
319
+ * @en Custom className
320
+ */
321
+ className?: string;
322
+ /**
323
+ * 自定义内联样式
324
+ * @en Custom inline style
325
+ */
326
+ style?: React.CSSProperties;
327
+ /**
328
+ * 原生 type
329
+ * @en Native type
330
+ */
331
+ htmlType?: string;
332
+ /**
333
+ * name
334
+ * @en name
335
+ */
336
+ name?: string;
337
+ /**
338
+ * 状态
339
+ * @en State
340
+ */
341
+ state?: 'error' | 'loading' | 'success' | 'warning';
342
+ /**
343
+ * label
344
+ * @en label
345
+ */
346
+ label?: React.ReactNode;
347
+ /**
348
+ * 是否出现 clear 按钮
349
+ * @en Show clear button
350
+ */
351
+ hasClear?: boolean;
352
+ /**
353
+ * 是否有边框
354
+ * @en Show border
355
+ * @defaultValue true
356
+ */
357
+ hasBorder?: boolean;
358
+ /**
359
+ * 尺寸
360
+ * @en Size
361
+ * @defaultValue 'medium'
362
+ */
363
+ size?: 'small' | 'medium' | 'large';
364
+ /**
365
+ * 按下回车的回调
366
+ * @en Callback when press enter
367
+ */
368
+ onPressEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
369
+ /**
370
+ * 水印 (Icon 的 type 类型,和清除按钮占用同一个地方)
371
+ * @en Hint (Icon type, occupy the same place as clear button)
372
+ */
373
+ hint?: string | React.ReactNode;
374
+ /**
375
+ * 文字前附加内容
376
+ * @en Content before text
377
+ */
378
+ innerBefore?: React.ReactNode;
379
+ /**
380
+ * 文字后附加内容
381
+ * @en Content after text
382
+ */
383
+ innerAfter?: React.ReactNode;
384
+ /**
385
+ * 输入框前附加内容
386
+ * @en Addon Content before input
387
+ */
388
+ addonBefore?: React.ReactNode;
389
+ /**
390
+ * 输入框后附加内容
391
+ * @en Addon Content after input
392
+ */
393
+ addonAfter?: React.ReactNode;
394
+ /**
395
+ * 输入框前附加文字
396
+ * @en Addon Text before input
397
+ */
398
+ addonTextBefore?: React.ReactNode;
399
+ /**
400
+ * 输入框后附加文字
401
+ * @en Addon Text after input
402
+ */
403
+ addonTextAfter?: React.ReactNode;
404
+ /**
405
+ * 自动补全 (原生 input 支持)
406
+ * @en Auto complete
407
+ * @defaultValue 'off'
408
+ */
409
+ autoComplete?: string;
410
+ /**
411
+ * 自动聚焦 (原生 input 支持)
412
+ * @en Auto focus
413
+ */
414
+ autoFocus?: boolean;
415
+ /**
416
+ * 是否为预览态
417
+ * @en Is preview
418
+ * @defaultValue false
419
+ */
420
+ isPreview?: boolean;
421
+ /**
422
+ * 自定义预览态内容
423
+ * @en Custom preview content
424
+ */
425
+ renderPreview?: (value: string | number | undefined | null, props: InputProps) => React.ReactNode;
426
+ /**
427
+ * 开启后会过滤输入法中间字母状态,文字输入完成后才会触发 onChange
428
+ * @en Will filter the input method middle letter status, and only trigger onChange after the text input is completed
429
+ * @version 1.23
430
+ * @defaultValue false
431
+ */
432
+ composition?: boolean;
433
+ /**
434
+ * hover 展示 clear (配合 hasClear=true 使用)
435
+ * @en Hover to show clear
436
+ * @version 1.24
437
+ * @defaultValue false
438
+ */
439
+ hoverShowClear?: boolean;
440
+ /**
441
+ * 额外内容
442
+ * @en Extra content
443
+ */
444
+ extra?: React.ReactNode;
445
+ /**
446
+ * 原生 input 的 size 属性
447
+ * @en Native input size
448
+ */
449
+ htmlSize?: string;
450
+ /**
451
+ * 自定义 input 样式
452
+ * @en Custom input style
453
+ */
454
+ inputRender?: (input: React.ReactElement) => React.ReactNode;
455
+ /**
456
+ * 自定义 input 样式
457
+ * @en Custom input style
458
+ */
459
+ inputStyle?: React.CSSProperties;
460
+ /**
461
+ * 自定义 input 类名
462
+ * @en Custom input className
463
+ */
464
+ inputClassName?: string;
465
+ /**
466
+ * 多语言文案
467
+ * @en Locale
468
+ * @skip
469
+ */
470
+ locale?: Locale['Input'];
471
+ /**
472
+ * 文字前附加内容类名
473
+ * @en Content className before text
474
+ */
475
+ innerBeforeClassName?: string;
476
+ /**
477
+ * 文字后附加内容类名
478
+ * @en Content className after text
479
+ */
480
+ innerAfterClassName?: string;
481
+ }
482
+ /**
483
+ * @api Input.Password
484
+ * @remarks 继承 Input 的属性 - Inherit Input's properties
485
+ * @order 4
486
+ */
487
+ export interface PasswordProps extends InputProps {
488
+ /**
489
+ * 是否展示切换按钮
490
+ * @en Show toggle button
491
+ * @defaultValue true
492
+ */
493
+ showToggle?: boolean;
494
+ }
495
+ export type GeneralHTMLInputElement = HTMLInputElement | HTMLTextAreaElement;
496
+ export interface BaseProps extends Omit<InputProps, 'onChange' | 'onKeyDown' | 'onFocus' | 'state' | 'renderPreview'> {
497
+ onChange?: (value: string | number, e: React.ChangeEvent<GeneralHTMLInputElement> | React.CompositionEvent<GeneralHTMLInputElement> | React.KeyboardEvent<GeneralHTMLInputElement>, reason?: string) => void;
498
+ onKeyDown?: (e: React.KeyboardEvent<GeneralHTMLInputElement>, opts: {
499
+ beTrimed?: boolean;
500
+ overMaxLength?: boolean;
501
+ }) => void;
502
+ onFocus?: (e: React.FocusEvent<GeneralHTMLInputElement>) => void;
503
+ onBlur?: (e: React.FocusEvent<GeneralHTMLInputElement>) => void;
504
+ state?: string;
505
+ renderPreview?: (value: string | number | undefined, props: InputProps | TextAreaProps) => React.ReactNode;
506
+ }
507
+ export interface BaseState {
508
+ value?: Exclude<BaseProps['value'], undefined> | string;
509
+ composition?: boolean;
510
+ focus?: boolean;
511
+ hint?: string;
512
+ htmlType?: string;
513
+ height?: number;
514
+ overflowY?: 'hidden';
515
+ minHeight?: number;
516
+ maxHeight?: number;
517
+ }
518
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const isDingTalk: boolean;
2
+ export declare const isMobile: boolean;
@@ -0,0 +1,2 @@
1
+ export const isDingTalk = !!navigator.userAgent.match(/DingTalk/i);
2
+ export const isMobile = /HarmonyOS|ArkWeb|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator === null || navigator === void 0 ? void 0 : navigator.userAgent);