@rescui/input 0.15.2 → 0.15.4-RUI-293-Update-menu-component-7a032357e.20
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 +3 -1
- package/lib/_virtual/index.css.js +12 -12
- package/lib/index.css +120 -120
- package/lib/index.d.ts +63 -64
- package/lib/index.js +2 -2
- package/lib/input.d.ts +94 -94
- package/lib/input.p.module.css.js +28 -28
- package/lib/parts/custom-icon.d.ts +26 -26
- package/lib/parts/right-icons.d.ts +14 -14
- package/lib/parts/use-backward-compatible-id.d.ts +4 -4
- package/llm/components/input.md +629 -0
- package/llm/index.md +2 -0
- package/package.json +11 -10
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
# Input
|
|
2
|
+
|
|
3
|
+
Inputs allow users to enter and edit text in a UI. They are typically used in forms and dialogs.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Features showcase
|
|
8
|
+
|
|
9
|
+
### Simple usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Input } from '@rescui/input';
|
|
13
|
+
|
|
14
|
+
<Input />;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Example with clear
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { useState } from 'react';
|
|
21
|
+
import { Input } from '@rescui/input';
|
|
22
|
+
|
|
23
|
+
const Demo = () => {
|
|
24
|
+
const [value, setValue] = useState('');
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Input
|
|
28
|
+
value={value}
|
|
29
|
+
onChange={e => setValue(e.target.value)}
|
|
30
|
+
onClear={() => setValue('')}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
render(<Demo />);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Example show password on mouse hold
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { useState } from 'react';
|
|
42
|
+
import { EyeOutlineIcon, EyeCrossedOutlineIcon } from '@rescui/icons';
|
|
43
|
+
import { Input } from '@rescui/input';
|
|
44
|
+
|
|
45
|
+
const Demo = () => {
|
|
46
|
+
const [value, setValue] = useState('');
|
|
47
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
48
|
+
|
|
49
|
+
const IconButton = showPassword ? EyeCrossedOutlineIcon : EyeOutlineIcon;
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Input
|
|
53
|
+
value={value}
|
|
54
|
+
onChange={e => setValue(e.target.value)}
|
|
55
|
+
type={showPassword ? 'text' : 'password'}
|
|
56
|
+
placeholder="Secret password"
|
|
57
|
+
icon={
|
|
58
|
+
<IconButton
|
|
59
|
+
onMouseDown={() => setShowPassword(true)}
|
|
60
|
+
onMouseUp={() => setShowPassword(false)}
|
|
61
|
+
/>
|
|
62
|
+
}
|
|
63
|
+
iconType="rightAction"
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
render(<Demo />);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Example show password on mouse click
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { useState } from 'react';
|
|
75
|
+
import { EyeOutlineIcon, EyeCrossedOutlineIcon } from '@rescui/icons';
|
|
76
|
+
import { Input } from '@rescui/input';
|
|
77
|
+
|
|
78
|
+
const Demo = () => {
|
|
79
|
+
const [value, setValue] = useState('');
|
|
80
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
81
|
+
|
|
82
|
+
const IconButton = showPassword ? EyeCrossedOutlineIcon : EyeOutlineIcon;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Input
|
|
86
|
+
value={value}
|
|
87
|
+
onChange={e => setValue(e.target.value)}
|
|
88
|
+
type={showPassword ? 'text' : 'password'}
|
|
89
|
+
placeholder="Secret password"
|
|
90
|
+
icon={<IconButton onClick={() => setShowPassword(!showPassword)} />}
|
|
91
|
+
iconType="rightAction"
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
render(<Demo />);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Example with custom clear icon
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { useState } from 'react';
|
|
103
|
+
import { ErrorOutlineIcon } from '@rescui/icons';
|
|
104
|
+
import { Input } from '@rescui/input';
|
|
105
|
+
|
|
106
|
+
const Demo = () => {
|
|
107
|
+
const [value, setValue] = useState('');
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<Input
|
|
111
|
+
value={value}
|
|
112
|
+
clearIcon={<ErrorOutlineIcon />}
|
|
113
|
+
onChange={e => setValue(e.target.value)}
|
|
114
|
+
onClear={() => setValue('')}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
render(<Demo />);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Example with a tooltip in a label
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { Input } from '@rescui/input';
|
|
125
|
+
import { Tooltip } from '@rescui/tooltip';
|
|
126
|
+
import { InfoOutlineIcon } from '@rescui/icons';
|
|
127
|
+
|
|
128
|
+
<Input
|
|
129
|
+
label={
|
|
130
|
+
<>
|
|
131
|
+
Enter your name:{' '}
|
|
132
|
+
<Tooltip size="s" placement="right" content="How can we address you">
|
|
133
|
+
<InfoOutlineIcon style={{ verticalAlign: 'top' }} />
|
|
134
|
+
</Tooltip>
|
|
135
|
+
</>
|
|
136
|
+
}
|
|
137
|
+
/>;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Example with turning off system microelements
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { useState } from 'react';
|
|
144
|
+
import { Input } from '@rescui/input';
|
|
145
|
+
|
|
146
|
+
const Demo = () => {
|
|
147
|
+
const [value, setValue] = useState('42');
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Input
|
|
151
|
+
offSystemMicroelements
|
|
152
|
+
value={value}
|
|
153
|
+
type="number"
|
|
154
|
+
onChange={e => setValue(e.target.value)}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
render(<Demo />);
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Example in form
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { useReducer, useState } from 'react';
|
|
166
|
+
import { ThemedExample } from '@/components/themed-example';
|
|
167
|
+
import { Button } from '@rescui/button';
|
|
168
|
+
import { AdaptiveSwitcher } from '@rescui/adaptive-switcher';
|
|
169
|
+
import { Switcher } from '@rescui/switcher';
|
|
170
|
+
import { Input } from '@rescui/input';
|
|
171
|
+
import { PersonIcon } from '@rescui/icons';
|
|
172
|
+
import { textCn } from '@rescui/typography';
|
|
173
|
+
|
|
174
|
+
const initialState = {
|
|
175
|
+
mode: 'classic',
|
|
176
|
+
size: 'm',
|
|
177
|
+
disabled: false,
|
|
178
|
+
error: 'some',
|
|
179
|
+
reserveErrorLine: true,
|
|
180
|
+
busy: false,
|
|
181
|
+
label: true,
|
|
182
|
+
boldLabel: true,
|
|
183
|
+
placeholder: false,
|
|
184
|
+
note: '',
|
|
185
|
+
icon: false,
|
|
186
|
+
iconType: 'right',
|
|
187
|
+
enableClear: false,
|
|
188
|
+
iconIsAction: false,
|
|
189
|
+
value: '',
|
|
190
|
+
suffix: false
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const StatefulInput = ({ enableClear, ...props }) => {
|
|
194
|
+
const [value, setValue] = useState('');
|
|
195
|
+
return (
|
|
196
|
+
<Input
|
|
197
|
+
value={value}
|
|
198
|
+
onInput={e => setValue(e.target.value)}
|
|
199
|
+
onClear={enableClear ? () => setValue('') : null}
|
|
200
|
+
{...props}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const ERROR_MSG = 'Error message';
|
|
206
|
+
|
|
207
|
+
const Demo = () => {
|
|
208
|
+
const [state, setState] = useReducer(
|
|
209
|
+
(state, newSate) => ({ ...state, ...newSate }),
|
|
210
|
+
initialState
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
const {
|
|
214
|
+
mode,
|
|
215
|
+
size,
|
|
216
|
+
disabled,
|
|
217
|
+
busy,
|
|
218
|
+
error,
|
|
219
|
+
reserveErrorLine,
|
|
220
|
+
icon,
|
|
221
|
+
label,
|
|
222
|
+
boldLabel,
|
|
223
|
+
placeholder,
|
|
224
|
+
note,
|
|
225
|
+
iconType,
|
|
226
|
+
enableClear,
|
|
227
|
+
suffix
|
|
228
|
+
} = state;
|
|
229
|
+
|
|
230
|
+
const inputProps = {
|
|
231
|
+
mode,
|
|
232
|
+
error,
|
|
233
|
+
reserveErrorLine,
|
|
234
|
+
disabled,
|
|
235
|
+
boldLabel,
|
|
236
|
+
note,
|
|
237
|
+
suffix: suffix ? '.myjetbrains.com' : null,
|
|
238
|
+
busy,
|
|
239
|
+
size,
|
|
240
|
+
icon: icon && <PersonIcon />,
|
|
241
|
+
iconType: iconType,
|
|
242
|
+
enableClear
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const offsetCn = reserveErrorLine
|
|
246
|
+
? 'rs-docs-offset-top-8'
|
|
247
|
+
: 'rs-docs-offset-top-24';
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<div>
|
|
251
|
+
<div>
|
|
252
|
+
<div className={textCn('rs-text-3', { hardness: 'hard' })}>
|
|
253
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
254
|
+
Mode:
|
|
255
|
+
</div>
|
|
256
|
+
<Switcher
|
|
257
|
+
size="xs"
|
|
258
|
+
value={state.mode}
|
|
259
|
+
options={[
|
|
260
|
+
{ label: 'Classic', value: 'classic' },
|
|
261
|
+
{ label: 'Rock', value: 'rock' }
|
|
262
|
+
]}
|
|
263
|
+
onChange={value => setState({ mode: value })}
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<div
|
|
268
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
269
|
+
style={{ marginTop: 12 }}
|
|
270
|
+
>
|
|
271
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
272
|
+
Size:
|
|
273
|
+
</div>
|
|
274
|
+
<Switcher
|
|
275
|
+
size="xs"
|
|
276
|
+
value={state.size}
|
|
277
|
+
options={[
|
|
278
|
+
{ label: 'L', value: 'l' },
|
|
279
|
+
{ label: 'M', value: 'm' },
|
|
280
|
+
{ label: 'S', value: 's' }
|
|
281
|
+
]}
|
|
282
|
+
onChange={value => setState({ size: value })}
|
|
283
|
+
/>
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<div
|
|
287
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
288
|
+
style={{ marginTop: 12 }}
|
|
289
|
+
>
|
|
290
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
291
|
+
With label:
|
|
292
|
+
</div>
|
|
293
|
+
<Switcher
|
|
294
|
+
size="xs"
|
|
295
|
+
value={state.label}
|
|
296
|
+
options={[
|
|
297
|
+
{ label: 'Yes', value: true },
|
|
298
|
+
{ label: 'No', value: false }
|
|
299
|
+
]}
|
|
300
|
+
onChange={value => setState({ label: value })}
|
|
301
|
+
/>
|
|
302
|
+
</div>
|
|
303
|
+
|
|
304
|
+
<div
|
|
305
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
306
|
+
style={{ marginTop: 12 }}
|
|
307
|
+
>
|
|
308
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
309
|
+
Bold label:
|
|
310
|
+
</div>
|
|
311
|
+
<Switcher
|
|
312
|
+
size="xs"
|
|
313
|
+
disabled={!state.label}
|
|
314
|
+
value={state.boldLabel}
|
|
315
|
+
options={[
|
|
316
|
+
{ label: 'Yes', value: true },
|
|
317
|
+
{ label: 'No', value: false }
|
|
318
|
+
]}
|
|
319
|
+
onChange={value => setState({ boldLabel: value })}
|
|
320
|
+
/>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<div
|
|
324
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
325
|
+
style={{ marginTop: 12 }}
|
|
326
|
+
>
|
|
327
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
328
|
+
With placeholder:
|
|
329
|
+
</div>
|
|
330
|
+
<Switcher
|
|
331
|
+
size="xs"
|
|
332
|
+
value={state.placeholder}
|
|
333
|
+
options={[
|
|
334
|
+
{ label: 'Yes', value: true },
|
|
335
|
+
{ label: 'No', value: false }
|
|
336
|
+
]}
|
|
337
|
+
onChange={value => setState({ placeholder: value })}
|
|
338
|
+
/>
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<div
|
|
342
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
343
|
+
style={{ marginTop: 12 }}
|
|
344
|
+
>
|
|
345
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
346
|
+
With note:
|
|
347
|
+
</div>
|
|
348
|
+
<Switcher
|
|
349
|
+
size="xs"
|
|
350
|
+
value={state.note}
|
|
351
|
+
options={[
|
|
352
|
+
{ label: 'Yes', value: 'Enter text' },
|
|
353
|
+
{ label: 'No', value: '' }
|
|
354
|
+
]}
|
|
355
|
+
onChange={value => setState({ note: value })}
|
|
356
|
+
/>
|
|
357
|
+
</div>
|
|
358
|
+
|
|
359
|
+
<div
|
|
360
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
361
|
+
style={{ marginTop: 12 }}
|
|
362
|
+
>
|
|
363
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
364
|
+
Disabled:
|
|
365
|
+
</div>
|
|
366
|
+
<Switcher
|
|
367
|
+
size="xs"
|
|
368
|
+
value={state.disabled}
|
|
369
|
+
options={[
|
|
370
|
+
{ label: 'Yes', value: true },
|
|
371
|
+
{ label: 'No', value: false }
|
|
372
|
+
]}
|
|
373
|
+
onChange={value => setState({ disabled: value })}
|
|
374
|
+
/>
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
<div
|
|
378
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
379
|
+
style={{ marginTop: 12 }}
|
|
380
|
+
>
|
|
381
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
382
|
+
Busy:
|
|
383
|
+
</div>
|
|
384
|
+
<Switcher
|
|
385
|
+
size="xs"
|
|
386
|
+
value={state.busy}
|
|
387
|
+
options={[
|
|
388
|
+
{ label: 'Yes', value: true },
|
|
389
|
+
{ label: 'No', value: false }
|
|
390
|
+
]}
|
|
391
|
+
onChange={value => setState({ busy: value })}
|
|
392
|
+
/>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
<div
|
|
396
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
397
|
+
style={{ marginTop: 12 }}
|
|
398
|
+
>
|
|
399
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
400
|
+
Error:
|
|
401
|
+
</div>
|
|
402
|
+
<Switcher
|
|
403
|
+
size="xs"
|
|
404
|
+
value={state.error}
|
|
405
|
+
options={[
|
|
406
|
+
{ label: 'All', value: 'all' },
|
|
407
|
+
{ label: 'Some', value: 'some' },
|
|
408
|
+
{ label: 'None', value: 'none' }
|
|
409
|
+
]}
|
|
410
|
+
onChange={value => setState({ error: value })}
|
|
411
|
+
/>
|
|
412
|
+
</div>
|
|
413
|
+
|
|
414
|
+
<div
|
|
415
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
416
|
+
style={{ marginTop: 12 }}
|
|
417
|
+
>
|
|
418
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
419
|
+
Reserve error line:
|
|
420
|
+
</div>
|
|
421
|
+
<Switcher
|
|
422
|
+
size="xs"
|
|
423
|
+
value={state.reserveErrorLine}
|
|
424
|
+
options={[
|
|
425
|
+
{ label: 'Yes', value: true },
|
|
426
|
+
{ label: 'No', value: false }
|
|
427
|
+
]}
|
|
428
|
+
onChange={value => setState({ reserveErrorLine: value })}
|
|
429
|
+
/>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<div
|
|
433
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
434
|
+
style={{ marginTop: 12 }}
|
|
435
|
+
>
|
|
436
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
437
|
+
Icon:
|
|
438
|
+
</div>
|
|
439
|
+
<Switcher
|
|
440
|
+
size="xs"
|
|
441
|
+
value={state.icon}
|
|
442
|
+
options={[
|
|
443
|
+
{ label: 'Yes', value: true },
|
|
444
|
+
{ label: 'No', value: false }
|
|
445
|
+
]}
|
|
446
|
+
onChange={value => setState({ icon: value })}
|
|
447
|
+
/>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
<div
|
|
451
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
452
|
+
style={{ marginTop: 12 }}
|
|
453
|
+
>
|
|
454
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
455
|
+
Icon type:
|
|
456
|
+
</div>
|
|
457
|
+
<AdaptiveSwitcher
|
|
458
|
+
size="xs"
|
|
459
|
+
disabled={!state.icon}
|
|
460
|
+
value={state.iconType}
|
|
461
|
+
options={[
|
|
462
|
+
{ label: 'Left', value: 'left' },
|
|
463
|
+
{ label: 'Right', value: 'right' },
|
|
464
|
+
{ label: 'Right action', value: 'rightAction' },
|
|
465
|
+
{ label: 'Right action focusable', value: 'rightActionFocusable' }
|
|
466
|
+
]}
|
|
467
|
+
onChange={value => setState({ iconType: value })}
|
|
468
|
+
/>
|
|
469
|
+
</div>
|
|
470
|
+
|
|
471
|
+
<div
|
|
472
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
473
|
+
style={{ marginTop: 12 }}
|
|
474
|
+
>
|
|
475
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
476
|
+
Enable Clear:
|
|
477
|
+
</div>
|
|
478
|
+
<Switcher
|
|
479
|
+
size="xs"
|
|
480
|
+
value={state.enableClear}
|
|
481
|
+
options={[
|
|
482
|
+
{ label: 'Yes', value: true },
|
|
483
|
+
{ label: 'No', value: false }
|
|
484
|
+
]}
|
|
485
|
+
onChange={value => setState({ enableClear: value })}
|
|
486
|
+
/>
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
<div
|
|
490
|
+
className={textCn('rs-text-3', { hardness: 'hard' })}
|
|
491
|
+
style={{ marginTop: 12 }}
|
|
492
|
+
>
|
|
493
|
+
<div style={{ display: 'inline-block', marginRight: '12px' }}>
|
|
494
|
+
With suffix:
|
|
495
|
+
</div>
|
|
496
|
+
<Switcher
|
|
497
|
+
size="xs"
|
|
498
|
+
value={state.suffix}
|
|
499
|
+
options={[
|
|
500
|
+
{ label: 'Yes', value: true },
|
|
501
|
+
{ label: 'No', value: false }
|
|
502
|
+
]}
|
|
503
|
+
onChange={value => setState({ suffix: value })}
|
|
504
|
+
/>
|
|
505
|
+
</div>
|
|
506
|
+
</div>
|
|
507
|
+
|
|
508
|
+
<div
|
|
509
|
+
style={{
|
|
510
|
+
marginTop: '48px',
|
|
511
|
+
padding: 16,
|
|
512
|
+
maxWidth: suffix ? '424px' : '324px'
|
|
513
|
+
}}
|
|
514
|
+
>
|
|
515
|
+
<StatefulInput
|
|
516
|
+
{...inputProps}
|
|
517
|
+
name="product"
|
|
518
|
+
error={error === 'all' && ERROR_MSG}
|
|
519
|
+
label={label && 'Product of your interest'}
|
|
520
|
+
placeholder={placeholder ? 'Product of your interest' : null}
|
|
521
|
+
/>
|
|
522
|
+
<StatefulInput
|
|
523
|
+
{...inputProps}
|
|
524
|
+
name="topic"
|
|
525
|
+
error={error === 'all' && ERROR_MSG}
|
|
526
|
+
label={label && 'Topic'}
|
|
527
|
+
placeholder={placeholder ? 'Topic' : null}
|
|
528
|
+
className={offsetCn}
|
|
529
|
+
/>
|
|
530
|
+
<StatefulInput
|
|
531
|
+
{...inputProps}
|
|
532
|
+
name="name"
|
|
533
|
+
error={error !== 'none' && ERROR_MSG}
|
|
534
|
+
label={label && 'Name'}
|
|
535
|
+
placeholder={placeholder ? 'Name' : null}
|
|
536
|
+
className={offsetCn}
|
|
537
|
+
/>
|
|
538
|
+
<StatefulInput
|
|
539
|
+
{...inputProps}
|
|
540
|
+
name="email"
|
|
541
|
+
error={error === 'all' && ERROR_MSG}
|
|
542
|
+
label={label && 'Email'}
|
|
543
|
+
placeholder={placeholder ? 'Email' : null}
|
|
544
|
+
type="email"
|
|
545
|
+
autoComplete="email"
|
|
546
|
+
className={offsetCn}
|
|
547
|
+
/>
|
|
548
|
+
<StatefulInput
|
|
549
|
+
{...inputProps}
|
|
550
|
+
name="phone"
|
|
551
|
+
error={error === 'all' && ERROR_MSG}
|
|
552
|
+
label={label && 'Phone number (optional)'}
|
|
553
|
+
placeholder={placeholder ? 'Phone number (optional)' : null}
|
|
554
|
+
autoComplete="phone"
|
|
555
|
+
note="International format, eg. +1 609 714 7883"
|
|
556
|
+
className={offsetCn}
|
|
557
|
+
/>
|
|
558
|
+
<Button className={offsetCn} mode={mode}>
|
|
559
|
+
Submit
|
|
560
|
+
</Button>
|
|
561
|
+
</div>
|
|
562
|
+
</div>
|
|
563
|
+
);
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
render(
|
|
567
|
+
<ThemedExample>
|
|
568
|
+
<Demo />
|
|
569
|
+
</ThemedExample>
|
|
570
|
+
);
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
## CSS Mixins API
|
|
574
|
+
|
|
575
|
+
#### `Input` mixins
|
|
576
|
+
|
|
577
|
+
| Mixin name | Details |
|
|
578
|
+
| --- | --- |
|
|
579
|
+
| `rs-input-size-s` | prop: `size`<br><br>value: `"s"` |
|
|
580
|
+
| `rs-input-size-m` | prop: `size`<br><br>value: `"m"` |
|
|
581
|
+
| `rs-input-size-l` | prop: `size`<br><br>value: `"l"` |
|
|
582
|
+
| `rs-input-mode-classic` | prop: `mode`<br><br>value: `"classic"` |
|
|
583
|
+
| `rs-input-mode-rock` | prop: `mode`<br><br>value: `"rock"` |
|
|
584
|
+
|
|
585
|
+
##### Demo
|
|
586
|
+
|
|
587
|
+
Instead of separate classes, it may be a single class with `@media` queries inside:
|
|
588
|
+
|
|
589
|
+
```tsx
|
|
590
|
+
import { Input } from '@rescui/input';
|
|
591
|
+
|
|
592
|
+
const MyInput = ({ className }) => {
|
|
593
|
+
return (
|
|
594
|
+
<div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
|
|
595
|
+
<Input placeholder="Type something" className={className} />
|
|
596
|
+
</div>
|
|
597
|
+
);
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
render(
|
|
601
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
602
|
+
<div>
|
|
603
|
+
<p>Default:</p>
|
|
604
|
+
<MyInput />
|
|
605
|
+
</div>
|
|
606
|
+
<div>
|
|
607
|
+
<p>Var1:</p>
|
|
608
|
+
<MyInput className={`my-input-var-1`} />
|
|
609
|
+
</div>
|
|
610
|
+
<div>
|
|
611
|
+
<p>Var1 & Var2 combined:</p>
|
|
612
|
+
<MyInput className={`my-input-var-1 my-input-var-2`} />
|
|
613
|
+
</div>
|
|
614
|
+
</div>
|
|
615
|
+
);
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
```postcss
|
|
619
|
+
@import '@rescui/input/lib/public-api.p.css';
|
|
620
|
+
|
|
621
|
+
.my-input-var-1 {
|
|
622
|
+
@mixin rs-input-size-l;
|
|
623
|
+
@mixin rs-input-mode-rock;
|
|
624
|
+
}
|
|
625
|
+
.my-input-var-2 {
|
|
626
|
+
@mixin rs-input-size-s;
|
|
627
|
+
@mixin rs-input-mode-classic;
|
|
628
|
+
}
|
|
629
|
+
```
|
package/llm/index.md
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/input",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"src:main": "src/index.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"lib",
|
|
12
|
+
"llm",
|
|
12
13
|
"LICENSE.txt"
|
|
13
14
|
],
|
|
14
15
|
"publishConfig": {
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
19
|
-
"@rescui/form-field": "
|
|
20
|
+
"@rescui/form-field": "0.1.4-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
|
|
20
21
|
"classnames": "^2.2.6"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
@@ -25,13 +26,13 @@
|
|
|
25
26
|
"react": ">=16.8.0 <20"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@rescui/colors": "
|
|
29
|
-
"@rescui/icons": "
|
|
30
|
-
"@rescui/postcss-preset-library": "
|
|
31
|
-
"@rescui/scripts": "
|
|
32
|
-
"@rescui/tooltip": "
|
|
33
|
-
"@rescui/typography": "
|
|
34
|
-
"@rescui/visual-regression": "
|
|
29
|
+
"@rescui/colors": "0.3.1-RUI-293-Update-menu-component-7a032357e.55+7a032357e",
|
|
30
|
+
"@rescui/icons": "1.7.7-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
|
|
31
|
+
"@rescui/postcss-preset-library": "0.2.2",
|
|
32
|
+
"@rescui/scripts": "0.5.2",
|
|
33
|
+
"@rescui/tooltip": "0.11.1-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
|
|
34
|
+
"@rescui/typography": "0.27.1-RUI-293-Update-menu-component-7a032357e.20+7a032357e",
|
|
35
|
+
"@rescui/visual-regression": "0.1.4",
|
|
35
36
|
"@types/classnames": "^2.2.11"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
@@ -39,5 +40,5 @@
|
|
|
39
40
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
40
41
|
},
|
|
41
42
|
"nx": {},
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "7a032357e8f31abbf69e18aa6b7ef2d75e40f42e"
|
|
43
44
|
}
|