@true-engineering/true-react-common-ui-kit 4.0.0-alpha43 → 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 (77) hide show
  1. package/dist/components/Checkbox/index.d.ts +1 -0
  2. package/dist/components/ControlWrapper/ControlWrapper.d.ts +2 -2
  3. package/dist/components/ControlWrapper/constants.d.ts +1 -0
  4. package/dist/components/ControlWrapper/index.d.ts +1 -0
  5. package/dist/components/ControlWrapper/types.d.ts +2 -0
  6. package/dist/components/RadioButton/index.d.ts +1 -0
  7. package/dist/components/index.d.ts +0 -1
  8. package/dist/helpers/misc.d.ts +1 -0
  9. package/dist/true-react-common-ui-kit.js +169 -259
  10. package/dist/true-react-common-ui-kit.js.map +1 -1
  11. package/dist/true-react-common-ui-kit.umd.cjs +169 -259
  12. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  13. package/package.json +3 -6
  14. package/src/components/AccountInfo/AccountInfo.stories.tsx +19 -27
  15. package/src/components/AddButton/AddButton.stories.tsx +14 -17
  16. package/src/components/Button/Button.stories.tsx +7 -24
  17. package/src/components/Checkbox/Checkbox.stories.tsx +24 -26
  18. package/src/components/Checkbox/index.ts +1 -0
  19. package/src/components/CloseButton/CloseButton.stories.tsx +5 -6
  20. package/src/components/Colors/Colors.stories.tsx +63 -3
  21. package/src/components/ControlWrapper/ControlWrapper.stories.tsx +43 -38
  22. package/src/components/ControlWrapper/ControlWrapper.tsx +2 -11
  23. package/src/components/ControlWrapper/constants.ts +11 -0
  24. package/src/components/ControlWrapper/index.ts +1 -0
  25. package/src/components/ControlWrapper/types.ts +3 -0
  26. package/src/components/DateInput/DateInput.stories.tsx +13 -30
  27. package/src/components/DatePicker/DatePicker.stories.tsx +15 -52
  28. package/src/components/Description/Description.stories.tsx +11 -16
  29. package/src/components/FileInput/FileInput.stories.tsx +59 -63
  30. package/src/components/FileItem/FileItem.stories.tsx +46 -45
  31. package/src/components/FiltersPane/FiltersPane.stories.tsx +27 -30
  32. package/src/components/Flag/Flag.stories.tsx +15 -20
  33. package/src/components/FlexibleTable/FlexibleTable.stories.tsx +47 -50
  34. package/src/components/FloatDocActions/FloatDocActions.stories.tsx +18 -24
  35. package/src/components/Icon/Icon.stories.tsx +9 -5
  36. package/src/components/IconButton/IconButton.stories.tsx +7 -11
  37. package/src/components/IncrementInput/IncrementInput.stories.tsx +25 -25
  38. package/src/components/Input/Input.stories.tsx +35 -61
  39. package/src/components/List/List.stories.tsx +22 -17
  40. package/src/components/List/List.styles.ts +2 -1
  41. package/src/components/Modal/Modal.stories.tsx +50 -59
  42. package/src/components/MoreMenu/MoreMenu.stories.tsx +24 -15
  43. package/src/components/MultiSelect/MultiSelect.stories.tsx +23 -20
  44. package/src/components/NewMoreMenu/NewMoreMenu.stories.tsx +42 -40
  45. package/src/components/Notification/Notification.stories.tsx +34 -32
  46. package/src/components/NumberInput/NumberInput.stories.tsx +27 -27
  47. package/src/components/PhoneInput/PhoneInput.stories.tsx +28 -54
  48. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +5 -11
  49. package/src/components/RadioButton/RadioButton.stories.tsx +27 -30
  50. package/src/components/RadioButton/index.ts +1 -0
  51. package/src/components/SearchInput/SearchInput.stories.tsx +14 -14
  52. package/src/components/Select/CustomSelect.stories.tsx +29 -33
  53. package/src/components/Select/MultiSelect.stories.tsx +40 -45
  54. package/src/components/Select/Select.stories.tsx +40 -45
  55. package/src/components/Selector/Selector.stories.tsx +25 -27
  56. package/src/components/Skeleton/Skeleton.stories.tsx +13 -12
  57. package/src/components/SmartInput/SmartInput.stories.tsx +23 -23
  58. package/src/components/Status/Status.stories.tsx +28 -29
  59. package/src/components/Switch/Switch.stories.tsx +19 -26
  60. package/src/components/TextArea/TextArea.stories.tsx +31 -34
  61. package/src/components/TextButton/TextButton.stories.tsx +6 -16
  62. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +13 -21
  63. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +26 -25
  64. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +12 -23
  65. package/src/components/Toaster/Toaster.stories.tsx +16 -14
  66. package/src/components/Tooltip/Tooltip.stories.tsx +5 -4
  67. package/src/components/WithMessages/WithMessages.stories.tsx +16 -20
  68. package/src/components/WithPopup/WithPopup.stories.tsx +27 -26
  69. package/src/components/WithTooltip/WithTooltip.stories.tsx +28 -28
  70. package/src/components/index.ts +0 -1
  71. package/src/helpers/misc.ts +3 -0
  72. package/dist/components/Colors/Colors.d.ts +0 -2
  73. package/dist/components/Colors/Colors.styles.d.ts +0 -1
  74. package/dist/components/Colors/index.d.ts +0 -1
  75. package/src/components/Colors/Colors.styles.ts +0 -36
  76. package/src/components/Colors/Colors.tsx +0 -26
  77. package/src/components/Colors/index.ts +0 -1
@@ -1,6 +1,7 @@
1
1
  import { FC, useState } from 'react';
2
2
  import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
- import type { Meta, StoryObj } from '@storybook/react';
3
+ import { type Meta } from '@storybook/react';
4
+ import { excludeStorybookParams } from '../../helpers';
4
5
  import { Button } from '../Button';
5
6
  import { Checkbox, ICheckboxProps } from '../Checkbox';
6
7
  import { NewMoreMenu } from '../NewMoreMenu';
@@ -13,19 +14,7 @@ import { DOC_ACTIONS_VIEWS } from './components';
13
14
 
14
15
  const DATA_LENGTH = 300;
15
16
 
16
- const Actions: FC = () => (
17
- <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
18
- <TextButton icon="trash-can" view="custom">
19
- Удалить
20
- </TextButton>
21
- <TextButton icon="pencil">Редактировать</TextButton>
22
- <Button view="secondary">Отказать</Button>
23
- <Button>Одобрить</Button>
24
- <NewMoreMenu items={[]} />
25
- </div>
26
- );
27
-
28
- const DocActionsWithData: FC<IFloatDocActionsProps> = (props) => {
17
+ const Story: FC<IFloatDocActionsProps> = (args) => {
29
18
  const [isOpen, setIsOpen] = useState(false);
30
19
  const [state, setState] = useState<Set<number>>(new Set());
31
20
 
@@ -56,7 +45,7 @@ const DocActionsWithData: FC<IFloatDocActionsProps> = (props) => {
56
45
  };
57
46
 
58
47
  const isAllRowsSelected = state.size === DATA_LENGTH;
59
- const title = props.title + ': ' + state.size;
48
+ const title = args.title + ': ' + state.size;
60
49
 
61
50
  return (
62
51
  <div style={{ display: 'flex', gap: '50px' }}>
@@ -78,14 +67,22 @@ const DocActionsWithData: FC<IFloatDocActionsProps> = (props) => {
78
67
  </table>
79
68
  <div style={{ position: 'sticky', bottom: '12px', left: '8px', right: '18px' }}>
80
69
  <FloatDocActionsComponent
81
- {...props}
70
+ {...args}
82
71
  title={title}
83
72
  isOpen={isOpen}
84
73
  isChecked={isAllRowsSelected}
85
74
  isSemiChecked={!isAllRowsSelected && state.size !== 0}
86
75
  onSelect={handleSelectAll}
87
76
  >
88
- <Actions />
77
+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
78
+ <TextButton icon="trash-can" view="custom">
79
+ Удалить
80
+ </TextButton>
81
+ <TextButton icon="calendar">Редактировать</TextButton>
82
+ <Button view="secondary">Отказать</Button>
83
+ <Button>Одобрить</Button>
84
+ <NewMoreMenu items={[]} />
85
+ </div>
89
86
  </FloatDocActionsComponent>
90
87
  </div>
91
88
  </div>
@@ -93,9 +90,9 @@ const DocActionsWithData: FC<IFloatDocActionsProps> = (props) => {
93
90
  );
94
91
  };
95
92
 
96
- const meta: Meta<typeof DocActionsWithData> = {
93
+ const meta: Meta<typeof Story> = {
97
94
  title: 'Table/FloatDocActions',
98
- component: DocActionsWithData,
95
+ component: Story,
99
96
  args: {
100
97
  title: 'Выбрано',
101
98
  view: 'neutral',
@@ -105,13 +102,10 @@ const meta: Meta<typeof DocActionsWithData> = {
105
102
  },
106
103
  parameters: {
107
104
  controls: {
108
- exclude: ['actions'],
105
+ exclude: excludeStorybookParams(['actions']),
109
106
  },
110
107
  },
111
108
  };
112
109
 
113
110
  export default meta;
114
-
115
- type Story = StoryObj<typeof FloatDocActionsComponent>;
116
-
117
- export const Default: Story = {};
111
+ export const Default = {};
@@ -5,10 +5,6 @@ import { Icon } from './Icon';
5
5
  import { iconsMap } from './icons';
6
6
  import { IIconType } from './types';
7
7
 
8
- export default {
9
- title: 'Data Display/Icon',
10
- };
11
-
12
8
  const GalleryIcon: FC<{ type: IIconType }> = ({ type }) => (
13
9
  <div
14
10
  key={type}
@@ -49,7 +45,7 @@ const GalleryIcon: FC<{ type: IIconType }> = ({ type }) => (
49
45
  </div>
50
46
  );
51
47
 
52
- export const Gallery = () => {
48
+ const Story: FC = () => {
53
49
  const theme = useTheme();
54
50
  const notCustomizedIcons = Object.keys(iconsMap).filter((icon) =>
55
51
  isEmpty(theme.icons?.[icon]),
@@ -93,3 +89,11 @@ export const Gallery = () => {
93
89
  </div>
94
90
  );
95
91
  };
92
+
93
+ const meta = {
94
+ title: 'Data Display/Icon',
95
+ component: Story,
96
+ };
97
+
98
+ export default meta;
99
+ export const Default = {};
@@ -1,11 +1,11 @@
1
- import { ComponentMeta, ComponentStory } from '@storybook/react';
2
- import { iconsMap } from '../Icon';
1
+ import { type Meta } from '@storybook/react';
2
+ import { iconsMap, IIconType } from '../Icon';
3
3
  import { IconButton } from './IconButton';
4
4
  import { ICON_BUTTON_SIZES, ICON_BUTTON_VIEWS } from './constants';
5
5
 
6
- const icons = Object.keys(iconsMap);
6
+ const icons = Object.keys(iconsMap) as IIconType[];
7
7
 
8
- export default {
8
+ const meta: Meta<typeof IconButton> = {
9
9
  title: 'Buttons/IconButton',
10
10
  component: IconButton,
11
11
  args: {
@@ -21,11 +21,7 @@ export default {
21
21
  size: { options: ICON_BUTTON_SIZES, control: 'inline-radio' },
22
22
  view: { options: ICON_BUTTON_VIEWS, control: 'inline-radio' },
23
23
  },
24
- parameters: {
25
- controls: {
26
- exclude: ['tweakStyles', 'testId', 'data'],
27
- },
28
- },
29
- } as ComponentMeta<typeof IconButton>;
24
+ };
30
25
 
31
- export const Default: ComponentStory<typeof IconButton> = (args) => <IconButton {...args} />;
26
+ export default meta;
27
+ export const Default = {};
@@ -1,31 +1,31 @@
1
- import { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
3
- import { IncrementInput } from './IncrementInput';
1
+ import { FC, useState } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { IIncrementInputProps, IncrementInput } from './IncrementInput';
4
4
 
5
- export default {
6
- title: 'Inputs/IncrementInput',
7
- component: IncrementInput,
8
- };
9
-
10
- const Template: ComponentStory<typeof IncrementInput> = (args) => {
5
+ const Story: FC<IIncrementInputProps> = (args) => {
11
6
  const [value, setValue] = useState<number>();
12
7
  return <IncrementInput {...args} value={value} onChange={(v) => setValue(v)} />;
13
8
  };
14
9
 
15
- export const Default = Template.bind({});
16
-
17
- Default.args = {
18
- min: 0,
19
- max: 99,
20
- step: 1,
21
- intPartPrecision: 10,
22
- label: 'Label',
23
- placeholder: 'Placeholder',
24
- isInvalid: false,
25
- errorMessage: 'Error Text',
26
- isDisabled: false,
27
- isRequired: false,
28
- isReadonly: false,
29
- icon: 'question',
30
- isClearable: true,
10
+ const meta: Meta<typeof Story> = {
11
+ title: 'Inputs/IncrementInput',
12
+ component: Story,
13
+ args: {
14
+ min: 0,
15
+ max: 99,
16
+ step: 1,
17
+ intPartPrecision: 10,
18
+ label: 'Label',
19
+ placeholder: 'Placeholder',
20
+ isInvalid: false,
21
+ errorMessage: 'Error Text',
22
+ isDisabled: false,
23
+ isRequired: false,
24
+ isReadonly: false,
25
+ icon: 'information',
26
+ isClearable: true,
27
+ },
31
28
  };
29
+
30
+ export default meta;
31
+ export const Default = {};
@@ -1,38 +1,17 @@
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 { GROUP_PLACEMENTS } from '../ControlWrapper';
3
4
  import { iconsMap } from '../Icon';
4
5
  import { IInputProps, Input } from './Input';
5
6
 
6
7
  const types: Array<IInputProps['type']> = ['text', 'password', 'email', 'number'];
7
- const groupPositions = [
8
- undefined,
9
- 'top',
10
- 'bottom',
11
- 'top-left',
12
- 'top-right',
13
- 'bottom-left',
14
- 'bottom-right',
15
- 'left',
16
- 'right',
17
- 'middle',
18
- ];
8
+
19
9
  const masks = [undefined, '99/99', 'aaa-aaa', '***+***'];
20
- const icons = [undefined, ...Object.keys(iconsMap)];
21
10
 
22
- export default {
23
- title: 'Inputs/Input',
24
- component: Input,
25
- argTypes: {
26
- type: { control: 'radio', options: types },
27
- icon: { control: 'select', options: icons },
28
- mask: { control: 'select', options: masks },
29
- groupPositions: { control: 'select', options: groupPositions },
30
- },
31
- };
11
+ const icons = [undefined, ...Object.keys(iconsMap)];
32
12
 
33
- const Template: ComponentStory<typeof Input> = (args) => {
13
+ const Story: FC<IInputProps> = (args) => {
34
14
  const [value, setValue] = useState('');
35
-
36
15
  return (
37
16
  <div style={{ width: 300 }}>
38
17
  <Input {...args} value={value} onChange={setValue} />
@@ -40,39 +19,34 @@ const Template: ComponentStory<typeof Input> = (args) => {
40
19
  );
41
20
  };
42
21
 
43
- export const Default = Template.bind({});
44
-
45
- Default.args = {
46
- label: 'Label',
47
- placeholder: 'Placeholder',
48
- infoMessage: 'Message Info',
49
- type: 'text',
50
- isInvalid: false,
51
- units: '',
52
- errorMessage: 'Error Text',
53
- isActive: false,
54
- isDisabled: false,
55
- isRequired: false,
56
- isReadonly: false,
57
- isClearable: false,
58
- isLoading: false,
59
- isAutoSized: false,
60
- shouldAlwaysShowPlaceholder: false,
61
- groupPlacement: undefined,
62
- };
63
-
64
- Default.parameters = {
65
- controls: {
66
- exclude: [
67
- 'testId',
68
- 'data',
69
- 'tabIndex',
70
- 'onChange',
71
- 'onFocus',
72
- 'onBlur',
73
- 'onPaste',
74
- 'onKeyDown',
75
- 'onIconClick',
76
- ],
22
+ const meta: Meta<typeof Story> = {
23
+ title: 'Inputs/Input',
24
+ component: Story,
25
+ args: {
26
+ label: 'Label',
27
+ placeholder: 'Placeholder',
28
+ infoMessage: 'Message Info',
29
+ type: 'text',
30
+ isInvalid: false,
31
+ units: '',
32
+ errorMessage: 'Error Text',
33
+ isActive: false,
34
+ isDisabled: false,
35
+ isRequired: false,
36
+ isReadonly: false,
37
+ isClearable: false,
38
+ isLoading: false,
39
+ isAutoSized: false,
40
+ shouldAlwaysShowPlaceholder: false,
41
+ groupPlacement: undefined,
42
+ },
43
+ argTypes: {
44
+ type: { control: 'radio', options: types },
45
+ icon: { control: 'select', options: icons },
46
+ mask: { control: 'select', options: masks },
47
+ groupPlacement: { options: [undefined, ...GROUP_PLACEMENTS], control: 'select' },
77
48
  },
78
49
  };
50
+
51
+ export default meta;
52
+ export const Default = {};
@@ -1,13 +1,15 @@
1
- import { ComponentStory, ComponentMeta } from '@storybook/react';
1
+ import { FC } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams } from '../../helpers';
2
4
  import { colors } from '../../theme';
3
- import { List } from './List';
5
+ import { IListProps, List } from './List';
4
6
  import { IListItemProps as IListItem } from './components';
5
7
 
6
8
  const listItems: IListItem[] = [
7
9
  {
8
10
  item: 'Печатать билет',
9
11
  onClick: console.log,
10
- icon: 'sign-out',
12
+ icon: 'filter',
11
13
  },
12
14
  { item: 'Выписать', onClick: console.log, withIconGap: true },
13
15
  {
@@ -62,20 +64,7 @@ const listItems: IListItem[] = [
62
64
  },
63
65
  ];
64
66
 
65
- export default {
66
- title: 'Data Display/List',
67
- component: List,
68
- args: {
69
- items: listItems,
70
- },
71
- parameters: {
72
- controls: {
73
- exclude: ['data', 'tweakStyles', 'testId', 'onClick'],
74
- },
75
- },
76
- } as ComponentMeta<typeof List>;
77
-
78
- export const Default: ComponentStory<typeof List> = (args) => (
67
+ const Story: FC<IListProps> = (args) => (
79
68
  <div
80
69
  style={{
81
70
  border: '1px dotted rgba(0,0,0,.2)',
@@ -88,3 +77,19 @@ export const Default: ComponentStory<typeof List> = (args) => (
88
77
  <List {...args} />
89
78
  </div>
90
79
  );
80
+
81
+ const meta: Meta<typeof Story> = {
82
+ title: 'Data Display/List',
83
+ component: Story,
84
+ args: {
85
+ items: listItems,
86
+ },
87
+ parameters: {
88
+ controls: {
89
+ exclude: excludeStorybookParams(['items']),
90
+ },
91
+ },
92
+ };
93
+
94
+ export default meta;
95
+ export const Default = {};
@@ -1,4 +1,4 @@
1
- import { colors, ITweakStyles, createThemedStyles } from '../../theme';
1
+ import { colors, createThemedStyles, ITweakStyles } from '../../theme';
2
2
  import { IWithPopupStyles } from '../WithPopup';
3
3
 
4
4
  export const useStyles = createThemedStyles('List', {
@@ -8,6 +8,7 @@ export const useStyles = createThemedStyles('List', {
8
8
  padding: [8, 0],
9
9
  listStyle: 'none',
10
10
  margin: 0,
11
+ textAlign: 'left',
11
12
  },
12
13
 
13
14
  nestedItems: {
@@ -1,20 +1,24 @@
1
1
  import { FC, useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams } from '../../helpers';
3
4
  import { Button } from '../Button';
4
5
  import { IModalProps, Modal } from './Modal';
5
6
 
6
7
  const smallText =
7
8
  'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
9
+
8
10
  const text =
9
11
  'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.';
10
- const largeText = [...text, ...text, ...text];
12
+
13
+ const largeText = `${text}${text}${text}`;
14
+
11
15
  const texts = { small: smallText, medium: text, large: largeText };
12
16
 
13
- export interface IModalWithCustomProps extends IModalProps {
17
+ export interface IModalCustomProps extends IModalProps {
14
18
  textSize: 'small' | 'medium' | 'large';
15
19
  }
16
20
 
17
- const ModalWithCustomProps: FC<IModalWithCustomProps> = ({ size, textSize, ...args }) => {
21
+ const Story: FC<IModalCustomProps> = ({ size, textSize, ...args }) => {
18
22
  const [isModalOpen, setIsModalOpen] = useState(false);
19
23
  const [isSecondModalOpen, setIsSecondModalOpen] = useState(false);
20
24
 
@@ -27,26 +31,28 @@ const ModalWithCustomProps: FC<IModalWithCustomProps> = ({ size, textSize, ...ar
27
31
  {...args}
28
32
  isOpen={isModalOpen}
29
33
  onClose={() => setIsModalOpen(false)}
30
- buttons={[
31
- <Button
32
- key="1"
33
- view="secondary"
34
- onClick={() => setIsModalOpen(false)}
35
- size={size === 's' ? 'm' : 'l'}
36
- >
37
- Отмена
38
- </Button>,
39
- <Button
40
- key="2"
41
- size={size === 's' ? 'm' : 'l'}
42
- onClick={() => {
43
- setIsModalOpen(false);
44
- setIsSecondModalOpen(true);
45
- }}
46
- >
47
- Применить
48
- </Button>,
49
- ]}
34
+ footer={
35
+ <>
36
+ <Button
37
+ key="1"
38
+ view="secondary"
39
+ onClick={() => setIsModalOpen(false)}
40
+ size={size === 's' ? 'm' : 'l'}
41
+ >
42
+ Отмена
43
+ </Button>
44
+ <Button
45
+ key="2"
46
+ size={size === 's' ? 'm' : 'l'}
47
+ onClick={() => {
48
+ setIsModalOpen(false);
49
+ setIsSecondModalOpen(true);
50
+ }}
51
+ >
52
+ Применить
53
+ </Button>
54
+ </>
55
+ }
50
56
  >
51
57
  <div style={{ lineHeight: 1.6 }}>{texts[textSize]}</div>
52
58
  </Modal>
@@ -58,48 +64,33 @@ const ModalWithCustomProps: FC<IModalWithCustomProps> = ({ size, textSize, ...ar
58
64
  );
59
65
  };
60
66
 
61
- export default {
67
+ const meta: Meta<typeof Story> = {
62
68
  title: 'Feedback/Modal',
63
- component: Modal,
69
+ component: Story,
70
+ args: {
71
+ title: 'Some modal title',
72
+ size: 'm',
73
+ textSize: 'small',
74
+ buttonsAlign: 'right',
75
+ shouldCloseOnEsc: true,
76
+ hasOverlay: true,
77
+ hasCloseButton: true,
78
+ shouldCloseOnOverlayClick: true,
79
+ shouldBlockScroll: true,
80
+ isFooterSticky: false,
81
+ },
64
82
  argTypes: {
65
- buttonsAlign: {
66
- control: 'inline-radio',
67
- options: ['left', 'center', 'right'],
68
- },
69
83
  textSize: {
70
84
  control: 'inline-radio',
71
85
  options: ['small', 'medium', 'large'],
72
86
  },
73
- size: { control: 'inline-radio', options: ['s', 'm', 'l'] },
74
- position: {
75
- control: 'inline-radio',
76
- options: ['center', 'left', 'right', 'static'],
87
+ },
88
+ parameters: {
89
+ controls: {
90
+ exclude: excludeStorybookParams(['items']),
77
91
  },
78
92
  },
79
93
  };
80
94
 
81
- const Template: ComponentStory<typeof ModalWithCustomProps> = (args) => (
82
- <div
83
- style={{
84
- border: '1px dotted rgba(0,0,0,.2)',
85
- height: 1000, // чтобы был скролл на странице
86
- }}
87
- >
88
- <ModalWithCustomProps {...args} />
89
- </div>
90
- );
91
-
92
- export const Default = Template.bind({});
93
-
94
- Default.args = {
95
- title: 'Some modal title',
96
- size: 'm',
97
- textSize: 'small',
98
- buttonsAlign: 'right',
99
- shouldCloseOnEsc: true,
100
- hasOverlay: true,
101
- hasCloseButton: true,
102
- shouldCloseOnOverlayClick: true,
103
- shouldBlockScroll: true,
104
- isFooterSticky: false,
105
- };
95
+ export default meta;
96
+ export const Default = {};
@@ -1,8 +1,11 @@
1
- import { ComponentStory } from '@storybook/react';
1
+ import { FC } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams } from '../../helpers';
2
4
  import { colors } from '../../theme';
3
- import { MoreMenu } from './MoreMenu';
5
+ import { IListItem } from '../List';
6
+ import { IMoreMenuProps, MoreMenu } from './MoreMenu';
4
7
 
5
- const menuItems = [
8
+ const items: IListItem[] = [
6
9
  { item: 'Печатать билет', onClick: console.log },
7
10
  { item: 'Выписать', onClick: console.log },
8
11
  { item: 'Аннулировать', onClick: console.log, shouldDrawSpacerBelow: true },
@@ -16,12 +19,7 @@ const menuItems = [
16
19
  },
17
20
  ];
18
21
 
19
- export default {
20
- title: 'Data Display/MoreMenu',
21
- component: MoreMenu,
22
- };
23
-
24
- const Template: ComponentStory<typeof MoreMenu> = (args) => (
22
+ const Story: FC<IMoreMenuProps> = (args) => (
25
23
  <div
26
24
  style={{
27
25
  display: 'flex',
@@ -33,14 +31,25 @@ const Template: ComponentStory<typeof MoreMenu> = (args) => (
33
31
  >
34
32
  <div style={{ display: 'flex', gap: 10, alignItems: 'center' }}>
35
33
  <div style={{ flexShrink: 0 }}>Test subject</div>
36
- <MoreMenu {...args} items={menuItems} />
34
+ <MoreMenu {...args} />
37
35
  </div>
38
36
  </div>
39
37
  );
40
38
 
41
- export const Default = Template.bind({});
42
-
43
- Default.args = {
44
- isDisabled: false,
45
- hasDefaultStateBackground: true,
39
+ const meta: Meta<typeof Story> = {
40
+ title: 'Data Display/MoreMenu',
41
+ component: Story,
42
+ args: {
43
+ items,
44
+ isDisabled: false,
45
+ hasDefaultStateBackground: true,
46
+ },
47
+ parameters: {
48
+ controls: {
49
+ exclude: excludeStorybookParams(['items']),
50
+ },
51
+ },
46
52
  };
53
+
54
+ export default meta;
55
+ export const Default = {};
@@ -1,14 +1,7 @@
1
- import { useState } from 'react';
2
- import { ComponentStory } from '@storybook/react';
3
- import { MultiSelect } from './MultiSelect';
4
-
5
- export default {
6
- title: 'Controls/MultiSelect',
7
- component: MultiSelect,
8
- argTypes: {
9
- corners: { control: 'inline-radio', options: ['full', 'left', 'right'] },
10
- },
11
- };
1
+ import { FC, useState } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams } from '../../helpers';
4
+ import { IMultiSelectProps, MultiSelect } from './MultiSelect';
12
5
 
13
6
  const stringOptions = [
14
7
  'Опция 1',
@@ -22,7 +15,7 @@ const stringOptions = [
22
15
  '4',
23
16
  ];
24
17
 
25
- const Template: ComponentStory<typeof MultiSelect> = (args) => {
18
+ const Story: FC<IMultiSelectProps> = (args) => {
26
19
  const [value, setValue] = useState<string[]>([]);
27
20
 
28
21
  return (
@@ -35,12 +28,22 @@ const Template: ComponentStory<typeof MultiSelect> = (args) => {
35
28
  );
36
29
  };
37
30
 
38
- export const Default = Template.bind({});
39
-
40
- Default.args = {
41
- placeholder: 'Placeholder',
42
- corners: 'full',
43
- isInvalid: false,
44
- isDisabled: false,
45
- isRequired: false,
31
+ const meta: Meta<typeof Story> = {
32
+ title: 'Controls/MultiSelect',
33
+ component: Story,
34
+ args: {
35
+ placeholder: 'Placeholder',
36
+ corners: 'full',
37
+ isInvalid: false,
38
+ isDisabled: false,
39
+ isRequired: false,
40
+ },
41
+ parameters: {
42
+ controls: {
43
+ exclude: excludeStorybookParams(['items']),
44
+ },
45
+ },
46
46
  };
47
+
48
+ export default meta;
49
+ export const Default = {};