@fibrae/semi-ui-svelte 0.9.1 → 0.10.0

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.
Files changed (165) hide show
  1. package/README.md +8 -4
  2. package/README.zh-CN.md +8 -4
  3. package/dist/components/anchor/interface.d.ts +14 -0
  4. package/dist/components/audio-player/interface.d.ts +5 -0
  5. package/dist/components/auto-complete/interface.d.ts +29 -0
  6. package/dist/components/avatar/interface.d.ts +24 -0
  7. package/dist/components/backtop/interface.d.ts +2 -0
  8. package/dist/components/badge/interface.d.ts +7 -0
  9. package/dist/components/banner/interface.d.ts +7 -0
  10. package/dist/components/breadcrumb/interface.d.ts +10 -0
  11. package/dist/components/button/interface.d.ts +18 -0
  12. package/dist/components/calendar/interface.d.ts +16 -0
  13. package/dist/components/card/interface.d.ts +18 -0
  14. package/dist/components/carousel/interface.d.ts +16 -0
  15. package/dist/components/cascader/interface.d.ts +57 -0
  16. package/dist/components/checkbox/interface.d.ts +19 -0
  17. package/dist/components/code-highlight/interface.d.ts +3 -0
  18. package/dist/components/collapse/interface.d.ts +16 -0
  19. package/dist/components/collapsible/interface.d.ts +10 -0
  20. package/dist/components/color-picker/interface.d.ts +10 -0
  21. package/dist/components/config-provider/interface.d.ts +7 -0
  22. package/dist/components/cropper/interface.d.ts +11 -0
  23. package/dist/components/date-picker/interface.d.ts +47 -0
  24. package/dist/components/descriptions/interface.d.ts +6 -0
  25. package/dist/components/divider/interface.d.ts +4 -0
  26. package/dist/components/dropdown/interface.d.ts +8 -0
  27. package/dist/components/empty/interface.d.ts +7 -0
  28. package/dist/components/feedback/interface.d.ts +16 -0
  29. package/dist/components/float-button/interface.d.ts +14 -0
  30. package/dist/components/form/interface.d.ts +47 -0
  31. package/dist/components/grid/interface.d.ts +13 -0
  32. package/dist/components/highlight/interface.d.ts +7 -0
  33. package/dist/components/hot-keys/interface.d.ts +3 -0
  34. package/dist/components/image/interface.d.ts +59 -0
  35. package/dist/components/input/interface.d.ts +67 -0
  36. package/dist/components/input-number/interface.d.ts +24 -0
  37. package/dist/components/json-viewer/interface.d.ts +7 -0
  38. package/dist/components/layout/interface.d.ts +3 -0
  39. package/dist/components/list/interface.d.ts +18 -0
  40. package/dist/components/locale/interface.d.ts +4 -0
  41. package/dist/components/lottie/interface.d.ts +2 -0
  42. package/dist/components/markdown-render/interface.d.ts +5 -0
  43. package/dist/components/modal/interface.d.ts +29 -0
  44. package/dist/components/navigation/interface.d.ts +47 -0
  45. package/dist/components/overflow-list/interface.d.ts +11 -0
  46. package/dist/components/pagination/interface.d.ts +12 -0
  47. package/dist/components/pincode/interface.d.ts +8 -0
  48. package/dist/components/popconfirm/interface.d.ts +12 -0
  49. package/dist/components/popover/interface.d.ts +30 -0
  50. package/dist/components/progress/interface.d.ts +13 -0
  51. package/dist/components/radio/interface.d.ts +22 -0
  52. package/dist/components/rating/interface.d.ts +12 -0
  53. package/dist/components/resizable/interface.d.ts +30 -0
  54. package/dist/components/scroll-list/interface.d.ts +6 -0
  55. package/dist/components/select/interface.d.ts +63 -0
  56. package/dist/components/side-sheet/interface.d.ts +19 -0
  57. package/dist/components/skeleton/interface.d.ts +7 -0
  58. package/dist/components/slider/interface.d.ts +23 -0
  59. package/dist/components/space/interface.d.ts +4 -0
  60. package/dist/components/spin/interface.d.ts +7 -0
  61. package/dist/components/steps/interface.d.ts +9 -0
  62. package/dist/components/switch/interface.d.ts +7 -0
  63. package/dist/components/table/interface.d.ts +48 -0
  64. package/dist/components/tabs/interface.d.ts +29 -0
  65. package/dist/components/tag/interface.d.ts +22 -0
  66. package/dist/components/tag-input/interface.d.ts +29 -0
  67. package/dist/components/time-picker/interface.d.ts +31 -0
  68. package/dist/components/timeline/interface.d.ts +5 -0
  69. package/dist/components/tooltip/interface.d.ts +20 -0
  70. package/dist/components/transfer/interface.d.ts +18 -0
  71. package/dist/components/tree/interface.d.ts +45 -0
  72. package/dist/components/tree-select/interface.d.ts +55 -0
  73. package/dist/components/typography/interface.d.ts +33 -0
  74. package/dist/components/upload/interface.d.ts +64 -0
  75. package/dist/components/user-guide/interface.d.ts +15 -0
  76. package/dist/components/video-player/interface.d.ts +22 -0
  77. package/docs/advanced/dark-mode.md +288 -0
  78. package/docs/basic/button.md +605 -0
  79. package/docs/basic/divider.md +103 -0
  80. package/docs/basic/float-button.md +246 -0
  81. package/docs/basic/grid.md +427 -0
  82. package/docs/basic/layout.md +459 -0
  83. package/docs/basic/resizable.md +584 -0
  84. package/docs/basic/space.md +163 -0
  85. package/docs/basic/tokens.md +425 -0
  86. package/docs/basic/typography.md +615 -0
  87. package/docs/changes-from-semi.md +105 -0
  88. package/docs/ecosystem/tailwind.md +210 -0
  89. package/docs/experience/accessibility.md +82 -0
  90. package/docs/experience/content-guidelines.md +819 -0
  91. package/docs/experience/internationalization.md +7 -0
  92. package/docs/feedback/banner.md +198 -0
  93. package/docs/feedback/feedback.md +294 -0
  94. package/docs/feedback/notification.md +401 -0
  95. package/docs/feedback/popconfirm.md +243 -0
  96. package/docs/feedback/progress.md +389 -0
  97. package/docs/feedback/skeleton.md +388 -0
  98. package/docs/feedback/spin.md +172 -0
  99. package/docs/feedback/toast.md +393 -0
  100. package/docs/input/auto-complete.md +399 -0
  101. package/docs/input/cascader.md +1558 -0
  102. package/docs/input/checkbox.md +408 -0
  103. package/docs/input/color-picker.md +175 -0
  104. package/docs/input/date-picker.md +942 -0
  105. package/docs/input/form.md +2550 -0
  106. package/docs/input/input-number.md +451 -0
  107. package/docs/input/input.md +640 -0
  108. package/docs/input/pincode.md +191 -0
  109. package/docs/input/radio.md +337 -0
  110. package/docs/input/rating.md +214 -0
  111. package/docs/input/select.md +1230 -0
  112. package/docs/input/slider.md +347 -0
  113. package/docs/input/switch.md +206 -0
  114. package/docs/input/tag-input.md +465 -0
  115. package/docs/input/time-picker.md +358 -0
  116. package/docs/input/transfer.md +1061 -0
  117. package/docs/input/tree-select.md +1300 -0
  118. package/docs/input/upload.md +1811 -0
  119. package/docs/llms.txt +147 -0
  120. package/docs/navigation/anchor.md +377 -0
  121. package/docs/navigation/backtop.md +100 -0
  122. package/docs/navigation/breadcrumb.md +284 -0
  123. package/docs/navigation/navigation.md +851 -0
  124. package/docs/navigation/pagination.md +217 -0
  125. package/docs/navigation/steps.md +315 -0
  126. package/docs/navigation/tabs.md +754 -0
  127. package/docs/navigation/tree.md +1956 -0
  128. package/docs/other/config-provider.md +599 -0
  129. package/docs/other/locale.md +353 -0
  130. package/docs/plus/audio-player.md +155 -0
  131. package/docs/plus/code-highlight.md +150 -0
  132. package/docs/plus/drag-move.md +214 -0
  133. package/docs/plus/hot-keys.md +174 -0
  134. package/docs/plus/json-viewer.md +392 -0
  135. package/docs/plus/lottie.md +176 -0
  136. package/docs/plus/markdown-render.md +240 -0
  137. package/docs/plus/video-player.md +325 -0
  138. package/docs/show/avatar.md +475 -0
  139. package/docs/show/badge.md +276 -0
  140. package/docs/show/calendar.md +352 -0
  141. package/docs/show/card.md +485 -0
  142. package/docs/show/carousel.md +592 -0
  143. package/docs/show/collapse.md +289 -0
  144. package/docs/show/collapsible.md +216 -0
  145. package/docs/show/cropper.md +285 -0
  146. package/docs/show/descriptions.md +325 -0
  147. package/docs/show/dropdown.md +466 -0
  148. package/docs/show/empty.md +225 -0
  149. package/docs/show/highlight.md +144 -0
  150. package/docs/show/image.md +433 -0
  151. package/docs/show/list.md +927 -0
  152. package/docs/show/modal.md +517 -0
  153. package/docs/show/overflow-list.md +272 -0
  154. package/docs/show/popover.md +534 -0
  155. package/docs/show/scroll-list.md +156 -0
  156. package/docs/show/side-sheet.md +274 -0
  157. package/docs/show/table.md +5437 -0
  158. package/docs/show/tag.md +428 -0
  159. package/docs/show/timeline.md +277 -0
  160. package/docs/show/tooltip.md +442 -0
  161. package/docs/show/user-guide.md +419 -0
  162. package/docs/start/getting-started.md +234 -0
  163. package/docs/start/introduction.md +57 -0
  164. package/docs/start/overview.md +21 -0
  165. package/package.json +5 -4
@@ -0,0 +1,640 @@
1
+ # Input
2
+
3
+ > Input is a basic component for users to enter and edit text.
4
+
5
+ Package: `@fibrae/semi-ui-svelte`. Web page: https://semi-design-next.pages.dev/en-US/svelte/input/input/
6
+
7
+ ## Demos
8
+
9
+ ### How to import
10
+
11
+ ```svelte
12
+ <script lang="ts">
13
+ import { Input, TextArea, InputGroup } from '@fibrae/semi-ui-svelte';
14
+ </script>
15
+ ```
16
+
17
+ ### Basic Usage
18
+
19
+ ```svelte
20
+ <script lang="ts">
21
+ import { Input } from '@fibrae/semi-ui-svelte';
22
+ </script>
23
+
24
+ <Input aria-label="Basic input" value="hi" />
25
+ ```
26
+
27
+ ### Size
28
+
29
+ Support three sizes: `large`, `default`, and `small`.
30
+
31
+ ```svelte
32
+ <script lang="ts">
33
+ import { Input } from '@fibrae/semi-ui-svelte';
34
+ </script>
35
+
36
+ <Input placeholder="large" size="large" />
37
+ <br />
38
+ <br />
39
+ <Input placeholder="default" />
40
+ <br />
41
+ <br />
42
+ <Input placeholder="small" size="small" />
43
+ ```
44
+
45
+ ### Disabled
46
+
47
+ ```svelte
48
+ <script lang="ts">
49
+ import { Input } from '@fibrae/semi-ui-svelte';
50
+ </script>
51
+
52
+ <Input aria-label="可用的输入框" value="enabled input" />
53
+ <br />
54
+ <br />
55
+ <Input aria-label="禁用的输入框" disabled value="disabled input" />
56
+ ```
57
+
58
+ ### Prefix/Suffix
59
+
60
+ Add a prefix or suffix to the input with the `prefix` and `suffix` snippets; the content can be text, an icon, or any node.
61
+
62
+ When the snippet content is only text or a single Semi Icon, horizontal spacing is added automatically; for a custom node the spacing is 0.
63
+
64
+ ```svelte
65
+ <script lang="ts">
66
+ import { IconSearch } from '@fibrae/semi-icons-svelte';
67
+ import { Input, Typography } from '@fibrae/semi-ui-svelte';
68
+ </script>
69
+
70
+ <Input aria-label="Search" showClear>
71
+ {#snippet prefix()}
72
+ <IconSearch />
73
+ {/snippet}
74
+ </Input>
75
+ <br />
76
+ <br />
77
+ <Input aria-label="Input with text prefix" showClear>
78
+ {#snippet prefix()}Prefix{/snippet}
79
+ </Input>
80
+ <br />
81
+ <br />
82
+ <Input aria-label="Search" showClear>
83
+ {#snippet suffix()}
84
+ <IconSearch />
85
+ {/snippet}
86
+ </Input>
87
+ <br />
88
+ <br />
89
+ <Input aria-label="Input with text suffix" showClear>
90
+ {#snippet suffix()}
91
+ <Typography.Text strong style="margin-inline-end: 8px" type="secondary">Suffix</Typography.Text>
92
+ {/snippet}
93
+ </Input>
94
+ ```
95
+
96
+ ### Addon
97
+
98
+ Add an addon before or after the input with the `addonBefore` and `addonAfter` snippets.
99
+
100
+ When the snippet content is only text or a single Semi Icon, horizontal spacing is added automatically; for a custom node the spacing is 0.
101
+
102
+ ```svelte
103
+ <script lang="ts">
104
+ import { Input } from '@fibrae/semi-ui-svelte';
105
+ </script>
106
+
107
+ <Input aria-label="域名">
108
+ {#snippet addonBefore()}http://{/snippet}
109
+ {#snippet addonAfter()}.com{/snippet}
110
+ </Input>
111
+ ```
112
+
113
+ ### Clear Icon
114
+
115
+ Use `showClear` to allow clear current value when clicking on clear icon.
116
+
117
+ ```svelte
118
+ <script lang="ts">
119
+ import { Input } from '@fibrae/semi-ui-svelte';
120
+ </script>
121
+
122
+ <Input aria-label="Clearable input" showClear value="click to clear" />
123
+ ```
124
+
125
+ ### Password Mode
126
+
127
+ Hide the content of input
128
+
129
+ ```svelte
130
+ <script lang="ts">
131
+ import { Input } from '@fibrae/semi-ui-svelte';
132
+ </script>
133
+
134
+ <Input aria-label="Password" mode="password" value="123456" />
135
+ ```
136
+
137
+ ### Validation
138
+
139
+ You can set different `validateStatus` to provide style feedback to the user.
140
+
141
+ ```svelte
142
+ <script lang="ts">
143
+ import { Input } from '@fibrae/semi-ui-svelte';
144
+ </script>
145
+
146
+ <Input aria-label="警告状态" validateStatus="warning" value="ies" />
147
+ <br />
148
+ <br />
149
+ <Input aria-label="错误状态" validateStatus="error" value="ies" />
150
+ <br />
151
+ <br />
152
+ <Input aria-label="默认状态" value="ies" />
153
+ ```
154
+
155
+ ### Controlled Component
156
+
157
+ Bind the value with `bind:value`. A plain `value={x}` is only the initial content, which the component then maintains itself; to let the parent decide whether to accept a new value, use `bind:value={get, set}`: when `set` does not update the state, the input returns to the value of `get`.
158
+
159
+ ```svelte
160
+ <script lang="ts">
161
+ import { Input } from '@fibrae/semi-ui-svelte';
162
+
163
+ let value = $state('controlInput');
164
+
165
+ const onChange = (val: string) => {
166
+ console.log(val);
167
+ };
168
+ </script>
169
+
170
+ <Input aria-label="Controlled input" bind:value {onChange} />
171
+ ```
172
+
173
+ ### InputGroup
174
+
175
+ You could put multiple text field input into `<InputGroup>` and set `size`, `disabled` to the entire group. Supported fields include: `Input`, `InputNumber`, `Select`, `AutoComplete`、`TreeSelect`、`Cascader`、`DatePicker`
176
+
177
+ > **Notice**
178
+ >
179
+ > InputGroup does not recommend inserting non-supported elements. FormInputGroup will perform error aggregation on supported elements without customizing the elements for processing.
180
+
181
+ ```svelte
182
+ <script lang="ts">
183
+ import { AutoComplete, DatePicker, Input, InputGroup, InputNumber, Select } from '@fibrae/semi-ui-svelte';
184
+
185
+ const addressData = ['Beijing Haidian'];
186
+ const addressTypes = [
187
+ { value: 'home', label: 'Home' },
188
+ { value: 'work', label: 'Work' },
189
+ ];
190
+ const accountActions = [
191
+ { value: 'signup', label: 'Sign Up' },
192
+ { value: 'signin', label: 'Sign In' },
193
+ ];
194
+ </script>
195
+
196
+ <div>
197
+ <InputGroup>
198
+ <Input placeholder="Name" style="width: 100px" />
199
+ <InputNumber placeholder="Score" style="width: 140px" />
200
+ </InputGroup>
201
+ <br />
202
+ <br />
203
+ <br />
204
+ <InputGroup size="small">
205
+ <Select aria-label="Address type" optionList={addressTypes} style="width: 100px" value="home" />
206
+ <AutoComplete data={addressData} placeholder="Address: " style="width: 180px" />
207
+ </InputGroup>
208
+ <br />
209
+ <br />
210
+ <br />
211
+ <InputGroup size="small">
212
+ <Select aria-label="Account action" optionList={accountActions} style="width: 100px" value="signup" />
213
+ <Input placeholder="Email" style="width: 180px" />
214
+ </InputGroup>
215
+ <br />
216
+ <br />
217
+ <br />
218
+ <InputGroup size="small">
219
+ <Input placeholder="Name" style="width: 100px" />
220
+ <DatePicker placeholder="Birthday" />
221
+ </InputGroup>
222
+ </div>
223
+ ```
224
+
225
+ ```svelte
226
+ <script lang="ts">
227
+ import { Cascader, InputGroup, Select, TreeSelect } from '@fibrae/semi-ui-svelte';
228
+
229
+ const treeData = [
230
+ {
231
+ label: 'Asia',
232
+ value: 'Asia',
233
+ key: '0',
234
+ children: [
235
+ {
236
+ label: 'China',
237
+ value: 'China',
238
+ key: '0-0',
239
+ children: [
240
+ { label: 'Beijing', value: 'Beijing', key: '0-0-0' },
241
+ { label: 'Shanghai', value: 'Shanghai', key: '0-0-1' },
242
+ ],
243
+ },
244
+ ],
245
+ },
246
+ { label: 'North America', value: 'North America', key: '1' },
247
+ ];
248
+ const optionList = [
249
+ { value: 'from', label: 'From: ' },
250
+ { value: 'to', label: 'To: ' },
251
+ ];
252
+ </script>
253
+
254
+ <InputGroup>
255
+ <Select aria-label="From or to" {optionList} style="width: 100px" value="from" />
256
+ <TreeSelect placeholder="Please select" style="width: 220px" {treeData} />
257
+ </InputGroup>
258
+ <br />
259
+ <br />
260
+ <InputGroup>
261
+ <Select aria-label="From or to" {optionList} style="width: 100px" value="from" />
262
+ <Cascader placeholder="Please select" style="width: 220px" {treeData} />
263
+ </InputGroup>
264
+ ```
265
+
266
+ ### TextArea
267
+
268
+ Used for multi-line text. You can set `maxCount` to restrict text entering and display text count. `showClear` is supported.
269
+
270
+ ```svelte
271
+ <script lang="ts">
272
+ import { TextArea } from '@fibrae/semi-ui-svelte';
273
+ </script>
274
+
275
+ <div>
276
+ <TextArea aria-label="Text area" />
277
+ <br />
278
+ <br />
279
+ <TextArea aria-label="Text area with character limit" maxCount={100} showClear />
280
+ </div>
281
+ ```
282
+
283
+ ### Setting TextArea Height
284
+
285
+ You can set the style of the internal textarea element through `styles.textarea`, such as height, background color, etc.
286
+
287
+ ```svelte
288
+ <script lang="ts">
289
+ import { TextArea } from '@fibrae/semi-ui-svelte';
290
+ </script>
291
+
292
+ <div>
293
+ <TextArea placeholder="高度 120px" styles={{ textarea: 'height: 120px' }} />
294
+ <br />
295
+ <br />
296
+ <TextArea placeholder="高度 200px,灰色背景" styles={{ textarea: 'height: 200px; background-color: #f9f9f9' }} />
297
+ <br />
298
+ <br />
299
+ <TextArea placeholder="style 控制外层容器,styles.textarea 控制 textarea" style="border: 2px solid var(--semi-color-primary)" styles={{ textarea: 'height: 150px' }} />
300
+ </div>
301
+ ```
302
+
303
+ ### Line Numbers
304
+
305
+ Set `showLineNumber` to display line numbers. You can use `lineNumberStart` to set the starting line number, and customize the line number area via `styles.lineNumber` and `classNames.lineNumber`.
306
+
307
+ ```svelte
308
+ <script lang="ts">
309
+ import { TextArea } from '@fibrae/semi-ui-svelte';
310
+
311
+ const value = 'Line 1\nLine 2\n这是一行较长的文本,用来演示软换行时的行号对齐效果。\nLine 4\nLine 5';
312
+ </script>
313
+
314
+ <TextArea aria-label="带行号的文本" lineNumberStart={1} rows={12} showLineNumber style="width: 420px" styles={{ lineNumber: 'color: var(--semi-color-text-2)' }} {value} />
315
+ ```
316
+
317
+ ### Line break by Shift + Enter
318
+
319
+ By default, in a TextArea, both `Enter` and `Shift` + `Enter` can achieve line breaks. Through appropriate event listening and disabling the default behavior, you can achieve disabling line breaks with Enter and only allowing line breaks with Shift + Enter.
320
+
321
+ ```svelte
322
+ <script lang="ts">
323
+ import { HotKeys, TextArea } from '@fibrae/semi-ui-svelte';
324
+
325
+ let text = $state('');
326
+
327
+ const handleKeyDown = (event: KeyboardEvent) => {
328
+ if (event.key === 'Enter' && !event.shiftKey) {
329
+ event.preventDefault();
330
+ }
331
+ };
332
+ </script>
333
+
334
+ <div id="input-shift-enter-hint" style="display: flex">
335
+ 使用
336
+ <HotKeys hotKeys={['shift', 'enter']} style="margin-block-end: 12px; margin-inline: 4px" />
337
+ 换行的 TextArea
338
+ </div>
339
+ <TextArea aria-labelledby="input-shift-enter-hint" bind:value={text} onKeyDown={handleKeyDown} />
340
+ ```
341
+
342
+ ### Autosize TextArea
343
+
344
+ You can set `autosize` to allow TextArea resizing height with content.
345
+
346
+ ```svelte
347
+ <script lang="ts">
348
+ import { TextArea } from '@fibrae/semi-ui-svelte';
349
+ </script>
350
+
351
+ <div>
352
+ <TextArea aria-label="单行自适应高度" autosize rows={1} />
353
+ <br />
354
+ <br />
355
+ <TextArea aria-label="限制行数的自适应高度" autosize={{ minRows: 1, maxRows: 3 }} />
356
+ <br />
357
+ <br />
358
+ <TextArea aria-label="限制字数的自适应高度" autosize maxCount={100} />
359
+ </div>
360
+ ```
361
+
362
+ ### Custom calculated character string length
363
+
364
+ By setting the getValueLength property, you can customize the length of the character string. With maxLength and minLength (maxlength and minlength in Vue), you can support emoji length to calculate according to the visible length.
365
+
366
+ What is done inside Semi when getValueLength is passed in:
367
+
368
+ - maxlength: maxlength is not passed directly to the native input. If the input length exceeds the maximum limit, the legal length character entered last time is used.
369
+ - minlength: the length of minlength is switched dynamically, and an emoji counts as one length.
370
+ - maxCount: the value obtained by getValueLength is compared with maxCount
371
+
372
+ ```svelte
373
+ <script lang="ts">
374
+ import { Button, Form, FormInput, Input, TextArea, Typography } from '@fibrae/semi-ui-svelte';
375
+
376
+ let value = $state('');
377
+
378
+ // Counts grapheme clusters, so an emoji sequence counts as one character
379
+ const getValueLength = (str: string) => [...new Intl.Segmenter().segment(str)].length;
380
+
381
+ const getTextAreaStrLength = (str: string) => str.replace(/\s/g, '').length;
382
+ </script>
383
+
384
+ <div>
385
+ <h4 id="input-value-length-max-length">maxLength=10</h4>
386
+ <div>
387
+ <Typography.Text>尝试输入以下字符</Typography.Text>
388
+ <div>
389
+ <Typography.Text copyable>💖</Typography.Text>
390
+ </div>
391
+ <div>
392
+ <Typography.Text copyable>👨‍👩‍👧‍👦</Typography.Text>
393
+ </div>
394
+ </div>
395
+ <Input aria-labelledby="input-value-length-max-length" bind:value {getValueLength} maxlength={10} style="width: 200px; margin-block: 12px" />
396
+ {#if value}
397
+ <div>
398
+ <div>
399
+ <Typography.Text type="tertiary">{`getValueLength=${getValueLength(value)}`}</Typography.Text>
400
+ </div>
401
+ <div>
402
+ <Typography.Text type="tertiary">{`length=${value.length}`}</Typography.Text>
403
+ </div>
404
+ </div>
405
+ {/if}
406
+ <br />
407
+ <br />
408
+ <h4 id="input-value-length-min-length">FormInput + minLength=4</h4>
409
+ <Form layout="horizontal">
410
+ <FormInput aria-labelledby="input-value-length-min-length" field="username" {getValueLength} minlength={4} noLabel style="width: 200px" />
411
+ <Button htmlType="submit" type="primary">提交</Button>
412
+ </Form>
413
+ <h4 id="input-value-length-max-count">maxCount=10</h4>
414
+ <TextArea aria-labelledby="input-value-length-max-count" getValueLength={getTextAreaStrLength} maxCount={10} rows={2} style="width: 200px" value="semi design" />
415
+ </div>
416
+ ```
417
+
418
+ Answers to some questions:
419
+
420
+ > Why not just import the `grapheme-splitter` package? The uncompressed size of this package is 200+ kB, which is a bit too large for users who do not need to calculate emoji according to the visible length. Therefore, Semi chose to use the length calculation function as an argument for users to pass in
421
+
422
+ > Why not modify maxLength (maxlength in Vue) dynamically? Modify maxLength dynamically after the input operation is completed, calculate the remaining character length that can be entered. If the maxLength is set to 1, you want to enter a '💖' with a length of 2, but due to the limitation of input maxLength, you can't enter it at all here, and you can't update maxLength.
423
+
424
+ ### IME Input Mode
425
+
426
+ By setting the `composition` property to `true`, you can enable IME input mode. In this mode, when using an IME (e.g., Chinese pinyin input), `onChange` will not be called during IME confirmation (e.g., while pinyin is being typed), and will only be called once after the IME confirms the input. This is useful for real-time search scenarios to avoid unnecessary requests during pinyin input.
427
+
428
+ Both Input and TextArea support this property.
429
+
430
+ ```svelte
431
+ <script lang="ts">
432
+ import { Input, TextArea } from '@fibrae/semi-ui-svelte';
433
+
434
+ let inputValue = $state('');
435
+ let textAreaValue = $state('');
436
+ let inputCount = $state(0);
437
+ let textAreaCount = $state(0);
438
+ const style = 'width: 300px';
439
+ const counterStyle = 'margin-block-start: 8px; color: var(--semi-color-text-2); font-size: 12px';
440
+ </script>
441
+
442
+ <div>
443
+ <h4>Input with composition</h4>
444
+ <Input bind:value={inputValue} composition onChange={() => inputCount++} placeholder="开启 composition,拼音输入时不会触发 onChange" {style} />
445
+ <div style={counterStyle}>onChange 触发次数: {inputCount}</div>
446
+ <br />
447
+ <br />
448
+ <h4>TextArea with composition</h4>
449
+ <TextArea bind:value={textAreaValue} composition onChange={() => textAreaCount++} placeholder="开启 composition,拼音输入时不会触发 onChange" {style} />
450
+ <div style={counterStyle}>onChange 触发次数: {textAreaCount}</div>
451
+ </div>
452
+ ```
453
+
454
+ ## API Reference
455
+
456
+ ### Input
457
+
458
+ > `class` and `style` land on the outer wrapper; other undeclared attributes and events (such as `aria-*`, `id`, `name` and `onclick`) behave like those of the html input tag and land on the native input. `onFocus` and `onBlur` listen on the outer element and do not fire when focus moves between the input and the buttons inside the component.
459
+
460
+ **Props**
461
+
462
+ | Property | Description | Type | Default |
463
+ | - | - | - | - |
464
+ | addonAfter | Addon after the input. Text or a Semi icon alone gets horizontal spacing automatically. | `Snippet` | - |
465
+ | addonBefore | Addon before the input. Text or a Semi icon alone gets horizontal spacing automatically. | `Snippet` | - |
466
+ | autofocus | Focuses the input on mount, using preventScroll. | `boolean` | - |
467
+ | borderless | Borderless mode. | `boolean` | `false` |
468
+ | classNames | Class names of the inner parts, keyed by input (the native input element); values take any class binding and merge with the built-in classes. | `Partial<Record<InputPart, ClassValue>>` | - |
469
+ | clearIcon | Custom icon of the clear button, effective when showClear is true. | `Snippet` | - |
470
+ | composition | Whether to enable IME mode; onChange is not called during a composition and is called once after it ends. | `boolean` | `false` |
471
+ | disabled | Whether the input is disabled. | `boolean` | - |
472
+ | getValueLength | Custom string length calculation, used with maxlength and minlength. | `(value: string) => number` | - |
473
+ | hideSuffix | Hides the suffix while the clear button is shown; by default the two sit side by side. | `boolean` | `false` |
474
+ | insetLabel | Label inside the input. | `Snippet` | - |
475
+ | insetLabelId | The id of the element around the insetLabel snippet, for aria-labelledby to point at. | `string` | - |
476
+ | maxlength | Maximum length. With getValueLength the length is measured and truncated by it; otherwise the native attribute applies. | `number` | - |
477
+ | minlength | Minimum length. With getValueLength it is converted accordingly; otherwise the native attribute applies. | `number` | - |
478
+ | mode | Input mode; password shows a button that reveals or hides the text. | `InputMode` | - |
479
+ | onBlur | Called when focus leaves the component. The event is the focusout of the wrapper. | `(event: FocusEvent) => void` | - |
480
+ | onChange | Called when the content changes, with the new value and the event; in IME mode it is called once after the composition ends. This is the callback of Input, not the native change. | `(value: string, event: InputChangeEvent) => void` | - |
481
+ | onClear | Called when the clear button is activated. | `(event: MouseEvent) => void` | - |
482
+ | onCompositionEnd | Called when an IME composition ends. | `(event: CompositionEvent) => void` | - |
483
+ | onCompositionStart | Called when an IME composition starts. | `(event: CompositionEvent) => void` | - |
484
+ | onCompositionUpdate | Called when an IME composition updates. | `(event: CompositionEvent) => void` | - |
485
+ | onEnterPress | Called when Enter is pressed (keydown); the Enter that commits an IME composition does not call it. | `(event: KeyboardEvent) => void` | - |
486
+ | onFocus | Called when focus enters the component; moving focus between the input and its buttons does not call it. The event is the focusin of the wrapper. | `(event: FocusEvent) => void` | - |
487
+ | onInput | The native input event. | `(event: Event) => void` | - |
488
+ | onKeyDown | The native keydown event. | `(event: KeyboardEvent) => void` | - |
489
+ | onKeyUp | The native keyup event. | `(event: KeyboardEvent) => void` | - |
490
+ | placeholder | Hint text shown while the input is empty. | `string \| number` | - |
491
+ | prefix | Prefix. Text or a Semi icon alone gets horizontal spacing automatically. | `Snippet` | - |
492
+ | preventScroll | Whether the browser should avoid scrolling the document to show the newly focused element, for focus inside the component. | `boolean` | - |
493
+ | readonly | Whether the input is read-only; it also hides the clear button. | `boolean` | `false` |
494
+ | readOnly | Whether the input is read-only, locking typing only; the clear button stays (pickers rely on it). | `boolean` | - |
495
+ | showClear | Shows a clear button when the input has content and the pointer or focus is inside the component. | `boolean` | `false` |
496
+ | showClearIgnoreDisabled | Internal property used by DatePicker: the clear button stays available while disabled. | `boolean` | - |
497
+ | size | Input size: large, default or small. | `InputSize` | - |
498
+ | styles | Style strings of the inner parts, keyed like classNames. | `Partial<Record<InputPart, string>>` | - |
499
+ | suffix | Suffix. Text or a Semi icon alone gets horizontal spacing automatically. | `Snippet` | - |
500
+ | type | The type of the native input. | `string` | `"text"` |
501
+ | validateStatus | Validation status: default, error or warning; error outputs aria-invalid. | `ValidateStatus` | `"default"` |
502
+ | value | Content of the input; bind it with `bind:value`. A plain value is the initial content, which the input then maintains itself; `bind:value={get, set}` makes it fully controlled. | `string \| number` | - |
503
+
504
+ **Methods**
505
+
506
+ | Method | Description | Type |
507
+ | - | - | - |
508
+ | blur | Removes focus. | `() => void` |
509
+ | focus | Focuses the native input; the preventScroll prop applies when the option is not given. | `(options?: FocusOptions) => void` |
510
+ | getInput | Returns the native input element, or null while it is not rendered. | `() => HTMLInputElement \| undefined` |
511
+ | getNativeElement | Returns the root element of the component, or null while it is not rendered. | `() => HTMLDivElement \| undefined` |
512
+ | select | Selects all the text in the input. | `() => void` |
513
+ | setSelectionRange | Sets the selection, with the parameters of the native setSelectionRange. | `(start: number \| null, end: number \| null, direction?: 'backward' \| 'forward' \| 'none') => void` |
514
+
515
+ ### TextArea
516
+
517
+ > `class` and `style` land on the outer wrapper; other undeclared attributes and events (such as `aria-*`, `id`, `name` and `onclick`) behave like those of the html textarea tag and land on the native textarea.
518
+
519
+ **Props**
520
+
521
+ | Property | Description | Type | Default |
522
+ | - | - | - | - |
523
+ | autofocus | Focuses the text area on mount. | `boolean` | - |
524
+ | autosize | Whether the height follows the content; pass `{ minRows, maxRows }` to limit the rows. | `boolean \| AutosizeRow` | `false` |
525
+ | borderless | Borderless mode. | `boolean` | `false` |
526
+ | classNames | Class names of the inner parts, keyed by textarea (the native textarea element) and lineNumber (the line number area); values take any class binding and merge with the built-in classes. | `Partial<Record<TextAreaPart, ClassValue>>` | - |
527
+ | cols | Visible width in average character widths. | `number` | `20` |
528
+ | composition | Whether to enable IME mode; onChange is not called during a composition and is called once after it ends. | `boolean` | `false` |
529
+ | disabled | Whether the text area is disabled. | `boolean` | - |
530
+ | disabledEnterStartNewLine | Internal property used by Chat: Enter does not start a new line, Shift + Enter does. | `boolean` | - |
531
+ | getValueLength | Custom string length calculation, used with maxlength, minlength and maxCount. | `(value: string) => number` | - |
532
+ | lineNumberStart | Starting line number. | `number` | `1` |
533
+ | maxCount | Maximum number of characters; setting it shows a counter, which turns red when exceeded. The input is not truncated. | `number` | - |
534
+ | maxlength | Maximum length. With getValueLength the length is measured and truncated by it; otherwise the native attribute applies. | `number` | - |
535
+ | minlength | Minimum length. With getValueLength it is converted accordingly; otherwise the native attribute applies. | `number` | - |
536
+ | onBlur | Called when focus leaves the component. | `(event: FocusEvent) => void` | - |
537
+ | onChange | Called when the content changes, with the new value and the event; in IME mode it is called once after the composition ends. This is the callback of TextArea, not the native change. | `(value: string, event: TextAreaChangeEvent) => void` | - |
538
+ | onClear | Called when the clear button is activated. | `(event: MouseEvent) => void` | - |
539
+ | onCompositionEnd | Called when an IME composition ends. | `(event: CompositionEvent) => void` | - |
540
+ | onCompositionStart | Called when an IME composition starts. | `(event: CompositionEvent) => void` | - |
541
+ | onCompositionUpdate | Called when an IME composition updates. | `(event: CompositionEvent) => void` | - |
542
+ | onEnterPress | Called when Enter is pressed (keydown); the Enter that commits an IME composition does not call it. | `(event: KeyboardEvent) => void` | - |
543
+ | onFocus | Called when focus enters the component. | `(event: FocusEvent) => void` | - |
544
+ | onInput | The native input event. | `(event: Event) => void` | - |
545
+ | onKeyDown | The native keydown event. | `(event: KeyboardEvent) => void` | - |
546
+ | onKeyUp | The native keyup event. | `(event: KeyboardEvent) => void` | - |
547
+ | onResize | Called when the size changes: with autosize the payload is the border-box height; when the user drags to resize it is the content-box height and width. | `(size: { height: number; width?: number }) => void` | - |
548
+ | placeholder | Hint text shown while the text area is empty. | `string` | - |
549
+ | readonly | Whether the text area is read-only. | `boolean` | - |
550
+ | resize | Whether and in which direction the user may resize: none, both, horizontal, vertical, block or inline. It only takes effect when given and is ignored with autosize. | `'block' \| 'both' \| 'horizontal' \| 'inline' \| 'none' \| 'vertical'` | - |
551
+ | rows | Number of visible text lines. | `number` | `4` |
552
+ | showClear | Shows a clear button when the text area has content and the pointer or focus is inside the component. | `boolean` | `false` |
553
+ | showCounter | Whether to show the counter; it is always shown when maxCount is set. | `boolean` | `false` |
554
+ | showLineNumber | Whether to show line numbers. | `boolean` | `false` |
555
+ | styles | Style strings of the inner parts, keyed like classNames; the size of textarea comes from autosize, resize and rows, which win on the same property. | `Partial<Record<TextAreaPart, string>>` | - |
556
+ | validateStatus | Validation status: default, error or warning; error outputs aria-invalid. | `ValidateStatus` | - |
557
+ | value | Content of the text area; bind it with `bind:value`. A plain value is the initial content, which the text area then maintains itself; `bind:value={get, set}` makes it fully controlled. | `string` | - |
558
+
559
+ **Methods**
560
+
561
+ | Method | Description | Type |
562
+ | - | - | - |
563
+ | blur | Removes focus. | `() => void` |
564
+ | focus | Focuses the native textarea. | `(options?: FocusOptions) => void` |
565
+ | getNativeElement | Returns the root element of the component, or null while it is not rendered. | `() => HTMLDivElement \| undefined` |
566
+ | getTextarea | Returns the native textarea element, or null while it is not rendered. | `() => HTMLTextAreaElement \| undefined` |
567
+ | select | Selects all the text in the text area. | `() => void` |
568
+ | setSelectionRange | Sets the selection, with the parameters of the native setSelectionRange. | `(start: number \| null, end: number \| null, direction?: 'backward' \| 'forward' \| 'none') => void` |
569
+
570
+ ### InputGroup
571
+
572
+ `size` and `disabled` reach controls at any depth in the group through context (Button and the Buttons inside a ButtonGroup included); a value a control sets itself takes precedence over the group's, `disabled={false}` included. `class`, `style`, `data-*`, `aria-*`, `id` and other attributes land only on the `role="group"` element and are not passed to the controls; a `role`, `aria-label`, `aria-labelledby` or `id` you pass overrides the built-in value. The inputs and buttons that Select, Cascader, TreeSelect, AutoComplete, DatePicker, TimePicker, InputNumber and TagInput render inside themselves, and the controls in their popups, do not inherit from the group. `onFocus` and `onBlur` are callbacks of the group itself and are not passed to the controls: when a control in the group gains or loses focus, the handlers of the group and of the control both run, neither overriding the other.
573
+
574
+ With `label` (put the text in `label.text`, or write node content with the `fieldLabel` snippet and extra content with the `labelExtra` snippet), the group gets an outer wrapper, and the label names the whole `role="group"` element.
575
+
576
+ **Props**
577
+
578
+ | Property | Description | Type | Default |
579
+ | - | - | - | - |
580
+ | children | The input components in the group, such as Input, InputNumber, Select, AutoComplete, TreeSelect, Cascader and DatePicker. | `Snippet` | - |
581
+ | disabled | Whether the group is disabled; controls at any depth in the group take it, and a disabled a control sets itself takes precedence. | `boolean` | - |
582
+ | fieldLabel | Node content of the label, in place of `label.text`. | `Snippet` | - |
583
+ | label | Renders a FormLabel that names the group, configured with the FormLabel props plus id, class and style; `name` becomes the id of the group. Use the fieldLabel and labelExtra snippets for node content. | `InputGroupLabel` | - |
584
+ | labelExtra | Extra content of the label. | `Snippet` | - |
585
+ | labelPosition | Label position: top or left. | `'left' \| 'top'` | - |
586
+ | onBlur | Called when an element in the group loses focus (focusout), including when focus moves between children; it is not passed to the children. | `(event: FocusEvent) => void` | - |
587
+ | onFocus | Called when an element in the group gains focus (focusin), including when focus moves between children; it is not passed to the children. | `(event: FocusEvent) => void` | - |
588
+ | size | Input size: large, default or small; controls at any depth in the group that set no size of their own take it. | `InputSize` | - |
589
+
590
+ ## Methods
591
+
592
+ Input and TextArea expose methods through `export function`; get the instance with `bind:this` and call them. The members are in the **Methods** tables of each component above. `getInput`, `getTextarea` and `getNativeElement` return the currently mounted node on every call, and `null` after unmount.
593
+
594
+ ## Accessibility
595
+
596
+ ### ARIA
597
+
598
+ - When validateStatus is error, the aria-invalid of the input box is true
599
+ - When used in Form, the input is associated with the Field label through aria-labelledby
600
+
601
+ ### Keyboard and focus
602
+
603
+ - Input can be focused, keyboard users can use Tab and Shift + Tab to switch focus
604
+ - The password visibility toggle is a native `button` named by the locale's "Show password" or "Hidden password" for its state; it can be focused and toggled with Enter or Space, after which the focus goes back to the input
605
+ - With `showClear`, a value, and no `disabled` (the input of a DatePicker with `insetInput` shows it while disabled too), the clear button is a native `button` named "Clear input" from the locale. Input shows it on hover or while focus is inside; TextArea does the same unless it is not editable. From the input, Tab moves to the clear button; Enter or Space clears and the focus goes back to the input. A mouse click on the clear button leaves the focus where it is
606
+
607
+ ## Design Tokens
608
+
609
+ The design token table of this component is on the web page: <https://semi-design-next.pages.dev/en-US/svelte/input/input/>
610
+
611
+ ## Changes from Semi Design
612
+
613
+ From the project release notes (written in Chinese). Your knowledge of Semi Design does not cover these.
614
+
615
+ - 破坏性:Input 删除 `inputStyle`,改用 `classNames.input`、`styles.input`,落在原生 input;TextArea 删除 `textareaStyle`、`lineNumberClassName`、`lineNumberStyle`,改用 `classNames`、`styles` 的 `textarea`、`lineNumber` 键,`styles.textarea` 与 `autosize`、`resize`、`rows` 产生的尺寸样式冲突时以后者为准。
616
+ - 破坏性:ref 改为 `InputHandle { focus, blur, select, setSelectionRange, input, nativeElement }` 与 `TextAreaHandle`(以 `textarea` 替代 `input`),原生节点读 `ref.current.input` 或 `ref.current.textarea`。
617
+ - `onEnterPress` 改在 `keydown` 触发,不再声明 `onKeyPress`,TextArea 删除从未生效的 `onPressEnter`。清除按钮改为原生 `button`,删除类名 `semi-input-clearbtn-hidden`;`readonly` 时不显示清除按钮。
618
+ - `onFocus`、`onBlur` 以整个组件为界,焦点在输入框与内部按钮、addon 之间移动不触发;`addonAfter` 里的 Button 获焦不再触发 `onBlur`,Form 的 blur 校验随之推迟。
619
+ - 破坏性(类型):`onChange(value, e)` 的 `e` 改为 `InputChangeEvent`、`TextAreaChangeEvent`,读值用 `value`;`onClear` 参数为 `MouseEvent<HTMLButtonElement>`,`onFocus`、`onBlur` 为 `FocusEvent<HTMLDivElement>`;`InputState` 去掉 `isHovering`、`minLength`。
620
+ - TextArea 的 `autosize` 优先用 CSS `field-sizing: content`(行数换算为最小、最大高度,不写内联 `height`);浏览器不支持时(Chrome 123 以前、Firefox 152 以前、Safari 26.2 以前)挂载后改由 JS 按内容高度写内联 `height`,值、宽度、字体加载变化时重算,行数范围仍由样式限定。TagInput 的输入框宽度同理,不支持时按文字宽度写内联 `width`。InputGroup 的 ref 指向 `role="group"` 的 span,`onFocus`、`onBlur` 由子元素焦点事件冒泡触发。
621
+ - 只读(`readonly`)Input 的原生输入框也显示默认光标,TimePicker `inputReadOnly` 的输入框显示指针光标。
622
+ - TextArea 字数超过 `maxCount` 时 textarea 带 `aria-invalid="true"`,回到范围内后取消。
623
+ - Svelte:`value` 可绑定,没有 `default*` 属性;函数绑定 `bind:value={get, set}` 的 setter 可以拒绝输入,被拒绝的文本会还原到输入框;`prefix`、`suffix`、`addonBefore`、`addonAfter`、`insetLabel`、`clearIcon` 是 snippet;`inputStyle`、`textareaStyle`、`lineNumberStyle` 是字符串。
624
+ - Svelte:根容器带 `class` 和 `style`,其余未声明属性透传到原生 `input` 或 `textarea`;实例方法经 `bind:this` 调用:`focus`、`blur`、`select`、`setSelectionRange`、`getInput`、`getNativeElement`(TextArea 为 `getTextarea`、`getNativeElement`)。
625
+ - 破坏性:InputGroup 经 context 向组内任意深度的控件下发 `size`、`disabled`,不再只作用于直接子项(原来 React 用 `cloneElement`、Vue 用子节点注入)。读组的控件有 Input、TextArea(只读 `disabled`,TextArea 没有 `size`)、InputNumber、Select、Cascader、TreeSelect、DatePicker、TimePicker、AutoComplete、TagInput、Button、IconButton,以及嵌套 ButtonGroup 里的 Button。包在 `div`、Space 等元素里的控件同样生效。
626
+ - 破坏性(四个框架):优先级为控件自己显式传的值 > 组的值 > 全局默认值(`overrideDefaultProps`)> 内置默认值,显式传 `undefined` 视为没传。原来组的 `size` 覆盖控件自己的 `size`(React、Vue、Solid、Svelte 的 Input 系控件),现在 `<InputGroup size="large"><Input size="small" /></InputGroup>` 渲染 small;`disabled={false}` 优先于组的 `disabled`。组没有设 `size` 时不再向控件发布 `default`,控件取自己的全局默认。
627
+ - 破坏性(四个框架):InputGroup 上的其他未声明属性(`aria-*`、`data-*`、`name`、`id` 等)只落在 `role="group"` 的 span 上,不再下发给任何子控件(原来 React 复制到每个直接子项,Vue、Solid、Svelte 经注入或 context 分发给输入类控件)。使用方传入的 `role`、`aria-label`、`aria-labelledby`、`id` 覆盖内置值;有 `label` 时这些属性落在 span 而不是外层 wrapper。`onFocus`、`onBlur` 仍由根 span 冒泡接收,不下发。React 的 `InputGroupProps` 继承 span 的原生属性,`style` 类型由 `Record<string, any>` 变为 `CSSProperties`。
628
+ - Select、Cascader、TreeSelect、AutoComplete、DatePicker、TimePicker、InputNumber、TagInput 自己渲染的 Input、TagInput、Button(触发器、前后缀、搜索框等控件自身子树里的)不读外层 InputGroup,控件本身读组;弹层里的控件(如 DatePicker 面板中的按钮、Popover 里的 Input)同样不继承。
629
+ - ButtonGroup 把 InputGroup 的 `size`、`disabled` 折进它下发的值,优先级为 Button 自己 > 最近的 ButtonGroup > 外层 ButtonGroup > InputGroup > 全局默认;组 `disabled` 时 ButtonGroup 的分隔线带 `-disabled` 类,与按钮一致。
630
+ - Input 不把 InputGroup 传给自己的 `prefix`、`suffix`、`addonBefore`、`addonAfter`:其中的 Button 等控件不再继承组的 `size`、`disabled`(四个框架,同 Ant Design 的 `ContextIsolator`)。
631
+ - Svelte:InputGroup 新增 `label`、`labelPosition`、`fieldLabel`、`labelExtra`,有标签时 group 以 `aria-labelledby` 指向标签,没有标签时 `aria-label` 取语言包文案。
632
+ - Svelte:Input、TextArea 不接受原生 `defaultValue`;不传 `value` 即非受控,单向传值作初值。
633
+ - Svelte:新增 `readOnly` prop,对应原生 `readonly`,只禁止键入、保留清除按钮;`readonly` 仍同时隐藏清除按钮。
634
+ - 传 `getValueLength` 时 `maxLength={0}` 也生效,不再放行输入。Vue:模板里不带值的 `readOnly` 按开启处理。
635
+ - 浏览器自动填充后,Input、TextArea 保持主题的背景与文字颜色,错误、警告状态的底色不再被盖住。
636
+ - Vue、Svelte:Firefox 的 `compositionend` 先于 `input` 事件,从候选词提交时不再丢失提交的文字(原来父组件收到预编辑文本)。
637
+ - Vue、Solid、Svelte:`composition` 为 true 时,Firefox 中一次输入法提交只触发一次 `onChange`(原来 `compositionend` 之后补发的同值 `input` 事件再触发一次)。
638
+ - Svelte:Input、TextArea 等把原生属性拆给内部控件的组件,除 `tabindex` 外也认 `tabIndex`,落在原生控件上而不是根元素。
639
+ - 破坏性(类型,React):TextArea 的 `onBlur` 收到 React 合成事件 `FocusEvent<HTMLDivElement>`,`TextAreaChangeEvent` 同样改为该类型(原来是原生 `FocusEvent`)。
640
+ - 清除按钮触发的 `onChange`、`onClear` 事件对象上不再有 `__fromClearBtn` 属性(四个框架)。