@true-engineering/true-react-common-ui-kit 4.0.0-alpha44 → 4.0.0-alpha45

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 (73) hide show
  1. package/dist/components/ControlWrapper/ControlWrapper.d.ts +2 -2
  2. package/dist/components/ControlWrapper/constants.d.ts +1 -0
  3. package/dist/components/ControlWrapper/index.d.ts +1 -0
  4. package/dist/components/ControlWrapper/types.d.ts +2 -0
  5. package/dist/components/index.d.ts +0 -1
  6. package/dist/helpers/misc.d.ts +1 -0
  7. package/dist/true-react-common-ui-kit.js +169 -259
  8. package/dist/true-react-common-ui-kit.js.map +1 -1
  9. package/dist/true-react-common-ui-kit.umd.cjs +169 -259
  10. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  11. package/package.json +3 -6
  12. package/src/components/AccountInfo/AccountInfo.stories.tsx +19 -27
  13. package/src/components/AddButton/AddButton.stories.tsx +14 -17
  14. package/src/components/Button/Button.stories.tsx +7 -24
  15. package/src/components/Checkbox/Checkbox.stories.tsx +24 -26
  16. package/src/components/CloseButton/CloseButton.stories.tsx +5 -6
  17. package/src/components/Colors/Colors.stories.tsx +63 -3
  18. package/src/components/ControlWrapper/ControlWrapper.stories.tsx +43 -38
  19. package/src/components/ControlWrapper/ControlWrapper.tsx +2 -11
  20. package/src/components/ControlWrapper/constants.ts +11 -0
  21. package/src/components/ControlWrapper/index.ts +1 -0
  22. package/src/components/ControlWrapper/types.ts +3 -0
  23. package/src/components/DateInput/DateInput.stories.tsx +13 -30
  24. package/src/components/DatePicker/DatePicker.stories.tsx +15 -52
  25. package/src/components/Description/Description.stories.tsx +11 -16
  26. package/src/components/FileInput/FileInput.stories.tsx +59 -63
  27. package/src/components/FileItem/FileItem.stories.tsx +46 -45
  28. package/src/components/FiltersPane/FiltersPane.stories.tsx +27 -30
  29. package/src/components/Flag/Flag.stories.tsx +15 -20
  30. package/src/components/FlexibleTable/FlexibleTable.stories.tsx +47 -50
  31. package/src/components/FloatDocActions/FloatDocActions.stories.tsx +18 -24
  32. package/src/components/Icon/Icon.stories.tsx +9 -5
  33. package/src/components/IconButton/IconButton.stories.tsx +7 -11
  34. package/src/components/IncrementInput/IncrementInput.stories.tsx +25 -25
  35. package/src/components/Input/Input.stories.tsx +35 -61
  36. package/src/components/List/List.stories.tsx +22 -17
  37. package/src/components/List/List.styles.ts +2 -1
  38. package/src/components/Modal/Modal.stories.tsx +50 -59
  39. package/src/components/MoreMenu/MoreMenu.stories.tsx +24 -15
  40. package/src/components/MultiSelect/MultiSelect.stories.tsx +23 -20
  41. package/src/components/NewMoreMenu/NewMoreMenu.stories.tsx +42 -40
  42. package/src/components/Notification/Notification.stories.tsx +34 -32
  43. package/src/components/NumberInput/NumberInput.stories.tsx +27 -27
  44. package/src/components/PhoneInput/PhoneInput.stories.tsx +28 -54
  45. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +5 -11
  46. package/src/components/RadioButton/RadioButton.stories.tsx +27 -30
  47. package/src/components/SearchInput/SearchInput.stories.tsx +14 -14
  48. package/src/components/Select/CustomSelect.stories.tsx +29 -33
  49. package/src/components/Select/MultiSelect.stories.tsx +40 -45
  50. package/src/components/Select/Select.stories.tsx +40 -45
  51. package/src/components/Selector/Selector.stories.tsx +25 -27
  52. package/src/components/Skeleton/Skeleton.stories.tsx +13 -12
  53. package/src/components/SmartInput/SmartInput.stories.tsx +23 -23
  54. package/src/components/Status/Status.stories.tsx +28 -29
  55. package/src/components/Switch/Switch.stories.tsx +19 -26
  56. package/src/components/TextArea/TextArea.stories.tsx +31 -34
  57. package/src/components/TextButton/TextButton.stories.tsx +6 -16
  58. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +13 -21
  59. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +26 -25
  60. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +12 -23
  61. package/src/components/Toaster/Toaster.stories.tsx +16 -14
  62. package/src/components/Tooltip/Tooltip.stories.tsx +5 -4
  63. package/src/components/WithMessages/WithMessages.stories.tsx +16 -20
  64. package/src/components/WithPopup/WithPopup.stories.tsx +27 -26
  65. package/src/components/WithTooltip/WithTooltip.stories.tsx +28 -28
  66. package/src/components/index.ts +0 -1
  67. package/src/helpers/misc.ts +3 -0
  68. package/dist/components/Colors/Colors.d.ts +0 -2
  69. package/dist/components/Colors/Colors.styles.d.ts +0 -1
  70. package/dist/components/Colors/index.d.ts +0 -1
  71. package/src/components/Colors/Colors.styles.ts +0 -36
  72. package/src/components/Colors/Colors.tsx +0 -26
  73. package/src/components/Colors/index.ts +0 -1
@@ -1,6 +1,7 @@
1
1
  import { ReactNode, useEffect, useState } from 'react';
2
2
  import { isStringNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
- import { ComponentMeta, ComponentStory } from '@storybook/react';
3
+ import { type Meta } from '@storybook/react';
4
+ import { GROUP_PLACEMENTS } from '../ControlWrapper';
4
5
  import { iconsMap } from '../Icon';
5
6
  import { IMultipleSelectProps, Select } from './Select';
6
7
 
@@ -10,8 +11,6 @@ interface ObjectValue {
10
11
  isDisabled?: boolean;
11
12
  }
12
13
 
13
- const groupPlacements = [undefined, 'left', 'right', 'middle'];
14
-
15
14
  const genLetters = (qnt = 1): string =>
16
15
  Math.random()
17
16
  .toString(36)
@@ -61,7 +60,7 @@ const icons = [undefined, ...Object.keys(iconsMap)];
61
60
  const getRandomInt = (min: number, max: number) =>
62
61
  Math.floor(Math.random() * (Math.floor(max) - Math.ceil(min))) + Math.ceil(min);
63
62
 
64
- interface ISelectWithCustomProps<T> extends IMultipleSelectProps<T> {
63
+ interface ISelectCustomProps<T> extends IMultipleSelectProps<T> {
65
64
  valuesType: 'strings' | 'objects';
66
65
  shouldUseReactNodes?: boolean;
67
66
  shouldUsePopper?: boolean;
@@ -73,7 +72,7 @@ interface ISelectWithCustomProps<T> extends IMultipleSelectProps<T> {
73
72
  scrollParent?: 'document' | 'auto';
74
73
  }
75
74
 
76
- function SelectWithCustomProps<T>({
75
+ function Story<T>({
77
76
  valuesType,
78
77
  optionsMode,
79
78
  shouldUseReactNodes,
@@ -85,8 +84,8 @@ function SelectWithCustomProps<T>({
85
84
  canBeFlipped,
86
85
  scrollParent,
87
86
  noMatchesLabel,
88
- ...rest
89
- }: ISelectWithCustomProps<T>) {
87
+ ...args
88
+ }: ISelectCustomProps<T>) {
90
89
  const [stringValue, setStringValue] = useState<string[]>();
91
90
 
92
91
  const stringHandler = (newValue?: string[]) => {
@@ -160,7 +159,7 @@ function SelectWithCustomProps<T>({
160
159
 
161
160
  return (
162
161
  <Select
163
- {...rest}
162
+ {...args}
164
163
  {...(props as unknown as IMultipleSelectProps<any>)}
165
164
  {...(shouldRenderSearchInputInList && {
166
165
  searchInput: { shouldRenderInList: true },
@@ -182,14 +181,41 @@ function SelectWithCustomProps<T>({
182
181
  );
183
182
  }
184
183
 
185
- export default {
184
+ const meta: Meta<typeof Story> = {
186
185
  title: 'Controls/Select',
187
- component: SelectWithCustomProps,
186
+ component: Story,
187
+ args: {
188
+ label: 'Dropdown',
189
+ noMatchesLabel: 'No matches',
190
+ isInvalid: false,
191
+ errorMessage: 'Error Text',
192
+ icon: 'filter',
193
+ defaultOptionLabel: '',
194
+ allOptionsLabel: 'Все опции',
195
+ isDisabled: false,
196
+ isRequired: false,
197
+ isClearable: false,
198
+ isLoading: false,
199
+ debounceTime: 400,
200
+ // custom options
201
+ shouldUseReactNodes: false,
202
+ valuesType: 'strings',
203
+ optionsMode: 'normal',
204
+ shouldUsePopper: false,
205
+ shouldRenderInBody: false,
206
+ shouldHideOnScroll: false,
207
+ shouldUseCustomIsDisabledFunction: false,
208
+ shouldRenderSearchInputInList: false,
209
+ shouldScrollToList: true,
210
+ canBeFlipped: false,
211
+ scrollParent: 'document',
212
+ size: undefined,
213
+ },
188
214
  argTypes: {
189
215
  debounceTime: {
190
216
  control: { type: 'range', min: 0, max: 1000, step: 100 },
191
217
  },
192
- groupPlacement: { control: 'select', options: groupPlacements },
218
+ groupPlacement: { options: [undefined, ...GROUP_PLACEMENTS], control: 'select' },
193
219
  optionsMode: {
194
220
  control: 'inline-radio',
195
221
  options: ['normal', 'search', 'dynamic'],
@@ -200,38 +226,7 @@ export default {
200
226
  },
201
227
  icon: { control: 'select', options: icons },
202
228
  },
203
- } as ComponentMeta<typeof SelectWithCustomProps>;
204
-
205
- const Template: ComponentStory<typeof SelectWithCustomProps> = (args) => (
206
- <SelectWithCustomProps {...args} />
207
- );
208
-
209
- export const MultiSelect = Template.bind({});
210
-
211
- MultiSelect.args = {
212
- label: 'Dropdown',
213
- noMatchesLabel: 'No matches',
214
- isInvalid: false,
215
- errorMessage: 'Error Text',
216
- icon: 'document',
217
- defaultOptionLabel: '',
218
- allOptionsLabel: 'Все опции',
219
- isDisabled: false,
220
- isRequired: false,
221
- isClearable: false,
222
- isLoading: false,
223
- debounceTime: 400,
224
- // custom options
225
- shouldUseReactNodes: false,
226
- valuesType: 'strings',
227
- optionsMode: 'normal',
228
- shouldUsePopper: false,
229
- shouldRenderInBody: false,
230
- shouldHideOnScroll: false,
231
- shouldUseCustomIsDisabledFunction: false,
232
- shouldRenderSearchInputInList: false,
233
- shouldScrollToList: true,
234
- canBeFlipped: false,
235
- scrollParent: 'document',
236
- size: undefined,
237
229
  };
230
+
231
+ export default meta;
232
+ export const MultiSelect = {};
@@ -1,6 +1,7 @@
1
1
  import { ReactNode, useEffect, useState } from 'react';
2
2
  import { isStringNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
- import { ComponentMeta, ComponentStory } from '@storybook/react';
3
+ import { type Meta } from '@storybook/react';
4
+ import { GROUP_PLACEMENTS } from '../ControlWrapper';
4
5
  import { iconsMap } from '../Icon';
5
6
  import { ISelectProps, Select } from './Select';
6
7
 
@@ -10,8 +11,6 @@ interface ObjectValue {
10
11
  isDisabled?: boolean;
11
12
  }
12
13
 
13
- const groupPlacements = [undefined, 'left', 'right', 'middle'];
14
-
15
14
  const genLetters = (qnt = 1): string =>
16
15
  Math.random()
17
16
  .toString(36)
@@ -61,7 +60,7 @@ const icons = [undefined, ...Object.keys(iconsMap)];
61
60
  const getRandomInt = (min: number, max: number) =>
62
61
  Math.floor(Math.random() * (Math.floor(max) - Math.ceil(min))) + Math.ceil(min);
63
62
 
64
- interface ISelectWithCustomProps<T> extends ISelectProps<T> {
63
+ interface ISelectCustomProps<T> extends ISelectProps<T> {
65
64
  valuesType: 'strings' | 'objects';
66
65
  shouldUseReactNodes?: boolean;
67
66
  shouldUsePopper?: boolean;
@@ -73,7 +72,7 @@ interface ISelectWithCustomProps<T> extends ISelectProps<T> {
73
72
  scrollParent?: 'document' | 'auto';
74
73
  }
75
74
 
76
- function SelectWithCustomProps<T>({
75
+ function Story<T>({
77
76
  valuesType,
78
77
  optionsMode,
79
78
  shouldUseReactNodes,
@@ -85,8 +84,8 @@ function SelectWithCustomProps<T>({
85
84
  canBeFlipped,
86
85
  scrollParent,
87
86
  noMatchesLabel,
88
- ...rest
89
- }: ISelectWithCustomProps<T>) {
87
+ ...args
88
+ }: ISelectCustomProps<T>) {
90
89
  const [stringValue, setStringValue] = useState<string>();
91
90
  const stringHandler = (newValue?: string) => {
92
91
  console.log('change');
@@ -158,7 +157,7 @@ function SelectWithCustomProps<T>({
158
157
 
159
158
  return (
160
159
  <Select
161
- {...rest}
160
+ {...args}
162
161
  {...(props as unknown as ISelectProps<any>)}
163
162
  {...(shouldRenderSearchInputInList && {
164
163
  searchInput: { shouldRenderInList: true },
@@ -179,14 +178,41 @@ function SelectWithCustomProps<T>({
179
178
  );
180
179
  }
181
180
 
182
- export default {
181
+ const meta: Meta<typeof Story> = {
183
182
  title: 'Controls/Select',
184
- component: SelectWithCustomProps,
183
+ component: Story,
184
+ args: {
185
+ label: 'Dropdown',
186
+ defaultOptionLabel: 'Default Option',
187
+ noMatchesLabel: 'No matches',
188
+ isInvalid: false,
189
+ errorMessage: 'Error Text',
190
+ isDisabled: false,
191
+ isReadonly: false,
192
+ isRequired: false,
193
+ isClearable: false,
194
+ isLoading: false,
195
+ debounceTime: 400,
196
+ icon: undefined,
197
+ // custom options
198
+ shouldUseReactNodes: false,
199
+ valuesType: 'strings',
200
+ optionsMode: 'normal',
201
+ shouldUsePopper: false,
202
+ shouldRenderInBody: false,
203
+ shouldHideOnScroll: false,
204
+ shouldUseCustomIsDisabledFunction: false,
205
+ shouldRenderSearchInputInList: false,
206
+ shouldScrollToList: true,
207
+ canBeFlipped: false,
208
+ scrollParent: 'document',
209
+ size: undefined,
210
+ },
185
211
  argTypes: {
186
212
  debounceTime: {
187
213
  control: { type: 'range', min: 0, max: 1000, step: 100 },
188
214
  },
189
- groupPlacement: { control: 'select', options: groupPlacements },
215
+ groupPlacement: { options: [undefined, ...GROUP_PLACEMENTS], control: 'select' },
190
216
  optionsMode: {
191
217
  control: 'inline-radio',
192
218
  options: ['normal', 'search', 'dynamic'],
@@ -197,38 +223,7 @@ export default {
197
223
  },
198
224
  icon: { control: 'select', options: icons },
199
225
  },
200
- } as ComponentMeta<typeof SelectWithCustomProps>;
201
-
202
- const Template: ComponentStory<typeof SelectWithCustomProps> = (args) => (
203
- <SelectWithCustomProps {...args} />
204
- );
205
-
206
- export const Default = Template.bind({});
207
-
208
- Default.args = {
209
- label: 'Dropdown',
210
- defaultOptionLabel: 'Default Option',
211
- noMatchesLabel: 'No matches',
212
- isInvalid: false,
213
- errorMessage: 'Error Text',
214
- isDisabled: false,
215
- isReadonly: false,
216
- isRequired: false,
217
- isClearable: false,
218
- isLoading: false,
219
- debounceTime: 400,
220
- icon: undefined,
221
- // custom options
222
- shouldUseReactNodes: false,
223
- valuesType: 'strings',
224
- optionsMode: 'normal',
225
- shouldUsePopper: false,
226
- shouldRenderInBody: false,
227
- shouldHideOnScroll: false,
228
- shouldUseCustomIsDisabledFunction: false,
229
- shouldRenderSearchInputInList: false,
230
- shouldScrollToList: true,
231
- canBeFlipped: false,
232
- scrollParent: 'document',
233
- size: undefined,
234
226
  };
227
+
228
+ export default meta;
229
+ export const Default = {};
@@ -1,14 +1,15 @@
1
- import { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
1
+ import { FC, useState } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams } from '../../helpers';
3
4
  import { Status } from '../Status';
4
- import { Selector } from './Selector';
5
+ import { ISelectorProps, Selector } from './Selector';
5
6
  import { ISelectorOption } from './types';
6
7
 
7
8
  const options: Array<ISelectorOption<string>> = [
8
9
  {
9
10
  label: 'Label 1',
10
11
  value: '1',
11
- icon: 'eye',
12
+ icon: 'filter',
12
13
  },
13
14
  {
14
15
  label: 'My label 2',
@@ -32,31 +33,28 @@ const options: Array<ISelectorOption<string>> = [
32
33
  },
33
34
  ];
34
35
 
35
- export default {
36
- title: 'Controls/Selector',
37
- component: Selector,
38
- };
39
-
40
- const Template: ComponentStory<typeof Selector> = (args) => {
36
+ const Story: FC<ISelectorProps<string>> = (args) => {
41
37
  const [value, setValue] = useState(options[0].value);
42
- return <Selector {...args} value={value} options={options} onChange={setValue} />;
43
- };
44
-
45
- export const Default = Template.bind({});
46
-
47
- Default.args = {
48
- size: 'l',
49
- iconPosition: 'left',
50
- hasSameOptionsWidth: true,
51
- isDisabled: false,
52
- isInvalid: false,
53
- isRequired: false,
38
+ return <Selector<string> {...args} value={value} options={options} onChange={setValue} />;
54
39
  };
55
40
 
56
- Default.argTypes = {};
57
-
58
- Default.parameters = {
59
- controls: {
60
- exclude: ['options', 'value', 'testId', 'onChange'],
41
+ const meta: Meta<typeof Story> = {
42
+ title: 'Controls/Selector',
43
+ component: Story,
44
+ args: {
45
+ size: 'l',
46
+ iconPosition: 'left',
47
+ hasSameOptionsWidth: true,
48
+ isDisabled: false,
49
+ isInvalid: false,
50
+ isRequired: false,
51
+ },
52
+ parameters: {
53
+ controls: {
54
+ exclude: excludeStorybookParams(['options', 'value']),
55
+ },
61
56
  },
62
57
  };
58
+
59
+ export default meta;
60
+ export const Default = {};
@@ -1,19 +1,20 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { Skeleton } from './Skeleton';
1
+ import { FC } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { ISkeletonProps, Skeleton } from './Skeleton';
3
4
 
4
- export default {
5
- title: 'Feedback/Skeleton',
6
- component: Skeleton,
7
- };
8
-
9
- const Template: ComponentStory<typeof Skeleton> = (args) => (
5
+ const Story: FC<ISkeletonProps> = (args) => (
10
6
  <div style={{ padding: 32, backgroundColor: '#fff', width: 200 }}>
11
7
  <Skeleton {...args} />
12
8
  </div>
13
9
  );
14
10
 
15
- export const Default = Template.bind({});
16
-
17
- Default.args = {
18
- height: '20px',
11
+ const meta: Meta<typeof Story> = {
12
+ title: 'Feedback/Skeleton',
13
+ component: Story,
14
+ args: {
15
+ height: '20px',
16
+ },
19
17
  };
18
+
19
+ export default meta;
20
+ export const Default = {};
@@ -1,22 +1,13 @@
1
- import { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
1
+ import { FC, useState } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
3
  import { IInputProps } from '../Input';
4
- import { SmartInput } from './SmartInput';
4
+ import { ISmartInputProps, SmartInput } from './SmartInput';
5
5
  import { ISmartType } from './types';
6
6
 
7
7
  const types: Array<IInputProps['type']> = ['text', 'password', 'email', 'number'];
8
8
  const smartTypes: ISmartType[] = ['default', 'agencyName', 'surname', 'name', 'email'];
9
9
 
10
- export default {
11
- title: 'Inputs/SmartInput',
12
- component: SmartInput,
13
- argTypes: {
14
- type: { control: 'inline-radio', options: types },
15
- smartType: { control: 'inline-radio', options: smartTypes },
16
- },
17
- };
18
-
19
- const Template: ComponentStory<typeof SmartInput> = (args) => {
10
+ const Story: FC<ISmartInputProps> = (args) => {
20
11
  const [value, setValue] = useState('');
21
12
 
22
13
  return (
@@ -38,14 +29,23 @@ const Template: ComponentStory<typeof SmartInput> = (args) => {
38
29
  );
39
30
  };
40
31
 
41
- export const Default = Template.bind({});
42
-
43
- Default.args = {
44
- label: 'Label',
45
- placeholder: 'Placeholder',
46
- type: 'text',
47
- smartType: 'default',
48
- isUpperCase: false,
49
- isDisabled: false,
50
- isTransliterationEnabled: true,
32
+ const meta: Meta<typeof Story> = {
33
+ title: 'Inputs/SmartInput',
34
+ component: Story,
35
+ args: {
36
+ label: 'Label',
37
+ placeholder: 'Placeholder',
38
+ type: 'text',
39
+ smartType: 'default',
40
+ isUpperCase: false,
41
+ isDisabled: false,
42
+ isTransliterationEnabled: true,
43
+ },
44
+ argTypes: {
45
+ type: { control: 'inline-radio', options: types },
46
+ smartType: { control: 'inline-radio', options: smartTypes },
47
+ },
51
48
  };
49
+
50
+ export default meta;
51
+ export const Default = {};
@@ -1,12 +1,13 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { rgba } from '../../helpers';
1
+ import { FC } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams, rgba } from '../../helpers';
3
4
  import { IExtendableProps } from '../../types';
4
5
  import { iconsMap } from '../Icon';
5
- import { Status } from './Status';
6
+ import { IStatusProps, Status } from './Status';
6
7
  import { STATUS_SIZES } from './constants';
7
8
  import { IStatusStyles } from './Status.styles';
8
9
 
9
- export const STATUS_COLORS = [
10
+ const STATUS_COLORS = [
10
11
  'green',
11
12
  'teal',
12
13
  'blue',
@@ -17,18 +18,11 @@ export const STATUS_COLORS = [
17
18
  'custom',
18
19
  ] as const;
19
20
 
20
- export default {
21
- title: 'Data Display/Status',
22
- component: Status,
23
- };
24
-
25
21
  declare module './types' {
26
22
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
27
23
  export interface IStatusColors extends IExtendableProps<typeof STATUS_COLORS> {}
28
24
  }
29
25
 
30
- const icons = [undefined, ...Object.keys(iconsMap)];
31
-
32
26
  const customTweakStyles: IStatusStyles = {
33
27
  green: {
34
28
  '--status-background': rgba('#D4E3AC', 0.5),
@@ -71,7 +65,7 @@ const customTweakStyles: IStatusStyles = {
71
65
  },
72
66
  };
73
67
 
74
- const Template: ComponentStory<typeof Status> = (args) => (
68
+ const Story: FC<IStatusProps> = (args) => (
75
69
  <div
76
70
  style={{
77
71
  display: 'grid',
@@ -100,22 +94,27 @@ const Template: ComponentStory<typeof Status> = (args) => (
100
94
  </div>
101
95
  );
102
96
 
103
- export const Default = Template.bind({});
104
-
105
- Default.args = {
106
- children: 'Status',
107
- badge: '+ Badge',
108
- icon: 'balloon',
109
- iconPosition: 'left',
110
- };
111
-
112
- Default.argTypes = {
113
- icon: { options: icons, control: 'select' },
114
- iconPosition: { options: ['left', 'right'], control: 'inline-radio' },
115
- };
116
-
117
- Default.parameters = {
118
- controls: {
119
- exclude: ['size', 'color', 'tweakStyles', 'testId', 'data'],
97
+ const meta: Meta<typeof Story> = {
98
+ title: 'Data Display/Status',
99
+ component: Story,
100
+ args: {
101
+ children: 'Status',
102
+ badge: '+ Badge',
103
+ icon: 'information',
104
+ iconPosition: 'left',
105
+ color: 'blue',
106
+ size: 's',
107
+ },
108
+ argTypes: {
109
+ icon: { options: [undefined, ...Object.keys(iconsMap)], control: 'select' },
110
+ iconPosition: { options: ['left', 'right'], control: 'inline-radio' },
111
+ },
112
+ parameters: {
113
+ controls: {
114
+ exclude: excludeStorybookParams(['color', 'size']),
115
+ },
120
116
  },
121
117
  };
118
+
119
+ export default meta;
120
+ export const Default = {};
@@ -1,19 +1,9 @@
1
- import { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
3
- import { Switch } from './Switch';
1
+ import { FC, useState } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { ISwitchProps, Switch } from './Switch';
4
4
 
5
- export default {
6
- title: 'Controls/Switch',
7
- component: Switch,
8
- argTypes: {
9
- labelPosition: { control: 'inline-radio', options: ['left', 'right'] },
10
- color: { control: 'inline-radio', options: ['primary', 'secondary'] },
11
- },
12
- };
13
-
14
- const Template: ComponentStory<typeof Switch> = (args) => {
5
+ const Story: FC<ISwitchProps<string>> = (args) => {
15
6
  const [isChecked, setIsChecked] = useState(true);
16
-
17
7
  return (
18
8
  <Switch
19
9
  {...args}
@@ -24,17 +14,20 @@ const Template: ComponentStory<typeof Switch> = (args) => {
24
14
  );
25
15
  };
26
16
 
27
- export const Default = Template.bind({});
28
-
29
- Default.args = {
30
- children: 'Label',
31
- labelPosition: 'right',
32
- isDisabled: false,
33
- color: 'primary',
34
- };
35
-
36
- Default.parameters = {
37
- controls: {
38
- exclude: ['data', 'testId', 'onChange'],
17
+ const meta: Meta<typeof Story> = {
18
+ title: 'Controls/Switch',
19
+ component: Story,
20
+ args: {
21
+ children: 'Label',
22
+ labelPosition: 'right',
23
+ isDisabled: false,
24
+ color: 'primary',
25
+ },
26
+ argTypes: {
27
+ labelPosition: { control: 'inline-radio', options: ['left', 'right'] },
28
+ color: { control: 'inline-radio', options: ['primary', 'secondary'] },
39
29
  },
40
30
  };
31
+
32
+ export default meta;
33
+ export const Default = {};
@@ -1,49 +1,46 @@
1
- import { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
1
+ import { FC, useState } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
3
  import { IExtendableProps } from '../../types';
4
- import { TextArea } from './TextArea';
4
+ import { ITextAreaProps, TextArea } from './TextArea';
5
5
 
6
6
  const COUNTER_POSITIONS = ['default', 'top'] as const;
7
7
 
8
- export default {
9
- title: 'Inputs/TextArea',
10
- component: TextArea,
11
- argTypes: {
12
- maxLength: {
13
- control: { type: 'range', min: 10, max: 500, step: 10 },
14
- },
15
- },
16
- };
17
-
18
8
  declare module './types' {
19
9
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
20
10
  export interface ITextAreaCounterPositions extends IExtendableProps<typeof COUNTER_POSITIONS> {}
21
11
  }
22
12
 
23
- const Template: ComponentStory<typeof TextArea> = (args) => {
13
+ const Story: FC<ITextAreaProps> = (args) => {
24
14
  const [value, setValue] = useState('');
25
15
  return <TextArea {...args} value={value} onChange={setValue} />;
26
16
  };
27
17
 
28
- export const Default = Template.bind({});
29
-
30
- Default.args = {
31
- label: 'Label',
32
- placeholder: 'Placeholder',
33
- infoMessage: 'Message Info',
34
- rows: 5,
35
- maxLength: 500,
36
- isInvalid: false,
37
- counterPosition: 'default',
38
- errorMessage: 'Error Text',
39
- isActive: false,
40
- isDisabled: false,
41
- isRequired: false,
42
- isAutoSized: true,
43
- shouldAlwaysShowPlaceholder: false,
44
- size: undefined,
18
+ const meta: Meta<typeof Story> = {
19
+ title: 'Inputs/TextArea',
20
+ component: Story,
21
+ args: {
22
+ label: 'Label',
23
+ placeholder: 'Placeholder',
24
+ infoMessage: 'Message Info',
25
+ rows: 5,
26
+ maxLength: 500,
27
+ isInvalid: false,
28
+ counterPosition: 'default',
29
+ errorMessage: 'Error Text',
30
+ isActive: false,
31
+ isDisabled: false,
32
+ isRequired: false,
33
+ isAutoSized: true,
34
+ shouldAlwaysShowPlaceholder: false,
35
+ size: undefined,
36
+ },
37
+ argTypes: {
38
+ counterPosition: { options: [undefined, ...COUNTER_POSITIONS], control: 'select' },
39
+ maxLength: {
40
+ control: { type: 'range', min: 10, max: 500, step: 10 },
41
+ },
42
+ },
45
43
  };
46
44
 
47
- Default.argTypes = {
48
- counterPosition: { options: [undefined, ...COUNTER_POSITIONS], control: 'select' },
49
- };
45
+ export default meta;
46
+ export const Default = {};