@salutejs/plasma-new-hope 0.194.0-canary.1565.11870784206.0 → 0.194.0-canary.1568.11891833298.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Switch/Switch.css +2 -2
- package/cjs/components/Switch/Switch.tokens.js +7 -1
- package/cjs/components/Switch/Switch.tokens.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/cjs/components/Switch/_toggleSize/base.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
- package/cjs/components/Switch/_view/base.js +1 -1
- package/cjs/components/Switch/_view/base.js.map +1 -1
- package/cjs/components/Switch/_view/base_15atbyp.css +1 -0
- package/cjs/components/TextField/TextField.js +3 -27
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/index.css +2 -2
- package/cjs/utils/constants.js +0 -4
- package/cjs/utils/constants.js.map +1 -1
- package/emotion/cjs/components/Card/Card.api.mdx +184 -0
- package/emotion/cjs/components/Switch/Switch.tokens.js +7 -1
- package/emotion/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/cjs/components/Switch/_view/base.js +1 -1
- package/emotion/cjs/components/TextField/TextField.js +4 -27
- package/emotion/cjs/components/TextField/TextField.template-doc.mdx +0 -330
- package/emotion/cjs/components/TextField/hooks/index.js +1 -8
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/emotion/cjs/utils/constants.js +2 -4
- package/emotion/es/components/Card/Card.api.mdx +184 -0
- package/emotion/es/components/Switch/Switch.tokens.js +7 -1
- package/emotion/es/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/es/components/Switch/_view/base.js +1 -1
- package/emotion/es/components/TextField/TextField.js +5 -28
- package/emotion/es/components/TextField/TextField.template-doc.mdx +0 -330
- package/emotion/es/components/TextField/hooks/index.js +1 -2
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_web/components/Switch/Switch.js +4 -1
- package/emotion/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
- package/emotion/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/es/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/emotion/es/utils/constants.js +1 -3
- package/es/components/Switch/Switch.css +2 -2
- package/es/components/Switch/Switch.tokens.js +7 -1
- package/es/components/Switch/Switch.tokens.js.map +1 -1
- package/es/components/Switch/_toggleSize/base.js +1 -1
- package/es/components/Switch/_toggleSize/base.js.map +1 -1
- package/es/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
- package/es/components/Switch/_view/base.js +1 -1
- package/es/components/Switch/_view/base.js.map +1 -1
- package/es/components/Switch/_view/base_15atbyp.css +1 -0
- package/es/components/TextField/TextField.js +3 -27
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/index.css +2 -2
- package/es/utils/constants.js +1 -3
- package/es/utils/constants.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Card/Card.api.mdx +184 -0
- package/styled-components/cjs/components/Switch/Switch.tokens.js +7 -1
- package/styled-components/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/cjs/components/Switch/_view/base.js +1 -1
- package/styled-components/cjs/components/TextField/TextField.js +3 -26
- package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +0 -330
- package/styled-components/cjs/components/TextField/hooks/index.js +1 -8
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/styled-components/cjs/utils/constants.js +2 -4
- package/styled-components/es/components/Card/Card.api.mdx +184 -0
- package/styled-components/es/components/Switch/Switch.tokens.js +7 -1
- package/styled-components/es/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/es/components/Switch/_view/base.js +1 -1
- package/styled-components/es/components/TextField/TextField.js +4 -27
- package/styled-components/es/components/TextField/TextField.template-doc.mdx +0 -330
- package/styled-components/es/components/TextField/hooks/index.js +1 -2
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.js +4 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/styled-components/es/utils/constants.js +1 -3
- package/types/components/Autocomplete/Autocomplete.types.d.ts +2 -2
- package/types/components/Autocomplete/Autocomplete.types.d.ts.map +1 -1
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts +92 -1676
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts +92 -1676
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts +92 -1676
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts.map +1 -1
- package/types/components/Range/Range.styles.d.ts +92 -1676
- package/types/components/Range/Range.styles.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +92 -1676
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.styles.d.ts +92 -1676
- package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -1
- package/types/components/Switch/Switch.tokens.d.ts +7 -1
- package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
- package/types/components/Switch/_toggleSize/base.d.ts.map +1 -1
- package/types/components/Switch/_view/base.d.ts.map +1 -1
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +1 -51
- package/types/components/TextField/TextField.types.d.ts.map +1 -1
- package/types/components/TextField/hooks/index.d.ts +0 -1
- package/types/components/TextField/hooks/index.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Autocomplete/Autocomplete.d.ts +2 -64
- package/types/examples/plasma_b2c/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts +92 -2732
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts +20 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts +30 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +92 -1676
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Autocomplete/Autocomplete.d.ts +2 -64
- package/types/examples/plasma_web/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Mask/Mask.d.ts +92 -2732
- package/types/examples/plasma_web/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.d.ts +20 -0
- package/types/examples/plasma_web/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts +30 -0
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/TextField/TextField.d.ts +92 -1676
- package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -1
- package/types/utils/constants.d.ts +0 -2
- package/types/utils/constants.d.ts.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/cjs/components/Switch/_view/base_yxkf3s.css +0 -1
- package/cjs/components/TextField/hooks/useValidation.js +0 -273
- package/cjs/components/TextField/hooks/useValidation.js.map +0 -1
- package/emotion/cjs/components/TextField/hooks/useValidation.js +0 -276
- package/emotion/es/components/TextField/hooks/useValidation.js +0 -270
- package/es/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/es/components/Switch/_view/base_yxkf3s.css +0 -1
- package/es/components/TextField/hooks/useValidation.js +0 -269
- package/es/components/TextField/hooks/useValidation.js.map +0 -1
- package/styled-components/cjs/components/TextField/hooks/useValidation.js +0 -276
- package/styled-components/es/components/TextField/hooks/useValidation.js +0 -270
- package/types/components/TextField/hooks/useValidation.d.ts +0 -7
- package/types/components/TextField/hooks/useValidation.d.ts.map +0 -1
@@ -5,9 +5,6 @@ title: TextField
|
|
5
5
|
|
6
6
|
import { PropsTable, Description } from '@site/src/components';
|
7
7
|
|
8
|
-
import Tabs from '@theme/Tabs';
|
9
|
-
import TabItem from '@theme/TabItem';
|
10
|
-
|
11
8
|
# TextField
|
12
9
|
<Description name="TextField" />
|
13
10
|
<PropsTable name="TextField" exclude={['$isFocused']} />
|
@@ -201,330 +198,3 @@ export function App() {
|
|
201
198
|
);
|
202
199
|
}
|
203
200
|
```
|
204
|
-
|
205
|
-
### Валидация
|
206
|
-
Поддерживается валидация почты и пароля:
|
207
|
-
|
208
|
-
<Tabs>
|
209
|
-
<TabItem value="email" label="Email" default>
|
210
|
-
Свойства доступные при валидации почты:
|
211
|
-
```tsx
|
212
|
-
type ValidationProps = {
|
213
|
-
/*
|
214
|
-
* Тип валидации
|
215
|
-
*/
|
216
|
-
validationType: 'email';
|
217
|
-
/*
|
218
|
-
* Опции валидации
|
219
|
-
*/
|
220
|
-
options?: EmailValidationOptions;
|
221
|
-
/*
|
222
|
-
* Функция, вызываемая при валидации значения.
|
223
|
-
* Вызывается при событии onBlur и по нажатию Enter, когда фокус на поле ввода
|
224
|
-
*/
|
225
|
-
onValidate?: (args: OnValidateArgs) => void;
|
226
|
-
}
|
227
|
-
```
|
228
|
-
Свойство `options` имеет следующий вид:
|
229
|
-
```tsx
|
230
|
-
type EmailValidationOptions = {
|
231
|
-
/*
|
232
|
-
* Пользовательское регулярное выражение, для проверки почты на валидность
|
233
|
-
*/
|
234
|
-
customEmailRegex?: {
|
235
|
-
value?: RegExp;
|
236
|
-
errorMessage?: string;
|
237
|
-
};
|
238
|
-
/*
|
239
|
-
* Минимальная длина почты
|
240
|
-
*/
|
241
|
-
minLength?: {
|
242
|
-
value?: number;
|
243
|
-
errorMessage?: string;
|
244
|
-
};
|
245
|
-
/*
|
246
|
-
* Максимальная длина почты
|
247
|
-
*/
|
248
|
-
maxLength?: {
|
249
|
-
value?: number;
|
250
|
-
errorMessage?: string;
|
251
|
-
};
|
252
|
-
/*
|
253
|
-
* Минимальная длина хоста (часть почты до `@`)
|
254
|
-
*/
|
255
|
-
minHostLength?: {
|
256
|
-
value?: number;
|
257
|
-
errorMessage?: string;
|
258
|
-
};
|
259
|
-
/*
|
260
|
-
* Максимальная длина хоста (часть почты до `@`)
|
261
|
-
*/
|
262
|
-
maxHostLength?: {
|
263
|
-
value?: number;
|
264
|
-
errorMessage?: string;
|
265
|
-
};
|
266
|
-
/*
|
267
|
-
* Минимальная длина домена (часть почты от `@` до `.` перед доменной зоной)
|
268
|
-
*/
|
269
|
-
minDomainLength?: {
|
270
|
-
value?: number;
|
271
|
-
errorMessage?: string;
|
272
|
-
};
|
273
|
-
/*
|
274
|
-
* Максимальная длина домена (часть почты от `@` до `.` перед доменной зоной)
|
275
|
-
*/
|
276
|
-
maxDomainLength?: {
|
277
|
-
value?: number;
|
278
|
-
errorMessage?: string;
|
279
|
-
};
|
280
|
-
/*
|
281
|
-
* Минимальная длина доменной зоны (часть почты от `.`; например `ru`, `com`...)
|
282
|
-
*/
|
283
|
-
minZoneLength?: {
|
284
|
-
value?: number;
|
285
|
-
errorMessage?: string;
|
286
|
-
};
|
287
|
-
/*
|
288
|
-
* Максимальная длина доменной зоны (часть почты от `.`; например `ru`, `com`...)
|
289
|
-
*/
|
290
|
-
maxZoneLength?: {
|
291
|
-
value?: number;
|
292
|
-
errorMessage?: string;
|
293
|
-
};
|
294
|
-
/*
|
295
|
-
* Список разрешенных доменов (например `['mail.ru', 'yahoo.ru', 'gmail.com']`)
|
296
|
-
*/
|
297
|
-
whitelistDomains?: {
|
298
|
-
value?: string[];
|
299
|
-
errorMessage?: string;
|
300
|
-
};
|
301
|
-
/*
|
302
|
-
* Список запрещенных доменов (например `['org.biz', 'expressmail.com']`)
|
303
|
-
*/
|
304
|
-
blacklistDomains?: {
|
305
|
-
value?: string[];
|
306
|
-
errorMessage?: string;
|
307
|
-
};
|
308
|
-
};
|
309
|
-
```
|
310
|
-
|
311
|
-
```tsx live
|
312
|
-
import React, { useState } from 'react';
|
313
|
-
import { TextField } from '@salutejs/{{ package }}';
|
314
|
-
|
315
|
-
export function App() {
|
316
|
-
const options = {
|
317
|
-
minLength: {
|
318
|
-
value: 7,
|
319
|
-
errorMessage: 'Почта слишком короткая',
|
320
|
-
},
|
321
|
-
maxLength: {
|
322
|
-
value: 30,
|
323
|
-
errorMessage: 'Почта слишком длинная',
|
324
|
-
},
|
325
|
-
minHostLength: {
|
326
|
-
value: 2,
|
327
|
-
errorMessage: 'Хост слишком короткий',
|
328
|
-
},
|
329
|
-
maxHostLength: {
|
330
|
-
value: 12,
|
331
|
-
errorMessage: 'Хост слишком длинный',
|
332
|
-
},
|
333
|
-
minDomainLength: {
|
334
|
-
value: 3,
|
335
|
-
errorMessage: 'Домен слишком короткий',
|
336
|
-
},
|
337
|
-
maxDomainLength: {
|
338
|
-
value: 6,
|
339
|
-
errorMessage: 'Домен слишком длинный',
|
340
|
-
},
|
341
|
-
minZoneLength: {
|
342
|
-
value: 2,
|
343
|
-
errorMessage: 'Доменная зона слишком короткая',
|
344
|
-
},
|
345
|
-
maxZoneLength: {
|
346
|
-
value: 5,
|
347
|
-
errorMessage: 'Доменная зона слишком длинная',
|
348
|
-
},
|
349
|
-
whitelistDomains: {
|
350
|
-
value: ['plasma.ru', 'gmail.com', 'mail.ru'],
|
351
|
-
errorMessage: 'Домен не разрешен',
|
352
|
-
},
|
353
|
-
blacklistDomains: {
|
354
|
-
value: ['hah.ah', 'heh.eh'],
|
355
|
-
errorMessage: 'Домен запрещен',
|
356
|
-
},
|
357
|
-
};
|
358
|
-
|
359
|
-
const [error, setError] = useState('');
|
360
|
-
|
361
|
-
const handleOnChange = () => {
|
362
|
-
setError('');
|
363
|
-
};
|
364
|
-
|
365
|
-
const handleOnValidate = ({ errorMessage }: { errorMessage?: string }) => {
|
366
|
-
setError(errorMessage || '');
|
367
|
-
};
|
368
|
-
|
369
|
-
return (
|
370
|
-
<div>
|
371
|
-
<TextField
|
372
|
-
label="Валидация почты"
|
373
|
-
placeholder="Заполните поле"
|
374
|
-
validationType="email"
|
375
|
-
options={options}
|
376
|
-
view={error ? 'negative' : 'default}
|
377
|
-
helperText={error || 'Валидация почты'}
|
378
|
-
onChange={handleOnChange}
|
379
|
-
onValidate={handleOnValidate}
|
380
|
-
/>
|
381
|
-
</div>
|
382
|
-
);
|
383
|
-
}
|
384
|
-
```
|
385
|
-
</TabItem>
|
386
|
-
|
387
|
-
<TabItem value="password" label="Password" default>
|
388
|
-
Свойства доступные при валидации пароля:
|
389
|
-
```tsx
|
390
|
-
type ValidationProps = {
|
391
|
-
/*
|
392
|
-
* Тип валидации
|
393
|
-
*/
|
394
|
-
validationType: 'password';
|
395
|
-
/*
|
396
|
-
* Опции валидации
|
397
|
-
*/
|
398
|
-
options?: PasswordValidationOptions;
|
399
|
-
/*
|
400
|
-
* Состояние сокрытия оригинального пароля
|
401
|
-
*/
|
402
|
-
passwordHidden?: boolean;
|
403
|
-
/*
|
404
|
-
* Функция, вызываемая при валидации значения.
|
405
|
-
* Вызывается при событии onBlur и по нажатию Enter, когда фокус на поле ввода
|
406
|
-
*/
|
407
|
-
onValidate?: (args: OnValidateArgs) => void;
|
408
|
-
}
|
409
|
-
```
|
410
|
-
Свойство `options` имеет следующий вид:
|
411
|
-
```tsx
|
412
|
-
type PasswordValidationOptions = {
|
413
|
-
/*
|
414
|
-
* Минимальная длина пароля
|
415
|
-
*/
|
416
|
-
minLength?: {
|
417
|
-
value?: number;
|
418
|
-
errorMessage?: string;
|
419
|
-
};
|
420
|
-
/*
|
421
|
-
* Максимальная длина пароля
|
422
|
-
*/
|
423
|
-
maxLength?: {
|
424
|
-
value?: number;
|
425
|
-
errorMessage?: string;
|
426
|
-
};
|
427
|
-
/*
|
428
|
-
* Должны ли быть буквы верхнего регистра в пароле
|
429
|
-
*/
|
430
|
-
includeUppercase?: {
|
431
|
-
value?: boolean;
|
432
|
-
errorMessage?: string;
|
433
|
-
};
|
434
|
-
/*
|
435
|
-
* Должны ли быть буквы нижнего регистра в пароле
|
436
|
-
*/
|
437
|
-
includeLowercase?: {
|
438
|
-
value?: boolean;
|
439
|
-
errorMessage?: string;
|
440
|
-
};
|
441
|
-
/*
|
442
|
-
* Должны ли быть цифры в пароле
|
443
|
-
*/
|
444
|
-
includeDigits?: {
|
445
|
-
value?: boolean;
|
446
|
-
errorMessage?: string;
|
447
|
-
};
|
448
|
-
/*
|
449
|
-
* Должны ли быть специальные символы в пароле
|
450
|
-
*/
|
451
|
-
includeSpecialSymbols?: {
|
452
|
-
value?: boolean;
|
453
|
-
errorMessage?: string;
|
454
|
-
};
|
455
|
-
};
|
456
|
-
```
|
457
|
-
|
458
|
-
```tsx live
|
459
|
-
import React, { useState } from 'react';
|
460
|
-
import { TextField, IconButton } from '@salutejs/{{ package }}';
|
461
|
-
import { IconEyeFill, IconEyeClosedFill } from '@salutejs/plasma-icons';
|
462
|
-
|
463
|
-
export function App() {
|
464
|
-
const options = {
|
465
|
-
minLength: {
|
466
|
-
value: 5,
|
467
|
-
errorMessage: 'Пароль слишком короткий',
|
468
|
-
},
|
469
|
-
maxLength: {
|
470
|
-
value: 20,
|
471
|
-
errorMessage: 'Пароль слишком длинный',
|
472
|
-
},
|
473
|
-
includeUppercase: {
|
474
|
-
value: true,
|
475
|
-
errorMessage: 'Пароль должен содержать хотя бы одну заглавную букву',
|
476
|
-
},
|
477
|
-
includeLowercase: {
|
478
|
-
value: true,
|
479
|
-
errorMessage: 'Пароль должен содержать хотя бы одну строчную букву',
|
480
|
-
},
|
481
|
-
includeDigits: {
|
482
|
-
value: true,
|
483
|
-
errorMessage: 'Пароль должен содержать хотя бы одну цифру',
|
484
|
-
},
|
485
|
-
includeSpecialSymbols: {
|
486
|
-
value: true,
|
487
|
-
errorMessage: 'Пароль должен содержать хотя бы один специальный символ',
|
488
|
-
},
|
489
|
-
};
|
490
|
-
|
491
|
-
const [error, setError] = useState('');
|
492
|
-
const [hidden, setHidden] = useState(false);
|
493
|
-
|
494
|
-
const handleOnChange = () => {
|
495
|
-
setError('');
|
496
|
-
};
|
497
|
-
|
498
|
-
const handleOnValidate = ({ errorMessage }: { errorMessage?: string }) => {
|
499
|
-
setError(errorMessage || '');
|
500
|
-
};
|
501
|
-
|
502
|
-
const toggleShowPassword = () => setHidden(!hidden);
|
503
|
-
|
504
|
-
const HideButton = () => (
|
505
|
-
<IconButton size="s" view="clear" onClick={toggleShowPassword}>
|
506
|
-
{hidden ? <IconEyeClosedFill size="xs" color="inherit" /> : <IconEyeFill size="xs" color="inherit" />}
|
507
|
-
</IconButton>
|
508
|
-
)
|
509
|
-
|
510
|
-
return (
|
511
|
-
<div>
|
512
|
-
<TextField
|
513
|
-
label="Валидация пароля"
|
514
|
-
placeholder="Заполните поле"
|
515
|
-
validationType="password"
|
516
|
-
options={options}
|
517
|
-
view={error ? 'negative' : 'default'}
|
518
|
-
leftHelper={error || 'Валидация пароля'}
|
519
|
-
onChange={handleOnChange}
|
520
|
-
onValidate={handleOnValidate}
|
521
|
-
passwordHidden={hidden}
|
522
|
-
contentLeft={<HideButton />}
|
523
|
-
/>
|
524
|
-
</div>
|
525
|
-
);
|
526
|
-
}
|
527
|
-
```
|
528
|
-
</TabItem>
|
529
|
-
</Tabs>
|
530
|
-
|
@@ -9,11 +9,4 @@ Object.defineProperty(exports, "useKeyNavigation", {
|
|
9
9
|
return _useKeyNavigation.useKeyNavigation;
|
10
10
|
}
|
11
11
|
});
|
12
|
-
|
13
|
-
enumerable: true,
|
14
|
-
get: function get() {
|
15
|
-
return _useValidation.useValidation;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
var _useKeyNavigation = /*#__PURE__*/require("./useKeyNavigation");
|
19
|
-
var _useValidation = /*#__PURE__*/require("./useValidation");
|
12
|
+
var _useKeyNavigation = /*#__PURE__*/require("./useKeyNavigation");
|