@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.
Files changed (158) hide show
  1. package/cjs/components/Switch/Switch.css +2 -2
  2. package/cjs/components/Switch/Switch.tokens.js +7 -1
  3. package/cjs/components/Switch/Switch.tokens.js.map +1 -1
  4. package/cjs/components/Switch/_toggleSize/base.js +1 -1
  5. package/cjs/components/Switch/_toggleSize/base.js.map +1 -1
  6. package/cjs/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
  7. package/cjs/components/Switch/_view/base.js +1 -1
  8. package/cjs/components/Switch/_view/base.js.map +1 -1
  9. package/cjs/components/Switch/_view/base_15atbyp.css +1 -0
  10. package/cjs/components/TextField/TextField.js +3 -27
  11. package/cjs/components/TextField/TextField.js.map +1 -1
  12. package/cjs/index.css +2 -2
  13. package/cjs/utils/constants.js +0 -4
  14. package/cjs/utils/constants.js.map +1 -1
  15. package/emotion/cjs/components/Switch/Switch.tokens.js +7 -1
  16. package/emotion/cjs/components/Switch/_toggleSize/base.js +1 -1
  17. package/emotion/cjs/components/Switch/_view/base.js +1 -1
  18. package/emotion/cjs/components/TextField/TextField.js +4 -27
  19. package/emotion/cjs/components/TextField/TextField.template-doc.mdx +0 -330
  20. package/emotion/cjs/components/TextField/hooks/index.js +1 -8
  21. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
  22. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
  23. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
  24. package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  25. package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
  26. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +8 -8
  27. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
  28. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
  29. package/emotion/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  30. package/emotion/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
  31. package/emotion/cjs/utils/constants.js +2 -4
  32. package/emotion/es/components/Switch/Switch.tokens.js +7 -1
  33. package/emotion/es/components/Switch/_toggleSize/base.js +1 -1
  34. package/emotion/es/components/Switch/_view/base.js +1 -1
  35. package/emotion/es/components/TextField/TextField.js +5 -28
  36. package/emotion/es/components/TextField/TextField.template-doc.mdx +0 -330
  37. package/emotion/es/components/TextField/hooks/index.js +1 -2
  38. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
  39. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
  40. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
  41. package/emotion/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  42. package/emotion/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
  43. package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +8 -8
  44. package/emotion/es/examples/plasma_web/components/Switch/Switch.js +4 -1
  45. package/emotion/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
  46. package/emotion/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  47. package/emotion/es/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
  48. package/emotion/es/utils/constants.js +1 -3
  49. package/es/components/Switch/Switch.css +2 -2
  50. package/es/components/Switch/Switch.tokens.js +7 -1
  51. package/es/components/Switch/Switch.tokens.js.map +1 -1
  52. package/es/components/Switch/_toggleSize/base.js +1 -1
  53. package/es/components/Switch/_toggleSize/base.js.map +1 -1
  54. package/es/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
  55. package/es/components/Switch/_view/base.js +1 -1
  56. package/es/components/Switch/_view/base.js.map +1 -1
  57. package/es/components/Switch/_view/base_15atbyp.css +1 -0
  58. package/es/components/TextField/TextField.js +3 -27
  59. package/es/components/TextField/TextField.js.map +1 -1
  60. package/es/index.css +2 -2
  61. package/es/utils/constants.js +1 -3
  62. package/es/utils/constants.js.map +1 -1
  63. package/package.json +2 -2
  64. package/styled-components/cjs/components/Switch/Switch.tokens.js +7 -1
  65. package/styled-components/cjs/components/Switch/_toggleSize/base.js +1 -1
  66. package/styled-components/cjs/components/Switch/_view/base.js +1 -1
  67. package/styled-components/cjs/components/TextField/TextField.js +3 -26
  68. package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +0 -330
  69. package/styled-components/cjs/components/TextField/hooks/index.js +1 -8
  70. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
  71. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
  72. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
  73. package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  74. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
  75. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +1 -1
  76. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
  77. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
  78. package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  79. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
  80. package/styled-components/cjs/utils/constants.js +2 -4
  81. package/styled-components/es/components/Switch/Switch.tokens.js +7 -1
  82. package/styled-components/es/components/Switch/_toggleSize/base.js +1 -1
  83. package/styled-components/es/components/Switch/_view/base.js +1 -1
  84. package/styled-components/es/components/TextField/TextField.js +4 -27
  85. package/styled-components/es/components/TextField/TextField.template-doc.mdx +0 -330
  86. package/styled-components/es/components/TextField/hooks/index.js +1 -2
  87. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
  88. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
  89. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
  90. package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
  91. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
  92. package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +1 -1
  93. package/styled-components/es/examples/plasma_web/components/Switch/Switch.js +4 -1
  94. package/styled-components/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
  95. package/styled-components/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
  96. package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
  97. package/styled-components/es/utils/constants.js +1 -3
  98. package/types/components/Autocomplete/Autocomplete.types.d.ts +2 -2
  99. package/types/components/Autocomplete/Autocomplete.types.d.ts.map +1 -1
  100. package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts +92 -1676
  101. package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts.map +1 -1
  102. package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts +92 -1676
  103. package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts.map +1 -1
  104. package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts +92 -1676
  105. package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts.map +1 -1
  106. package/types/components/Range/Range.styles.d.ts +92 -1676
  107. package/types/components/Range/Range.styles.d.ts.map +1 -1
  108. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +92 -1676
  109. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
  110. package/types/components/Slider/components/Double/Double.styles.d.ts +92 -1676
  111. package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -1
  112. package/types/components/Switch/Switch.tokens.d.ts +7 -1
  113. package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
  114. package/types/components/Switch/_toggleSize/base.d.ts.map +1 -1
  115. package/types/components/Switch/_view/base.d.ts.map +1 -1
  116. package/types/components/TextField/TextField.d.ts.map +1 -1
  117. package/types/components/TextField/TextField.types.d.ts +1 -51
  118. package/types/components/TextField/TextField.types.d.ts.map +1 -1
  119. package/types/components/TextField/hooks/index.d.ts +0 -1
  120. package/types/components/TextField/hooks/index.d.ts.map +1 -1
  121. package/types/examples/plasma_b2c/components/Autocomplete/Autocomplete.d.ts +2 -64
  122. package/types/examples/plasma_b2c/components/Autocomplete/Autocomplete.d.ts.map +1 -1
  123. package/types/examples/plasma_b2c/components/Mask/Mask.d.ts +92 -2732
  124. package/types/examples/plasma_b2c/components/Mask/Mask.d.ts.map +1 -1
  125. package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
  126. package/types/examples/plasma_b2c/components/Switch/Switch.d.ts +20 -0
  127. package/types/examples/plasma_b2c/components/Switch/Switch.d.ts.map +1 -1
  128. package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts +30 -0
  129. package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts.map +1 -0
  130. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +92 -1676
  131. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -1
  132. package/types/examples/plasma_web/components/Autocomplete/Autocomplete.d.ts +2 -64
  133. package/types/examples/plasma_web/components/Autocomplete/Autocomplete.d.ts.map +1 -1
  134. package/types/examples/plasma_web/components/Mask/Mask.d.ts +92 -2732
  135. package/types/examples/plasma_web/components/Mask/Mask.d.ts.map +1 -1
  136. package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
  137. package/types/examples/plasma_web/components/Switch/Switch.d.ts +20 -0
  138. package/types/examples/plasma_web/components/Switch/Switch.d.ts.map +1 -1
  139. package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts +30 -0
  140. package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts.map +1 -0
  141. package/types/examples/plasma_web/components/TextField/TextField.d.ts +92 -1676
  142. package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -1
  143. package/types/utils/constants.d.ts +0 -2
  144. package/types/utils/constants.d.ts.map +1 -1
  145. package/cjs/components/Switch/_toggleSize/base_6i0904.css +0 -1
  146. package/cjs/components/Switch/_view/base_yxkf3s.css +0 -1
  147. package/cjs/components/TextField/hooks/useValidation.js +0 -273
  148. package/cjs/components/TextField/hooks/useValidation.js.map +0 -1
  149. package/emotion/cjs/components/TextField/hooks/useValidation.js +0 -276
  150. package/emotion/es/components/TextField/hooks/useValidation.js +0 -270
  151. package/es/components/Switch/_toggleSize/base_6i0904.css +0 -1
  152. package/es/components/Switch/_view/base_yxkf3s.css +0 -1
  153. package/es/components/TextField/hooks/useValidation.js +0 -269
  154. package/es/components/TextField/hooks/useValidation.js.map +0 -1
  155. package/styled-components/cjs/components/TextField/hooks/useValidation.js +0 -276
  156. package/styled-components/es/components/TextField/hooks/useValidation.js +0 -270
  157. package/types/components/TextField/hooks/useValidation.d.ts +0 -7
  158. 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
-
@@ -1,2 +1 @@
1
- export { useKeyNavigation } from './useKeyNavigation';
2
- export { useValidation } from './useValidation';
1
+ export { useKeyNavigation } from './useKeyNavigation';