@salutejs/plasma-new-hope 0.194.0-canary.1565.11870784206.0 → 0.194.0-dev.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/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/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/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/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");
|
@@ -25,7 +25,7 @@ var config = exports.config = {
|
|
25
25
|
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":1rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], _Switch.switchTokens.trackWidth, _Switch.switchTokens.trackHeight, _Switch.switchTokens.trackBorderRadius, _Switch.switchTokens.trackHeight, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbBorderRadius, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbOffset, _Switch.switchTokens.thumbPressScale)
|
26
26
|
},
|
27
27
|
view: {
|
28
|
-
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.
|
28
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":var(--surface-accent);", ":var(--surface-accent-hover);", ":var(--surface-transparent-tertiary);", ":var(--surface-transparent-tertiary-hover);", ":0rem;", ":var(--on-dark-surface-solid-default);", ":var(--on-dark-surface-solid-default);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBackgroundColorOn, _Switch.switchTokens.trackBackgroundColorOnHover, _Switch.switchTokens.trackBackgroundColorOff, _Switch.switchTokens.trackBackgroundColorOffHover, _Switch.switchTokens.trackBorderWidth, _Switch.switchTokens.thumbBackgroundColorOff, _Switch.switchTokens.thumbBackgroundColorOn, _Switch.switchTokens.thumbBoxShadow)
|
29
29
|
},
|
30
30
|
disabled: {
|
31
31
|
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _Switch.switchTokens.disabledOpacity)
|
@@ -3,9 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.Switch = void 0;
|
6
|
+
exports.SwitchOutline = exports.Switch = void 0;
|
7
7
|
var _Switch = /*#__PURE__*/require("../../../../components/Switch");
|
8
8
|
var _engines = /*#__PURE__*/require("../../../../engines");
|
9
9
|
var _Switch2 = /*#__PURE__*/require("./Switch.config");
|
10
|
+
var _SwitchOutline = /*#__PURE__*/require("./Switch.outline.config");
|
10
11
|
var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Switch.switchConfig, _Switch2.config);
|
11
|
-
var Switch = exports.Switch = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
12
|
+
var Switch = exports.Switch = /*#__PURE__*/(0, _engines.component)(mergedConfig);
|
13
|
+
var mergedOutlineConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Switch.switchConfig, _SwitchOutline.config);
|
14
|
+
var SwitchOutline = exports.SwitchOutline = /*#__PURE__*/(0, _engines.component)(mergedOutlineConfig);
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.config = void 0;
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
8
|
+
var _Switch = /*#__PURE__*/require("../../../../components/Switch");
|
9
|
+
var config = exports.config = {
|
10
|
+
defaults: {
|
11
|
+
view: 'default',
|
12
|
+
size: 'm',
|
13
|
+
toggleSize: 'l',
|
14
|
+
labelPosition: 'before',
|
15
|
+
focused: 'true'
|
16
|
+
},
|
17
|
+
variations: {
|
18
|
+
size: {
|
19
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-letter-spacing);", ":0.25rem;", ":0.75rem;"], _Switch.switchTokens.fontFamily, _Switch.switchTokens.fontStyle, _Switch.switchTokens.fontWeight, _Switch.switchTokens.lineHeight, _Switch.switchTokens.fontSize, _Switch.switchTokens.letterSpacing, _Switch.switchTokens.descriptionFontFamily, _Switch.switchTokens.descriptionFontStyle, _Switch.switchTokens.descriptionFontWeight, _Switch.switchTokens.descriptionLineHeight, _Switch.switchTokens.descriptionFontSize, _Switch.switchTokens.descriptionLetterSpacing, _Switch.switchTokens.verticalGap, _Switch.switchTokens.labelOffset),
|
20
|
+
m: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-xs-letter-spacing);", ":0.25rem;", ":0.75rem;"], _Switch.switchTokens.fontFamily, _Switch.switchTokens.fontStyle, _Switch.switchTokens.fontWeight, _Switch.switchTokens.lineHeight, _Switch.switchTokens.fontSize, _Switch.switchTokens.letterSpacing, _Switch.switchTokens.descriptionFontFamily, _Switch.switchTokens.descriptionFontStyle, _Switch.switchTokens.descriptionFontWeight, _Switch.switchTokens.descriptionLineHeight, _Switch.switchTokens.descriptionFontSize, _Switch.switchTokens.descriptionLetterSpacing, _Switch.switchTokens.verticalGap, _Switch.switchTokens.labelOffset),
|
21
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-xs-letter-spacing);", ":0.25rem;", ":0.75rem;"], _Switch.switchTokens.fontFamily, _Switch.switchTokens.fontStyle, _Switch.switchTokens.fontWeight, _Switch.switchTokens.lineHeight, _Switch.switchTokens.fontSize, _Switch.switchTokens.letterSpacing, _Switch.switchTokens.descriptionFontFamily, _Switch.switchTokens.descriptionFontStyle, _Switch.switchTokens.descriptionFontWeight, _Switch.switchTokens.descriptionLineHeight, _Switch.switchTokens.descriptionFontSize, _Switch.switchTokens.descriptionLetterSpacing, _Switch.switchTokens.verticalGap, _Switch.switchTokens.labelOffset)
|
22
|
+
},
|
23
|
+
toggleSize: {
|
24
|
+
l: /*#__PURE__*/(0, _styledComponents.css)(["", ":2.75rem;", ":1.75rem;", ":calc(var(", ") / 2);", ":1.375rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], _Switch.switchTokens.trackWidth, _Switch.switchTokens.trackHeight, _Switch.switchTokens.trackBorderRadius, _Switch.switchTokens.trackHeight, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbBorderRadius, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbOffset, _Switch.switchTokens.thumbPressScale),
|
25
|
+
s: /*#__PURE__*/(0, _styledComponents.css)(["", ":2rem;", ":1.25rem;", ":calc(var(", ") / 2);", ":0.875rem;", ":calc(var(", ") / 2);", ":0.125rem;", ":1.25;"], _Switch.switchTokens.trackWidth, _Switch.switchTokens.trackHeight, _Switch.switchTokens.trackBorderRadius, _Switch.switchTokens.trackHeight, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbBorderRadius, _Switch.switchTokens.thumbSize, _Switch.switchTokens.thumbOffset, _Switch.switchTokens.thumbPressScale)
|
26
|
+
},
|
27
|
+
view: {
|
28
|
+
"default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--text-primary);", ":var(--text-secondary);", ":0.0625rem;", ":var(--outline-secondary);", ":var(--outline-secondary-hover);", ":var(--outline-accent);", ":var(--outline-accent-hover);", ":var(--text-tertiary);", ":var(--text-accent);", ":0 1px 1px rgba(0,0,0,0.11);"], _Switch.switchTokens.labelColor, _Switch.switchTokens.descriptionColor, _Switch.switchTokens.trackBorderWidth, _Switch.switchTokens.trackBorderColorOff, _Switch.switchTokens.trackBorderColorOffHover, _Switch.switchTokens.trackBorderColorOn, _Switch.switchTokens.trackBorderColorOnHover, _Switch.switchTokens.thumbBackgroundColorOff, _Switch.switchTokens.thumbBackgroundColorOn, _Switch.switchTokens.thumbBoxShadow)
|
29
|
+
},
|
30
|
+
disabled: {
|
31
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":0.4;"], _Switch.switchTokens.disabledOpacity)
|
32
|
+
},
|
33
|
+
focused: {
|
34
|
+
"true": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--surface-accent);"], _Switch.switchTokens.trackFocusColor)
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
@@ -9,7 +9,7 @@ import { mergeConfig } from '../../../../engines';
|
|
9
9
|
import { WithTheme, argTypesFromConfig } from '../../../_helpers';
|
10
10
|
|
11
11
|
import { config } from './Switch.config';
|
12
|
-
import { Switch } from './Switch';
|
12
|
+
import { Switch, SwitchOutline } from './Switch';
|
13
13
|
|
14
14
|
type SwitchProps = ComponentProps<typeof Switch>;
|
15
15
|
|
@@ -72,3 +72,35 @@ export const Default: StoryObj<SwitchProps> = {
|
|
72
72
|
},
|
73
73
|
render: (args) => <StoryDefault {...args} />,
|
74
74
|
};
|
75
|
+
|
76
|
+
const StoryOutline = (args: SwitchProps) => {
|
77
|
+
const value = 'yes';
|
78
|
+
const name = 'agree';
|
79
|
+
const [checked, setChecked] = useState(true);
|
80
|
+
|
81
|
+
return (
|
82
|
+
<StyledWrapper>
|
83
|
+
<SwitchOutline
|
84
|
+
value={value}
|
85
|
+
name={name}
|
86
|
+
checked={checked}
|
87
|
+
onChange={(event) => {
|
88
|
+
setChecked(event.target.checked);
|
89
|
+
onChange(event);
|
90
|
+
}}
|
91
|
+
onFocus={onFocus}
|
92
|
+
onBlur={onBlur}
|
93
|
+
{...args}
|
94
|
+
/>
|
95
|
+
</StyledWrapper>
|
96
|
+
);
|
97
|
+
};
|
98
|
+
|
99
|
+
export const Outline: StoryObj<SwitchProps> = {
|
100
|
+
args: {
|
101
|
+
size: 'm',
|
102
|
+
toggleSize: 'l',
|
103
|
+
disabled: false,
|
104
|
+
},
|
105
|
+
render: (args) => <StoryOutline {...args} />,
|
106
|
+
};
|