@true-engineering/true-react-common-ui-kit 3.41.0 → 3.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +7 -0
  3. package/dist/components/FiltersPane/FiltersPane.stories.d.ts +2 -1
  4. package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +1 -1
  5. package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
  6. package/dist/components/FiltersPane/types.d.ts +1 -0
  7. package/dist/components/Input/Input.styles.d.ts +1 -1
  8. package/dist/components/SearchInput/SearchInput.stories.d.ts +1 -1
  9. package/dist/components/Select/Select.styles.d.ts +3 -3
  10. package/dist/true-react-common-ui-kit.js +74 -59
  11. package/dist/true-react-common-ui-kit.js.map +1 -1
  12. package/dist/true-react-common-ui-kit.umd.cjs +74 -59
  13. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  14. package/package.json +99 -98
  15. package/src/components/AccountInfo/AccountInfo.stories.tsx +32 -32
  16. package/src/components/AccountInfo/AccountInfo.tsx +80 -80
  17. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  18. package/src/components/AddButton/AddButton.tsx +52 -52
  19. package/src/components/Colors/Colors.stories.tsx +7 -7
  20. package/src/components/DateInput/DateInput.tsx +90 -90
  21. package/src/components/DateInput/constants.ts +2 -2
  22. package/src/components/Description/Description.stories.tsx +27 -27
  23. package/src/components/Description/Description.tsx +61 -61
  24. package/src/components/FiltersPane/FiltersPane.stories.tsx +12 -0
  25. package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +166 -166
  26. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +210 -210
  27. package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +177 -177
  28. package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.ts +4 -0
  29. package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.tsx +20 -2
  30. package/src/components/FiltersPane/types.ts +1 -0
  31. package/src/components/Flag/Flag.stories.tsx +29 -29
  32. package/src/components/Flag/Flag.tsx +26 -26
  33. package/src/components/Flag/augment.d.ts +1 -1
  34. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +25 -25
  35. package/src/components/Icon/Icon.stories.tsx +86 -86
  36. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  37. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  38. package/src/components/Icon/complexIcons/index.ts +1 -1
  39. package/src/components/IncrementInput/IncrementInput.tsx +105 -105
  40. package/src/components/Input/types.ts +32 -32
  41. package/src/components/Modal/Modal.stories.tsx +105 -105
  42. package/src/components/MoreMenu/MoreMenu.tsx +93 -93
  43. package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -46
  44. package/src/components/MultiSelect/MultiSelect.tsx +106 -106
  45. package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +53 -53
  46. package/src/components/Notification/Notification.stories.tsx +55 -55
  47. package/src/components/Notification/Notification.styles.ts +57 -57
  48. package/src/components/Notification/Notification.tsx +77 -77
  49. package/src/components/Notification/types.ts +1 -1
  50. package/src/components/NumberInput/NumberInput.tsx +137 -137
  51. package/src/components/NumberInput/index.ts +1 -1
  52. package/src/components/PhoneInput/PhoneInput.tsx +214 -214
  53. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +155 -155
  54. package/src/components/PhoneInput/types.ts +16 -16
  55. package/src/components/RadioButton/RadioButton.stories.tsx +46 -46
  56. package/src/components/RadioButton/RadioButton.tsx +57 -57
  57. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  58. package/src/components/Select/constants.ts +2 -2
  59. package/src/components/Select/types.ts +1 -1
  60. package/src/components/Selector/Selector.stories.tsx +62 -62
  61. package/src/components/Selector/Selector.tsx +115 -115
  62. package/src/components/Selector/index.ts +2 -2
  63. package/src/components/Selector/types.ts +12 -12
  64. package/src/components/Skeleton/Skeleton.stories.tsx +19 -19
  65. package/src/components/SmartInput/SmartInput.stories.tsx +52 -52
  66. package/src/components/SmartInput/SmartInput.tsx +116 -116
  67. package/src/components/SmartInput/constants.ts +91 -91
  68. package/src/components/SmartInput/helpers.ts +26 -26
  69. package/src/components/SmartInput/types.ts +18 -18
  70. package/src/components/Status/Status.stories.tsx +73 -73
  71. package/src/components/Status/Status.styles.ts +143 -143
  72. package/src/components/Status/Status.tsx +49 -49
  73. package/src/components/Status/constants.ts +11 -11
  74. package/src/components/Status/index.ts +3 -3
  75. package/src/components/Status/types.ts +5 -5
  76. package/src/components/Switch/Switch.stories.tsx +40 -40
  77. package/src/components/Switch/Switch.tsx +75 -75
  78. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -53
  79. package/src/components/TextWithInfo/TextWithInfo.tsx +62 -62
  80. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  81. package/src/components/TextWithTooltip/TextWithTooltip.tsx +156 -156
  82. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -41
  83. package/src/components/ThemedPreloader/ThemedPreloader.tsx +54 -54
  84. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  85. package/src/components/Toaster/Toaster.stories.tsx +30 -30
  86. package/src/components/Tooltip/Tooltip.stories.tsx +19 -19
  87. package/src/components/Tooltip/Tooltip.tsx +35 -35
  88. package/src/components/Tooltip/types.ts +1 -1
  89. package/src/components/WithPopup/WithPopup.styles.ts +45 -45
  90. package/src/components/WithPopup/WithPopup.tsx +184 -184
  91. package/src/components/WithTooltip/WithTooltip.stories.tsx +56 -56
  92. package/src/components/WithTooltip/WithTooltip.styles.ts +7 -7
  93. package/src/components/WithTooltip/WithTooltip.tsx +67 -67
  94. package/src/components/WithTooltip/index.ts +2 -2
  95. package/src/components/index.ts +46 -46
  96. package/src/helpers/popper-helpers.ts +17 -17
  97. package/src/hooks/use-dropdown.ts +84 -84
  98. package/src/hooks/use-is-mounted.ts +15 -15
  99. package/src/theme/helpers.ts +76 -76
  100. package/src/theme/types.ts +158 -158
  101. package/src/vite-env.d.ts +1 -1
@@ -1,116 +1,116 @@
1
- import { ClipboardEvent, FormEvent, forwardRef, useRef } from 'react';
2
- import { isEmpty, isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
- import { useMergedRefs } from '../../hooks';
4
- import { IInputProps, Input } from '../Input';
5
- import {
6
- CharactersMap,
7
- EmailCharactersMap,
8
- SMART_INPUT_REGEX_MAP,
9
- TransliterationMap,
10
- } from './constants';
11
- import { mapSymbols } from './helpers';
12
- import { IInputRawValue, ISmartType } from './types';
13
-
14
- export interface ISmartInputProps extends Omit<IInputProps, 'onChange'> {
15
- /** @default 'default' */
16
- smartType?: ISmartType;
17
- regExp?: RegExp;
18
- /** @default false */
19
- isUpperCase?: boolean;
20
- /** @default true */
21
- isTransliterationEnabled?: boolean;
22
- onChange: (
23
- value: string,
24
- rawValue: IInputRawValue,
25
- event?: FormEvent<HTMLInputElement> | ClipboardEvent<HTMLInputElement>,
26
- ) => void;
27
- }
28
-
29
- export const SmartInput = forwardRef<HTMLInputElement, ISmartInputProps>(
30
- (
31
- {
32
- value = '',
33
- smartType = 'default',
34
- regExp,
35
- maxLength,
36
- isUpperCase = false,
37
- isTransliterationEnabled = true,
38
- onChange,
39
- ...rest
40
- },
41
- ref,
42
- ) => {
43
- const inputRef = useRef<HTMLInputElement>(null);
44
- const mergedRef = useMergedRefs([ref, inputRef]);
45
-
46
- const regex = regExp || SMART_INPUT_REGEX_MAP[smartType];
47
-
48
- const getUpperCaseIfNeeded = (str: string) => (isUpperCase ? str.toUpperCase() : str);
49
-
50
- const updateCaretPosition = (position: number | null, newValue: string) => {
51
- const input = inputRef.current;
52
- if (isNotEmpty(input) && input.type !== 'email') {
53
- // Нужно для того, чтобы после ререндера позиция каретки не сбросилась
54
- input.value = newValue;
55
- input.setSelectionRange(position, position);
56
- }
57
- };
58
-
59
- const handleChange = async (str: string, event: FormEvent<HTMLInputElement>) => {
60
- const isValid = regex.test(str);
61
-
62
- const charactersMap = smartType === 'email' ? EmailCharactersMap : CharactersMap;
63
- const newValue = getUpperCaseIfNeeded(
64
- isValid ? str : mapSymbols(str, regex, charactersMap, isTransliterationEnabled),
65
- );
66
-
67
- onChange(newValue, { rawValue: str, isValid }, event);
68
-
69
- const input = inputRef.current;
70
- if (isNotEmpty(input)) {
71
- const start = input.selectionStart;
72
- updateCaretPosition(isEmpty(start) || newValue !== value ? start : start - 1, newValue);
73
- }
74
- };
75
-
76
- const handlePaste = async (event: ClipboardEvent<HTMLInputElement>) => {
77
- event.preventDefault();
78
-
79
- const str = event.clipboardData.getData('text/plain').split('').join('');
80
-
81
- const input = event.currentTarget;
82
- const selectionStart = input.selectionStart ?? 0;
83
- const selectionEnd = input.selectionEnd ?? 0;
84
-
85
- const isValid = regex.test(str);
86
-
87
- let mappedValue = isValid
88
- ? str
89
- : mapSymbols(str, regex, TransliterationMap, isTransliterationEnabled);
90
-
91
- const newValueLength = mappedValue.length + value.length - (selectionEnd - selectionStart);
92
-
93
- if (isNotEmpty(maxLength) && maxLength >= 0 && newValueLength > maxLength) {
94
- mappedValue = mappedValue.substring(0, mappedValue.length - (newValueLength - maxLength));
95
- }
96
-
97
- const newValue = getUpperCaseIfNeeded(
98
- `${value.substring(0, selectionStart)}${mappedValue}${value.substring(selectionEnd)}`,
99
- );
100
-
101
- onChange(newValue, { rawValue: str, isValid }, event);
102
- updateCaretPosition(selectionStart + mappedValue.length, newValue);
103
- };
104
-
105
- return (
106
- <Input
107
- {...rest}
108
- ref={mergedRef}
109
- value={value}
110
- maxLength={maxLength}
111
- onPaste={handlePaste}
112
- onChange={handleChange}
113
- />
114
- );
115
- },
116
- );
1
+ import { ClipboardEvent, FormEvent, forwardRef, useRef } from 'react';
2
+ import { isEmpty, isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
+ import { useMergedRefs } from '../../hooks';
4
+ import { IInputProps, Input } from '../Input';
5
+ import {
6
+ CharactersMap,
7
+ EmailCharactersMap,
8
+ SMART_INPUT_REGEX_MAP,
9
+ TransliterationMap,
10
+ } from './constants';
11
+ import { mapSymbols } from './helpers';
12
+ import { IInputRawValue, ISmartType } from './types';
13
+
14
+ export interface ISmartInputProps extends Omit<IInputProps, 'onChange'> {
15
+ /** @default 'default' */
16
+ smartType?: ISmartType;
17
+ regExp?: RegExp;
18
+ /** @default false */
19
+ isUpperCase?: boolean;
20
+ /** @default true */
21
+ isTransliterationEnabled?: boolean;
22
+ onChange: (
23
+ value: string,
24
+ rawValue: IInputRawValue,
25
+ event?: FormEvent<HTMLInputElement> | ClipboardEvent<HTMLInputElement>,
26
+ ) => void;
27
+ }
28
+
29
+ export const SmartInput = forwardRef<HTMLInputElement, ISmartInputProps>(
30
+ (
31
+ {
32
+ value = '',
33
+ smartType = 'default',
34
+ regExp,
35
+ maxLength,
36
+ isUpperCase = false,
37
+ isTransliterationEnabled = true,
38
+ onChange,
39
+ ...rest
40
+ },
41
+ ref,
42
+ ) => {
43
+ const inputRef = useRef<HTMLInputElement>(null);
44
+ const mergedRef = useMergedRefs([ref, inputRef]);
45
+
46
+ const regex = regExp || SMART_INPUT_REGEX_MAP[smartType];
47
+
48
+ const getUpperCaseIfNeeded = (str: string) => (isUpperCase ? str.toUpperCase() : str);
49
+
50
+ const updateCaretPosition = (position: number | null, newValue: string) => {
51
+ const input = inputRef.current;
52
+ if (isNotEmpty(input) && input.type !== 'email') {
53
+ // Нужно для того, чтобы после ререндера позиция каретки не сбросилась
54
+ input.value = newValue;
55
+ input.setSelectionRange(position, position);
56
+ }
57
+ };
58
+
59
+ const handleChange = async (str: string, event: FormEvent<HTMLInputElement>) => {
60
+ const isValid = regex.test(str);
61
+
62
+ const charactersMap = smartType === 'email' ? EmailCharactersMap : CharactersMap;
63
+ const newValue = getUpperCaseIfNeeded(
64
+ isValid ? str : mapSymbols(str, regex, charactersMap, isTransliterationEnabled),
65
+ );
66
+
67
+ onChange(newValue, { rawValue: str, isValid }, event);
68
+
69
+ const input = inputRef.current;
70
+ if (isNotEmpty(input)) {
71
+ const start = input.selectionStart;
72
+ updateCaretPosition(isEmpty(start) || newValue !== value ? start : start - 1, newValue);
73
+ }
74
+ };
75
+
76
+ const handlePaste = async (event: ClipboardEvent<HTMLInputElement>) => {
77
+ event.preventDefault();
78
+
79
+ const str = event.clipboardData.getData('text/plain').split('').join('');
80
+
81
+ const input = event.currentTarget;
82
+ const selectionStart = input.selectionStart ?? 0;
83
+ const selectionEnd = input.selectionEnd ?? 0;
84
+
85
+ const isValid = regex.test(str);
86
+
87
+ let mappedValue = isValid
88
+ ? str
89
+ : mapSymbols(str, regex, TransliterationMap, isTransliterationEnabled);
90
+
91
+ const newValueLength = mappedValue.length + value.length - (selectionEnd - selectionStart);
92
+
93
+ if (isNotEmpty(maxLength) && maxLength >= 0 && newValueLength > maxLength) {
94
+ mappedValue = mappedValue.substring(0, mappedValue.length - (newValueLength - maxLength));
95
+ }
96
+
97
+ const newValue = getUpperCaseIfNeeded(
98
+ `${value.substring(0, selectionStart)}${mappedValue}${value.substring(selectionEnd)}`,
99
+ );
100
+
101
+ onChange(newValue, { rawValue: str, isValid }, event);
102
+ updateCaretPosition(selectionStart + mappedValue.length, newValue);
103
+ };
104
+
105
+ return (
106
+ <Input
107
+ {...rest}
108
+ ref={mergedRef}
109
+ value={value}
110
+ maxLength={maxLength}
111
+ onPaste={handlePaste}
112
+ onChange={handleChange}
113
+ />
114
+ );
115
+ },
116
+ );
@@ -1,91 +1,91 @@
1
- import { ICharactersMap } from './types';
2
-
3
- export const SMART_INPUT_REGEX_MAP = {
4
- default: /./i,
5
- agencyName: /^[a-zA-Z\s0-9-]*$/i,
6
- surname: /^[a-zA-Z\s-]*$/i,
7
- name: /^[a-zA-Z\s-.`']*$/i,
8
- surnameRuEn: /^[a-zA-Zа-яА-Я\s-]*$/i,
9
- nameRuEn: /^[a-zA-Zа-яА-Я\s-.`']*$/i,
10
- email: /^[a-zA-Z0-9@_\-.+']*$/i,
11
- digits: /^[0-9]*$/i,
12
- docNumber: /^[a-zA-Z0-9]*$/i,
13
- benefitCert: /^[a-zA-Z0-9/]*$/i,
14
- };
15
-
16
- export const CharactersMap: ICharactersMap = {
17
- й: 'q',
18
- ц: 'w',
19
- у: 'e',
20
- к: 'r',
21
- е: 't',
22
- н: 'y',
23
- г: 'u',
24
- ш: 'i',
25
- щ: 'o',
26
- з: 'p',
27
- х: '[',
28
- ъ: ']',
29
- ф: 'a',
30
- ы: 's',
31
- в: 'd',
32
- а: 'f',
33
- п: 'g',
34
- р: 'h',
35
- о: 'j',
36
- л: 'k',
37
- д: 'l',
38
- ж: ';',
39
- э: "'",
40
- я: 'z',
41
- ч: 'x',
42
- с: 'c',
43
- м: 'v',
44
- и: 'b',
45
- т: 'n',
46
- ь: 'm',
47
- б: ',',
48
- ю: '.',
49
- ё: '`',
50
- };
51
-
52
- export const EmailCharactersMap: ICharactersMap = {
53
- ...CharactersMap,
54
- '"': '@',
55
- };
56
-
57
- export const TransliterationMap: ICharactersMap = {
58
- й: 'i',
59
- ц: 'ts',
60
- у: 'u',
61
- к: 'k',
62
- е: 'e',
63
- н: 'n',
64
- г: 'g',
65
- ш: 'sh',
66
- щ: 'shch',
67
- з: 'z',
68
- х: 'h',
69
- ъ: 'ie',
70
- ф: 'f',
71
- ы: 'y',
72
- в: 'v',
73
- а: 'a',
74
- п: 'p',
75
- р: 'r',
76
- о: 'o',
77
- л: 'l',
78
- д: 'd',
79
- ж: 'zh',
80
- э: 'e',
81
- я: 'ia',
82
- ч: 'ch',
83
- с: 's',
84
- м: 'm',
85
- и: 'i',
86
- т: 't',
87
- ь: '',
88
- б: 'b',
89
- ю: 'iu',
90
- ё: 'e',
91
- };
1
+ import { ICharactersMap } from './types';
2
+
3
+ export const SMART_INPUT_REGEX_MAP = {
4
+ default: /./i,
5
+ agencyName: /^[a-zA-Z\s0-9-]*$/i,
6
+ surname: /^[a-zA-Z\s-]*$/i,
7
+ name: /^[a-zA-Z\s-.`']*$/i,
8
+ surnameRuEn: /^[a-zA-Zа-яА-Я\s-]*$/i,
9
+ nameRuEn: /^[a-zA-Zа-яА-Я\s-.`']*$/i,
10
+ email: /^[a-zA-Z0-9@_\-.+']*$/i,
11
+ digits: /^[0-9]*$/i,
12
+ docNumber: /^[a-zA-Z0-9]*$/i,
13
+ benefitCert: /^[a-zA-Z0-9/]*$/i,
14
+ };
15
+
16
+ export const CharactersMap: ICharactersMap = {
17
+ й: 'q',
18
+ ц: 'w',
19
+ у: 'e',
20
+ к: 'r',
21
+ е: 't',
22
+ н: 'y',
23
+ г: 'u',
24
+ ш: 'i',
25
+ щ: 'o',
26
+ з: 'p',
27
+ х: '[',
28
+ ъ: ']',
29
+ ф: 'a',
30
+ ы: 's',
31
+ в: 'd',
32
+ а: 'f',
33
+ п: 'g',
34
+ р: 'h',
35
+ о: 'j',
36
+ л: 'k',
37
+ д: 'l',
38
+ ж: ';',
39
+ э: "'",
40
+ я: 'z',
41
+ ч: 'x',
42
+ с: 'c',
43
+ м: 'v',
44
+ и: 'b',
45
+ т: 'n',
46
+ ь: 'm',
47
+ б: ',',
48
+ ю: '.',
49
+ ё: '`',
50
+ };
51
+
52
+ export const EmailCharactersMap: ICharactersMap = {
53
+ ...CharactersMap,
54
+ '"': '@',
55
+ };
56
+
57
+ export const TransliterationMap: ICharactersMap = {
58
+ й: 'i',
59
+ ц: 'ts',
60
+ у: 'u',
61
+ к: 'k',
62
+ е: 'e',
63
+ н: 'n',
64
+ г: 'g',
65
+ ш: 'sh',
66
+ щ: 'shch',
67
+ з: 'z',
68
+ х: 'h',
69
+ ъ: 'ie',
70
+ ф: 'f',
71
+ ы: 'y',
72
+ в: 'v',
73
+ а: 'a',
74
+ п: 'p',
75
+ р: 'r',
76
+ о: 'o',
77
+ л: 'l',
78
+ д: 'd',
79
+ ж: 'zh',
80
+ э: 'e',
81
+ я: 'ia',
82
+ ч: 'ch',
83
+ с: 's',
84
+ м: 'm',
85
+ и: 'i',
86
+ т: 't',
87
+ ь: '',
88
+ б: 'b',
89
+ ю: 'iu',
90
+ ё: 'e',
91
+ };
@@ -1,26 +1,26 @@
1
- import { ICharactersMap } from './types';
2
-
3
- export const mapSymbols = (
4
- str: string,
5
- regex: RegExp,
6
- charactersMap: ICharactersMap,
7
- isTransliterationEnabled: boolean,
8
- ): string =>
9
- str
10
- .split('')
11
- .map((symbol) => {
12
- if (regex.test(symbol)) {
13
- return symbol;
14
- }
15
- if (!isTransliterationEnabled) {
16
- return '';
17
- }
18
-
19
- const mappedSymbol = charactersMap[symbol.toLowerCase()] ?? symbol;
20
-
21
- const isUpperCase = symbol.toUpperCase() === symbol;
22
- const result = isUpperCase ? mappedSymbol.toUpperCase() : mappedSymbol;
23
-
24
- return regex.test(result) ? result : '';
25
- })
26
- .join('');
1
+ import { ICharactersMap } from './types';
2
+
3
+ export const mapSymbols = (
4
+ str: string,
5
+ regex: RegExp,
6
+ charactersMap: ICharactersMap,
7
+ isTransliterationEnabled: boolean,
8
+ ): string =>
9
+ str
10
+ .split('')
11
+ .map((symbol) => {
12
+ if (regex.test(symbol)) {
13
+ return symbol;
14
+ }
15
+ if (!isTransliterationEnabled) {
16
+ return '';
17
+ }
18
+
19
+ const mappedSymbol = charactersMap[symbol.toLowerCase()] ?? symbol;
20
+
21
+ const isUpperCase = symbol.toUpperCase() === symbol;
22
+ const result = isUpperCase ? mappedSymbol.toUpperCase() : mappedSymbol;
23
+
24
+ return regex.test(result) ? result : '';
25
+ })
26
+ .join('');
@@ -1,18 +1,18 @@
1
- export type ICharactersMap = Record<string, string>;
2
-
3
- export interface IInputRawValue {
4
- rawValue: string;
5
- isValid: boolean;
6
- }
7
-
8
- export type ISmartType =
9
- | 'name'
10
- | 'nameRuEn'
11
- | 'surname'
12
- | 'surnameRuEn'
13
- | 'email'
14
- | 'agencyName'
15
- | 'default'
16
- | 'digits'
17
- | 'docNumber'
18
- | 'benefitCert';
1
+ export type ICharactersMap = Record<string, string>;
2
+
3
+ export interface IInputRawValue {
4
+ rawValue: string;
5
+ isValid: boolean;
6
+ }
7
+
8
+ export type ISmartType =
9
+ | 'name'
10
+ | 'nameRuEn'
11
+ | 'surname'
12
+ | 'surnameRuEn'
13
+ | 'email'
14
+ | 'agencyName'
15
+ | 'default'
16
+ | 'digits'
17
+ | 'docNumber'
18
+ | 'benefitCert';
@@ -1,73 +1,73 @@
1
- import { Status } from '.';
2
- import { ComponentStory } from '@storybook/react';
3
- import { IIconType, iconsList } from '../Icon';
4
- import { complexIcons } from '../Icon/complexIcons';
5
- import { STATUS_COLORS, STATUS_SIZES } from './constants';
6
- import { IStatusStyles } from './Status.styles';
7
-
8
- export default {
9
- title: 'Data Display/Status',
10
- component: Status,
11
- };
12
-
13
- const iconTypes = [
14
- undefined,
15
- ...Object.keys(iconsList),
16
- ...Object.keys(complexIcons),
17
- ] as IIconType[];
18
-
19
- const customTweakStyles: IStatusStyles = {
20
- custom: {
21
- '--status-color': '#793472',
22
- '--status-background': '#F2B9ED',
23
- },
24
- };
25
-
26
- const Template: ComponentStory<typeof Status> = (args) => (
27
- <div
28
- style={{
29
- display: 'grid',
30
- gridTemplateRows: `repeat(${STATUS_SIZES.length + 1}, 1fr)`,
31
- gridTemplateColumns: `repeat(${STATUS_COLORS.length + 1}, 1fr)`,
32
- gap: 20,
33
- }}
34
- >
35
- <div key={0} style={{ display: 'contents' }}>
36
- <div />
37
- {STATUS_COLORS.map((color, j) => (
38
- <div key={j + 1}>{color}</div>
39
- ))}
40
- </div>
41
-
42
- {STATUS_SIZES.map((size, i) => (
43
- <div key={i + 1} style={{ display: 'contents' }}>
44
- <div>{size}</div>
45
- {STATUS_COLORS.map((color, j) => (
46
- <div key={j + 1}>
47
- <Status {...args} size={size} color={color} tweakStyles={customTweakStyles} />
48
- </div>
49
- ))}
50
- </div>
51
- ))}
52
- </div>
53
- );
54
-
55
- export const Default = Template.bind({});
56
-
57
- Default.args = {
58
- children: 'Status',
59
- badge: '+ Badge',
60
- icon: 'balloon',
61
- iconPosition: 'left',
62
- };
63
-
64
- Default.argTypes = {
65
- icon: { options: iconTypes, control: 'select' },
66
- iconPosition: { options: ['left', 'right'], control: 'inline-radio' },
67
- };
68
-
69
- Default.parameters = {
70
- controls: {
71
- exclude: ['size', 'color', 'tweakStyles', 'testId', 'data'],
72
- },
73
- };
1
+ import { Status } from '.';
2
+ import { ComponentStory } from '@storybook/react';
3
+ import { IIconType, iconsList } from '../Icon';
4
+ import { complexIcons } from '../Icon/complexIcons';
5
+ import { STATUS_COLORS, STATUS_SIZES } from './constants';
6
+ import { IStatusStyles } from './Status.styles';
7
+
8
+ export default {
9
+ title: 'Data Display/Status',
10
+ component: Status,
11
+ };
12
+
13
+ const iconTypes = [
14
+ undefined,
15
+ ...Object.keys(iconsList),
16
+ ...Object.keys(complexIcons),
17
+ ] as IIconType[];
18
+
19
+ const customTweakStyles: IStatusStyles = {
20
+ custom: {
21
+ '--status-color': '#793472',
22
+ '--status-background': '#F2B9ED',
23
+ },
24
+ };
25
+
26
+ const Template: ComponentStory<typeof Status> = (args) => (
27
+ <div
28
+ style={{
29
+ display: 'grid',
30
+ gridTemplateRows: `repeat(${STATUS_SIZES.length + 1}, 1fr)`,
31
+ gridTemplateColumns: `repeat(${STATUS_COLORS.length + 1}, 1fr)`,
32
+ gap: 20,
33
+ }}
34
+ >
35
+ <div key={0} style={{ display: 'contents' }}>
36
+ <div />
37
+ {STATUS_COLORS.map((color, j) => (
38
+ <div key={j + 1}>{color}</div>
39
+ ))}
40
+ </div>
41
+
42
+ {STATUS_SIZES.map((size, i) => (
43
+ <div key={i + 1} style={{ display: 'contents' }}>
44
+ <div>{size}</div>
45
+ {STATUS_COLORS.map((color, j) => (
46
+ <div key={j + 1}>
47
+ <Status {...args} size={size} color={color} tweakStyles={customTweakStyles} />
48
+ </div>
49
+ ))}
50
+ </div>
51
+ ))}
52
+ </div>
53
+ );
54
+
55
+ export const Default = Template.bind({});
56
+
57
+ Default.args = {
58
+ children: 'Status',
59
+ badge: '+ Badge',
60
+ icon: 'balloon',
61
+ iconPosition: 'left',
62
+ };
63
+
64
+ Default.argTypes = {
65
+ icon: { options: iconTypes, control: 'select' },
66
+ iconPosition: { options: ['left', 'right'], control: 'inline-radio' },
67
+ };
68
+
69
+ Default.parameters = {
70
+ controls: {
71
+ exclude: ['size', 'color', 'tweakStyles', 'testId', 'data'],
72
+ },
73
+ };