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

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 (210) hide show
  1. package/dist/components/AccountInfo/AccountInfo.styles.d.ts +1 -1
  2. package/dist/components/AddButton/AddButton.styles.d.ts +1 -1
  3. package/dist/components/Button/Button.d.ts +1 -1
  4. package/dist/components/Button/Button.styles.d.ts +1 -1
  5. package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
  6. package/dist/components/CloseButton/CloseButton.styles.d.ts +1 -1
  7. package/dist/components/ControlWrapper/ControlWrapper.d.ts +2 -2
  8. package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +1 -1
  9. package/dist/components/ControlWrapper/constants.d.ts +1 -0
  10. package/dist/components/ControlWrapper/index.d.ts +1 -0
  11. package/dist/components/ControlWrapper/types.d.ts +3 -1
  12. package/dist/components/CssBaseline/CssBaseline.styles.d.ts +1 -1
  13. package/dist/components/DateInput/DateInput.d.ts +1 -2
  14. package/dist/components/DateInput/DateInput.styles.d.ts +1 -1
  15. package/dist/components/DateInput/constants.d.ts +1 -1
  16. package/dist/components/DatePicker/DatePicker.d.ts +2 -3
  17. package/dist/components/DatePicker/DatePicker.styles.d.ts +1 -1
  18. package/dist/components/DatePicker/components/DatePickerBase/DatePickerBase.d.ts +1 -1
  19. package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
  20. package/dist/components/DatePicker/constants.d.ts +1 -1
  21. package/dist/components/DatePicker/types.d.ts +2 -2
  22. package/dist/components/Description/Description.styles.d.ts +1 -1
  23. package/dist/components/FileInput/FileInput.d.ts +1 -1
  24. package/dist/components/FileInput/FileInput.styles.d.ts +1 -1
  25. package/dist/components/FileItem/FileItem.styles.d.ts +1 -1
  26. package/dist/components/FiltersPane/FiltersPane.d.ts +0 -1
  27. package/dist/components/FiltersPane/FiltersPane.styles.d.ts +2 -2
  28. package/dist/components/FiltersPane/components/Filter/Filter.d.ts +1 -2
  29. package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +3 -6
  30. package/dist/components/FiltersPane/components/FilterMultiSelect/FilterMultiSelect.d.ts +0 -1
  31. package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +3 -6
  32. package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +1 -2
  33. package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.styles.d.ts +1 -1
  34. package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +5 -11
  35. package/dist/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.styles.d.ts +1 -1
  36. package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +0 -1
  37. package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +2 -2
  38. package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
  39. package/dist/components/FiltersPane/constants.d.ts +1 -1
  40. package/dist/components/FiltersPane/helpers.d.ts +1 -1
  41. package/dist/components/FiltersPane/types.d.ts +1 -1
  42. package/dist/components/Flag/Flag.styles.d.ts +1 -1
  43. package/dist/components/Flag/customFlags/customFlags.d.ts +2 -2
  44. package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +2 -2
  45. package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +1 -1
  46. package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
  47. package/dist/components/FlexibleTable/helpers.d.ts +2 -2
  48. package/dist/components/FloatDocActions/FloatDocActions.styles.d.ts +1 -1
  49. package/dist/components/FloatDocActions/components/DocActions/DocActions.styles.d.ts +1 -1
  50. package/dist/components/Icon/Icon.styles.d.ts +1 -1
  51. package/dist/components/Icon/icons/index.d.ts +29 -29
  52. package/dist/components/IconButton/IconButton.d.ts +1 -2
  53. package/dist/components/IconButton/IconButton.styles.d.ts +1 -1
  54. package/dist/components/IncrementInput/IncrementInput.styles.d.ts +1 -1
  55. package/dist/components/Input/Input.d.ts +1 -2
  56. package/dist/components/Input/Input.styles.d.ts +1 -1
  57. package/dist/components/Input/InputBase.d.ts +1 -1
  58. package/dist/components/List/List.styles.d.ts +1 -1
  59. package/dist/components/List/components/ListItem/ListItem.styles.d.ts +1 -1
  60. package/dist/components/Modal/Modal.styles.d.ts +1 -1
  61. package/dist/components/MoreMenu/MoreMenu.styles.d.ts +1 -1
  62. package/dist/components/MultiSelect/MultiSelect.d.ts +0 -1
  63. package/dist/components/MultiSelect/MultiSelect.styles.d.ts +1 -1
  64. package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.d.ts +1 -1
  65. package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +1 -1
  66. package/dist/components/MultiSelectList/constants.d.ts +1 -1
  67. package/dist/components/MultiSelectList/helpers.d.ts +1 -1
  68. package/dist/components/NewMoreMenu/NewMoreMenu.styles.d.ts +1 -1
  69. package/dist/components/Notification/Notification.styles.d.ts +1 -1
  70. package/dist/components/NumberInput/NumberInput.d.ts +1 -2
  71. package/dist/components/NumberInput/helpers.d.ts +2 -2
  72. package/dist/components/PhoneInput/PhoneInput.styles.d.ts +1 -1
  73. package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +1 -1
  74. package/dist/components/RadioButton/RadioButton.styles.d.ts +1 -1
  75. package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +3 -373
  76. package/dist/components/ScrollIntoViewIfNeeded/constants.d.ts +1 -1
  77. package/dist/components/SearchInput/SearchInput.d.ts +1 -2
  78. package/dist/components/Select/Select.d.ts +1 -1
  79. package/dist/components/Select/Select.styles.d.ts +12 -22
  80. package/dist/components/Select/components/SelectList/SelectList.d.ts +5 -5
  81. package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
  82. package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +2 -2
  83. package/dist/components/Select/helpers.d.ts +1 -1
  84. package/dist/components/Selector/Selector.d.ts +0 -1
  85. package/dist/components/Selector/Selector.styles.d.ts +1 -1
  86. package/dist/components/Skeleton/Skeleton.styles.d.ts +1 -1
  87. package/dist/components/SmartInput/SmartInput.d.ts +1 -1
  88. package/dist/components/Status/Status.styles.d.ts +1 -1
  89. package/dist/components/Status/types.d.ts +1 -1
  90. package/dist/components/Switch/Switch.styles.d.ts +1 -1
  91. package/dist/components/TextArea/TextArea.d.ts +1 -1
  92. package/dist/components/TextArea/TextArea.styles.d.ts +1 -1
  93. package/dist/components/TextButton/TextButton.d.ts +1 -1
  94. package/dist/components/TextButton/TextButton.styles.d.ts +1 -1
  95. package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +1 -1
  96. package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +1 -1
  97. package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +1 -1
  98. package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +1 -1
  99. package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.d.ts +1 -1
  100. package/dist/components/Toaster/Toaster.styles.d.ts +1 -1
  101. package/dist/components/Tooltip/Tooltip.styles.d.ts +1 -1
  102. package/dist/components/WithMessages/WithMessages.d.ts +1 -1
  103. package/dist/components/WithMessages/WithMessages.styles.d.ts +1 -1
  104. package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
  105. package/dist/components/WithPopup/types.d.ts +4 -4
  106. package/dist/components/index.d.ts +0 -1
  107. package/dist/constants/phone-info.d.ts +1 -1
  108. package/dist/helpers/misc.d.ts +2 -1
  109. package/dist/helpers/phone.d.ts +1 -1
  110. package/dist/hooks/use-dropdown.d.ts +3 -3
  111. package/dist/hooks/use-merge.d.ts +1 -1
  112. package/dist/hooks/use-mixed-styles.d.ts +3 -3
  113. package/dist/hooks/use-tweak-styles.d.ts +5 -5
  114. package/dist/theme/Provider.d.ts +2 -2
  115. package/dist/theme/common.d.ts +1 -1
  116. package/dist/theme/helpers.d.ts +3 -3
  117. package/dist/theme/true-jss/ThemedStylesManager.d.ts +1 -1
  118. package/dist/theme/true-jss/TweakStylesManager.d.ts +1 -1
  119. package/dist/theme/types.d.ts +1 -1
  120. package/dist/true-react-common-ui-kit.js +881 -733
  121. package/dist/true-react-common-ui-kit.js.map +1 -1
  122. package/dist/true-react-common-ui-kit.umd.cjs +881 -733
  123. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  124. package/dist/types.d.ts +4 -4
  125. package/package.json +14 -16
  126. package/src/components/AccountInfo/AccountInfo.stories.tsx +19 -27
  127. package/src/components/AddButton/AddButton.stories.tsx +14 -17
  128. package/src/components/Button/Button.stories.tsx +7 -24
  129. package/src/components/Checkbox/Checkbox.stories.tsx +24 -26
  130. package/src/components/Checkbox/types.ts +1 -1
  131. package/src/components/CloseButton/CloseButton.stories.tsx +5 -6
  132. package/src/components/Colors/Colors.stories.tsx +63 -3
  133. package/src/components/ControlWrapper/ControlWrapper.stories.tsx +43 -38
  134. package/src/components/ControlWrapper/ControlWrapper.tsx +2 -11
  135. package/src/components/ControlWrapper/constants.ts +11 -0
  136. package/src/components/ControlWrapper/index.ts +1 -0
  137. package/src/components/ControlWrapper/types.ts +4 -1
  138. package/src/components/DateInput/DateInput.stories.tsx +13 -30
  139. package/src/components/DatePicker/DatePicker.stories.tsx +15 -52
  140. package/src/components/Description/Description.stories.tsx +11 -16
  141. package/src/components/FileInput/FileInput.stories.tsx +59 -63
  142. package/src/components/FileItem/FileItem.stories.tsx +46 -45
  143. package/src/components/FiltersPane/FiltersPane.stories.tsx +27 -30
  144. package/src/components/FiltersPane/components/Filter/Filter.tsx +1 -1
  145. package/src/components/FiltersPane/components/Filter/helpers.ts +3 -3
  146. package/src/components/FiltersPane/types.ts +0 -2
  147. package/src/components/Flag/Flag.stories.tsx +15 -20
  148. package/src/components/Flag/Flag.tsx +2 -2
  149. package/src/components/FlexibleTable/FlexibleTable.stories.tsx +47 -50
  150. package/src/components/FloatDocActions/FloatDocActions.stories.tsx +18 -24
  151. package/src/components/Icon/Icon.stories.tsx +9 -5
  152. package/src/components/Icon/types.ts +1 -1
  153. package/src/components/IconButton/IconButton.stories.tsx +7 -11
  154. package/src/components/IncrementInput/IncrementInput.stories.tsx +25 -25
  155. package/src/components/Input/Input.stories.tsx +35 -61
  156. package/src/components/List/List.stories.tsx +22 -17
  157. package/src/components/List/List.styles.ts +2 -1
  158. package/src/components/Modal/Modal.stories.tsx +50 -59
  159. package/src/components/MoreMenu/MoreMenu.stories.tsx +24 -15
  160. package/src/components/MultiSelect/MultiSelect.stories.tsx +23 -20
  161. package/src/components/NewMoreMenu/NewMoreMenu.stories.tsx +42 -40
  162. package/src/components/Notification/Notification.stories.tsx +34 -32
  163. package/src/components/NumberInput/NumberInput.stories.tsx +27 -27
  164. package/src/components/PhoneInput/PhoneInput.stories.tsx +28 -54
  165. package/src/components/PhoneInput/PhoneInput.tsx +1 -1
  166. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +5 -11
  167. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +1 -4
  168. package/src/components/RadioButton/RadioButton.stories.tsx +28 -31
  169. package/src/components/RadioButton/types.ts +1 -1
  170. package/src/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.ts +15 -9
  171. package/src/components/SearchInput/SearchInput.stories.tsx +14 -14
  172. package/src/components/Select/CustomSelect.stories.tsx +29 -33
  173. package/src/components/Select/MultiSelect.stories.tsx +41 -46
  174. package/src/components/Select/Select.stories.tsx +41 -46
  175. package/src/components/Select/Select.tsx +27 -27
  176. package/src/components/Select/components/SelectList/SelectList.tsx +4 -4
  177. package/src/components/Selector/Selector.stories.tsx +25 -27
  178. package/src/components/Selector/Selector.tsx +1 -2
  179. package/src/components/Skeleton/Skeleton.stories.tsx +13 -12
  180. package/src/components/SmartInput/SmartInput.stories.tsx +23 -23
  181. package/src/components/Status/Status.stories.tsx +29 -30
  182. package/src/components/Status/types.ts +1 -1
  183. package/src/components/Switch/Switch.stories.tsx +19 -26
  184. package/src/components/TextArea/TextArea.stories.tsx +32 -35
  185. package/src/components/TextArea/types.ts +1 -1
  186. package/src/components/TextButton/TextButton.stories.tsx +6 -16
  187. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +13 -21
  188. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +26 -25
  189. package/src/components/TextWithTooltip/TextWithTooltip.tsx +1 -2
  190. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +12 -23
  191. package/src/components/Toaster/Toaster.stories.tsx +16 -14
  192. package/src/components/Tooltip/Tooltip.stories.tsx +5 -4
  193. package/src/components/WithMessages/WithMessages.stories.tsx +16 -20
  194. package/src/components/WithPopup/WithPopup.stories.tsx +27 -26
  195. package/src/components/WithTooltip/WithTooltip.stories.tsx +28 -28
  196. package/src/components/index.ts +0 -1
  197. package/src/helpers/misc.ts +8 -5
  198. package/src/helpers/popper-helpers.ts +0 -1
  199. package/src/theme/helpers.ts +3 -1
  200. package/src/theme/true-jss/ThemedStylesManager.ts +2 -1
  201. package/src/theme/true-jss/TweakStylesManager.ts +1 -2
  202. package/src/theme/types.ts +0 -1
  203. package/src/types.ts +0 -2
  204. package/dist/components/Colors/Colors.d.ts +0 -2
  205. package/dist/components/Colors/Colors.styles.d.ts +0 -1
  206. package/dist/components/Colors/index.d.ts +0 -1
  207. package/src/components/Colors/Colors.styles.ts +0 -36
  208. package/src/components/Colors/Colors.tsx +0 -26
  209. package/src/components/Colors/index.ts +0 -1
  210. package/src/components/Flag/customFlags/augment.d.ts +0 -1
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { FocusEventHandler, KeyboardEvent, KeyboardEventHandler, MouseEvent, MouseEventHandler, PointerEventHandler, ReactNode } from 'react';
2
- import type { Modifier, Placement } from 'react-overlays/usePopper';
3
- import type { JssStyle } from 'jss';
4
- import type { IMaybeArray } from './theme';
1
+ import { FocusEventHandler, KeyboardEvent, KeyboardEventHandler, MouseEvent, MouseEventHandler, PointerEventHandler, ReactNode } from 'react';
2
+ import { Modifier, Placement } from 'react-overlays/usePopper';
3
+ import { JssStyle } from 'jss';
4
+ import { IMaybeArray } from './theme';
5
5
  export interface ITestIdProps {
6
6
  testId?: string;
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "4.0.0-alpha44",
3
+ "version": "4.0.0-alpha46",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -50,7 +50,7 @@
50
50
  "@floating-ui/react": "^0.27.13",
51
51
  "@true-engineering/true-react-platform-helpers": "^1.0.0",
52
52
  "clsx": "^2.1.1",
53
- "country-flag-icons": "1.5.5",
53
+ "country-flag-icons": "1.5.21",
54
54
  "date-fns": "^4.1.0",
55
55
  "filesize": "10.1.1",
56
56
  "hex-to-rgba": "2.0.1",
@@ -69,32 +69,30 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@babel/core": "7.20.12",
72
- "@storybook/addon-essentials": "7.6.17",
73
- "@storybook/blocks": "7.6.17",
74
- "@storybook/react": "7.6.17",
75
- "@storybook/react-vite": "7.6.17",
76
- "@storybook/test": "7.6.17",
72
+ "@storybook/react": "9.1.10",
77
73
  "@swc/core": "^1.3.30",
78
74
  "@trivago/prettier-plugin-sort-imports": "4.3.0",
79
75
  "@types/lodash-es": "4.17.11",
76
+ "@types/node": "^24.7.2",
80
77
  "@types/react": "18.2.79",
81
78
  "@types/react-dom": "18.2.25",
82
79
  "@types/react-input-mask": "3.0.2",
83
80
  "@types/react-transition-group": "4.4.10",
84
- "@typescript-eslint/eslint-plugin": "5.48.2",
85
- "@typescript-eslint/parser": "5.48.2",
86
81
  "@vitejs/plugin-react": "3.0.0",
87
- "eslint": "8.36.0",
88
- "eslint-config-prettier": "8.7.0",
89
- "eslint-plugin-import": "2.29.0",
90
- "eslint-plugin-react": "7.32.2",
91
- "eslint-plugin-react-hooks": "4.6.0",
82
+ "eslint": "^9.34.0",
83
+ "eslint-config-prettier": "^10.1.8",
84
+ "eslint-import-resolver-typescript": "^4.4.4",
85
+ "eslint-plugin-import": "^2.32.0",
86
+ "eslint-plugin-react": "^7.37.5",
87
+ "eslint-plugin-react-hooks": "6.0.0-rc.1",
88
+ "globals": "^16.3.0",
92
89
  "prettier": "2.8.3",
93
90
  "rollup-plugin-swc3": "0.3.0",
94
- "typescript": "4.9.3",
91
+ "typescript": "5.8.2",
92
+ "typescript-eslint": "^8.42.0",
95
93
  "unplugin-swc": "1.3.2",
96
94
  "vite": "4.0.0",
97
- "vite-plugin-dts": "3.7.3"
95
+ "vite-plugin-dts": "4.5.4"
98
96
  },
99
97
  "resolutions": {
100
98
  "strip-ansi": "6.0.1"
@@ -1,32 +1,24 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { AccountInfo } from './AccountInfo';
1
+ import { FC } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams } from '../../helpers';
4
+ import { AccountInfo, IAccountInfoProps } from './AccountInfo';
3
5
 
4
- export default {
5
- title: 'Data Display/AccountInfo',
6
- component: AccountInfo,
7
- };
8
-
9
- const Template: ComponentStory<typeof AccountInfo> = (args) => (
10
- <div
11
- style={{
12
- display: 'flex',
13
- alignItems: 'center',
14
- justifyContent: 'center',
15
- width: 400,
16
- height: 200,
17
- border: '1px dotted rgba(0, 0, 0, 0.2)',
18
- }}
19
- >
20
- <AccountInfo {...args} options={[{ item: 'Logout', onClick: () => console.log('logout') }]} />
21
- </div>
6
+ const Story: FC<IAccountInfoProps> = (args) => (
7
+ <AccountInfo {...args} options={[{ item: 'Logout', onClick: () => console.log('logout') }]} />
22
8
  );
23
9
 
24
- export const Default = Template.bind({});
25
- Default.args = {
26
- accountName: 'Ivan Ivanov',
27
- };
28
- Default.parameters = {
29
- controls: {
30
- exclude: ['data', 'options', 'avatar'],
10
+ const meta: Meta<typeof Story> = {
11
+ title: 'Data Display/AccountInfo',
12
+ component: Story,
13
+ args: {
14
+ accountName: 'Ivan Ivanov',
15
+ },
16
+ parameters: {
17
+ controls: {
18
+ exclude: excludeStorybookParams(['avatar', 'options']),
19
+ },
31
20
  },
32
21
  };
22
+
23
+ export default meta;
24
+ export const Default = {};
@@ -1,21 +1,18 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { AddButton } from './AddButton';
1
+ import { FC } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { AddButton, IAddButtonProps } from '../AddButton';
3
4
 
4
- export default {
5
- title: 'Buttons/AddButton',
6
- component: AddButton,
7
- };
8
-
9
- const Template: ComponentStory<typeof AddButton> = (args) => (
10
- <AddButton {...args} onClick={console.log} />
11
- );
5
+ const Story: FC<IAddButtonProps> = (args) => <AddButton {...args} onClick={console.log} />;
12
6
 
13
- export const Default = Template.bind({});
14
-
15
- Default.args = {
16
- text: 'Добавить билет',
17
- isDisabled: false,
18
- isFullWidth: false,
7
+ const meta: Meta<typeof Story> = {
8
+ title: 'Buttons/AddButton',
9
+ component: Story,
10
+ args: {
11
+ text: 'Добавить билет',
12
+ isDisabled: false,
13
+ isFullWidth: false,
14
+ },
19
15
  };
20
16
 
21
- Default.parameters = { controls: { exclude: ['onClick'] } };
17
+ export default meta;
18
+ export const Default = {};
@@ -1,13 +1,11 @@
1
- import { ComponentMeta, ComponentStory } from '@storybook/react';
1
+ import { type Meta } from '@storybook/react';
2
2
  import { iconsMap } from '../Icon';
3
3
  import { Button, IButtonProps } from './Button';
4
- import { BUTTON_SIZES, BUTTON_VIEWS } from './constants';
5
-
6
- const icons = [undefined, ...Object.keys(iconsMap)];
4
+ import { BUTTON_SIZES } from './constants';
7
5
 
8
6
  const preloaderTypes: Array<IButtonProps['preloaderType']> = ['dots', 'default', 'logo'];
9
7
 
10
- export default {
8
+ const meta: Meta<typeof Button> = {
11
9
  title: 'Buttons/Button',
12
10
  component: Button,
13
11
  args: {
@@ -24,26 +22,11 @@ export default {
24
22
  isFullWidth: false,
25
23
  },
26
24
  argTypes: {
27
- icon: { options: icons, control: 'select' },
25
+ icon: { options: [undefined, ...Object.keys(iconsMap)], control: 'select' },
28
26
  size: { options: BUTTON_SIZES, control: 'inline-radio' },
29
- view: { options: BUTTON_VIEWS, control: 'inline-radio' },
30
- iconPosition: { options: ['left', 'right'], control: 'inline-radio' },
31
27
  preloaderType: { options: preloaderTypes, control: 'inline-radio' },
32
28
  },
33
- parameters: {
34
- controls: {
35
- exclude: [
36
- 'data',
37
- 'testId',
38
- 'onClick',
39
- 'onMouseDown',
40
- 'tweakStyles',
41
- 'shouldSkipTabNavigation',
42
- ],
43
- },
44
- },
45
- } as ComponentMeta<typeof Button>;
29
+ };
46
30
 
47
- export const Default: ComponentStory<typeof Button> = (args) => (
48
- <Button {...args} key={args.size} />
49
- );
31
+ export default meta;
32
+ export const Default = {};
@@ -1,42 +1,48 @@
1
- import { useState, FC } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
1
+ import { FC, useState } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { excludeStorybookParams } from '../../helpers';
3
4
  import { IExtendableProps } from '../../types';
4
- import { Checkbox as CheckboxComponent, ICheckboxProps } from './Checkbox';
5
+ import { Checkbox, ICheckboxProps } from '../Checkbox';
5
6
 
6
- const CHECKBOX_SIZES = ['micro'] as const;
7
+ const SIZES = ['micro'] as const;
7
8
 
8
- const CheckboxComponentWithData: FC<ICheckboxProps<string>> = (props) => {
9
+ declare module './types' {
10
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
11
+ export interface ICheckboxSizes extends IExtendableProps<typeof SIZES> {}
12
+ }
13
+
14
+ const Story: FC<ICheckboxProps<string>> = (args) => {
9
15
  const [isChecked, setIsChecked] = useState(false);
10
16
  const [isSemiChecked, setIsSemiChecked] = useState(false);
11
17
 
12
18
  return (
13
19
  <div style={{ gap: 10, display: 'grid' }}>
14
- <CheckboxComponent
20
+ <Checkbox
15
21
  isChecked={isChecked}
16
22
  isSemiChecked={isSemiChecked}
17
23
  onSelect={({ isSelected }) => {
18
24
  setIsChecked(isSelected);
19
25
  setIsSemiChecked(false);
20
26
  }}
21
- {...props}
27
+ {...args}
22
28
  >
23
29
  Use wrapping paper
24
- </CheckboxComponent>
25
- <CheckboxComponent
30
+ </Checkbox>
31
+ <Checkbox
26
32
  value={undefined}
27
33
  isChecked={isSemiChecked}
28
34
  onSelect={({ isSelected }) => setIsSemiChecked(isSelected)}
29
- {...props}
35
+ {...args}
30
36
  >
31
37
  Is Semi Checked
32
- </CheckboxComponent>
38
+ </Checkbox>
33
39
  </div>
34
40
  );
35
41
  };
36
42
 
37
- const meta: Meta<typeof CheckboxComponentWithData> = {
43
+ const meta: Meta<typeof Story> = {
38
44
  title: 'Controls/Checkbox',
39
- component: CheckboxComponentWithData,
45
+ component: Story,
40
46
  args: {
41
47
  value: 'value',
42
48
  labelPosition: 'right',
@@ -45,23 +51,15 @@ const meta: Meta<typeof CheckboxComponentWithData> = {
45
51
  isDisabled: false,
46
52
  isReadonly: false,
47
53
  },
54
+ argTypes: {
55
+ size: { options: [undefined, ...SIZES], control: 'inline-radio' },
56
+ },
48
57
  parameters: {
49
58
  controls: {
50
- exclude: ['data', 'tweakStyles', 'testId', 'onSelect'],
59
+ exclude: excludeStorybookParams(['isChecked', 'isSemiChecked']),
51
60
  },
52
61
  },
53
- argTypes: {
54
- size: { options: [undefined, ...CHECKBOX_SIZES], control: 'inline-radio' },
55
- },
56
62
  };
57
63
 
58
- declare module './types' {
59
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
60
- export interface ICheckboxSizes extends IExtendableProps<typeof CHECKBOX_SIZES> {}
61
- }
62
-
63
64
  export default meta;
64
-
65
- type Story = StoryObj<typeof CheckboxComponent>;
66
-
67
- export const Default: Story = {};
65
+ export const Default = {};
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
1
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
2
2
  export interface ICheckboxSizes {}
3
3
 
4
4
  export type ICheckboxSize = keyof ICheckboxSizes;
@@ -1,11 +1,10 @@
1
- import { ComponentStory, ComponentMeta } from '@storybook/react';
1
+ import { type Meta } from '@storybook/react';
2
2
  import { CloseButton } from './CloseButton';
3
3
 
4
- export default {
4
+ const meta: Meta<typeof CloseButton> = {
5
5
  title: 'Buttons/CloseButton',
6
6
  component: CloseButton,
7
- args: {},
8
- argTypes: {},
9
- } as ComponentMeta<typeof CloseButton>;
7
+ };
10
8
 
11
- export const Default: ComponentStory<typeof CloseButton> = (args) => <CloseButton {...args} />;
9
+ export default meta;
10
+ export const Default = {};
@@ -1,7 +1,67 @@
1
- import { Colors } from './Colors';
1
+ import { FC } from 'react';
2
+ import { type Meta } from '@storybook/react';
3
+ import { createThemedStyles, useTheme } from '../../theme';
2
4
 
3
- export default {
5
+ const useStyles = createThemedStyles({
6
+ root: {
7
+ display: 'flex',
8
+ flexWrap: 'wrap',
9
+ },
10
+
11
+ colorCard: {
12
+ width: 120,
13
+ border: 'solid 1px #dde3ed',
14
+ borderRadius: 8,
15
+ color: '#222a37',
16
+ fontSize: 14,
17
+ margin: 6,
18
+ },
19
+
20
+ color: {
21
+ height: 120,
22
+ borderTopLeftRadius: 8,
23
+ borderTopRightRadius: 8,
24
+ },
25
+
26
+ colorName: {
27
+ marginBottom: 6,
28
+ padding: 6,
29
+ overflow: 'hidden',
30
+ },
31
+
32
+ hex: {
33
+ marginTop: 6,
34
+ textTransform: 'uppercase',
35
+ fontWeight: 'bold',
36
+ padding: [0, 6, 6],
37
+ },
38
+ });
39
+
40
+ const Story: FC = () => {
41
+ const classes = useStyles();
42
+ const theme = useTheme();
43
+ const { colors = {} } = theme;
44
+
45
+ return (
46
+ <div className={classes.root}>
47
+ {Object.entries(colors as Record<string, string>).map(([colorName, color]) => {
48
+ const name = colorName.split('_').join(' ').toLowerCase();
49
+ return (
50
+ <div key={colorName} className={classes.colorCard}>
51
+ <div className={classes.color} style={{ backgroundColor: color }} />
52
+ <div className={classes.colorName}>{`${name[0].toUpperCase()}${name.slice(1)}`}</div>
53
+ <div className={classes.hex}>{color}</div>
54
+ </div>
55
+ );
56
+ })}
57
+ </div>
58
+ );
59
+ };
60
+
61
+ const meta: Meta = {
4
62
  title: 'Data Display/Colors',
63
+ component: Story,
5
64
  };
6
65
 
7
- export const Default = (): JSX.Element => <Colors />;
66
+ export default meta;
67
+ export const Default = {};
@@ -1,50 +1,55 @@
1
+ import { FC } from 'react';
1
2
  import { doNothing } from '@true-engineering/true-react-platform-helpers';
2
- import { ComponentStory } from '@storybook/react';
3
+ import { type Meta } from '@storybook/react';
4
+ import { excludeStorybookParams } from '../../helpers';
5
+ import { IExtendableProps } from '../../types';
3
6
  import { Icon, iconsMap } from '../Icon';
4
- import { ControlWrapper } from './ControlWrapper';
7
+ import { ControlWrapper, IControlWrapperProps } from './ControlWrapper';
8
+ import { GROUP_PLACEMENTS } from './constants';
5
9
 
6
- export default {
7
- title: 'Controls/ControlWrapper',
8
- component: ControlWrapper,
9
- };
10
+ const SIZES = ['micro'] as const;
11
+
12
+ declare module './types' {
13
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
14
+ export interface IControlWrapperSizes extends IExtendableProps<typeof SIZES> {}
15
+ }
10
16
 
11
- const Template: ComponentStory<typeof ControlWrapper> = (args) => (
17
+ const Story: FC<IControlWrapperProps> = (args) => (
12
18
  <ControlWrapper {...args} onClear={doNothing}>
13
19
  <div style={{ minWidth: 200, height: 48 }} />
14
20
  </ControlWrapper>
15
21
  );
16
22
 
17
- export const Default = Template.bind({});
18
-
19
- Default.args = {
20
- isInvalid: false,
21
- label: 'Label',
22
- isFocused: false,
23
- isRequired: false,
24
- isLoading: false,
25
- isDisabled: false,
26
- hasValue: false,
27
- icon: [
28
- { iconComponent: <div>Бу</div>, onClick: () => console.log('close'), shouldResetSize: true },
29
- { iconComponent: <Icon type="plus" /> },
30
- { iconComponent: 'search', onClick: () => console.log('search') },
31
- ],
32
- };
33
-
34
- Default.argTypes = {
35
- icon: { control: 'select', options: [undefined, ...Object.keys(iconsMap)] },
36
- groupPlacement: {
37
- control: 'select',
38
- options: [
39
- 'top',
40
- 'bottom',
41
- 'top-left',
42
- 'top-right',
43
- 'bottom-left',
44
- 'bottom-right',
45
- 'left',
46
- 'right',
47
- 'middle',
23
+ const meta: Meta<typeof Story> = {
24
+ title: 'Controls/ControlWrapper',
25
+ component: Story,
26
+ args: {
27
+ label: 'Label',
28
+ isInvalid: false,
29
+ isFocused: false,
30
+ isRequired: false,
31
+ isLoading: false,
32
+ isDisabled: false,
33
+ hasValue: false,
34
+ isActive: false,
35
+ isFullWidth: false,
36
+ icon: [
37
+ { iconComponent: <div>Бу</div>, onClick: () => console.log('close'), shouldResetSize: true },
38
+ { iconComponent: <Icon type="plus" /> },
39
+ { iconComponent: 'search', onClick: () => console.log('search') },
48
40
  ],
49
41
  },
42
+ argTypes: {
43
+ size: { options: [undefined, ...SIZES], control: 'inline-radio' },
44
+ icon: { options: [undefined, ...Object.keys(iconsMap)], control: 'select' },
45
+ groupPlacement: { options: [undefined, ...GROUP_PLACEMENTS], control: 'select' },
46
+ },
47
+ parameters: {
48
+ controls: {
49
+ exclude: excludeStorybookParams(['children']),
50
+ },
51
+ },
50
52
  };
53
+
54
+ export default meta;
55
+ export const Default = {};
@@ -15,7 +15,7 @@ import { IClickHandlerEvent, ICommonProps } from '../../types';
15
15
  import { Icon, IIcon, renderIcon } from '../Icon';
16
16
  import { ThemedPreloader } from '../ThemedPreloader';
17
17
  import { convertToControlWrapperIcon } from './helpers';
18
- import { IControlWrapperIcon, IControlWrapperSize } from './types';
18
+ import { IControlWrapperIcon, IControlWrapperSize, IGroupPlacement } from './types';
19
19
  import { IControlWrapperStyles, useStyles } from './ControlWrapper.styles';
20
20
 
21
21
  export interface IControlWrapperProps extends ICommonProps<IControlWrapperStyles> {
@@ -23,16 +23,7 @@ export interface IControlWrapperProps extends ICommonProps<IControlWrapperStyles
23
23
  label?: ReactNode;
24
24
  icon?: IMaybeArray<IIcon | IControlWrapperIcon>;
25
25
  size?: IControlWrapperSize;
26
- groupPlacement?:
27
- | 'left'
28
- | 'right'
29
- | 'middle'
30
- | 'top'
31
- | 'bottom'
32
- | 'top-left'
33
- | 'top-right'
34
- | 'bottom-left'
35
- | 'bottom-right';
26
+ groupPlacement?: IGroupPlacement;
36
27
  /** @default false */
37
28
  isInvalid?: boolean;
38
29
  /** @default false */
@@ -0,0 +1,11 @@
1
+ export const GROUP_PLACEMENTS = [
2
+ 'left',
3
+ 'right',
4
+ 'middle',
5
+ 'top',
6
+ 'bottom',
7
+ 'top-left',
8
+ 'top-right',
9
+ 'bottom-left',
10
+ 'bottom-right',
11
+ ] as const;
@@ -1,4 +1,5 @@
1
1
  export * from './ControlWrapper';
2
2
  export * from './helpers';
3
+ export * from './constants';
3
4
  export * from './types';
4
5
  export type { IControlWrapperStyles } from './ControlWrapper.styles';
@@ -1,12 +1,15 @@
1
1
  import { type Key } from 'react';
2
2
  import { IClickHandlerEvent } from '../../types';
3
3
  import { IIcon } from '../Icon';
4
+ import { GROUP_PLACEMENTS } from './constants';
4
5
 
5
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
6
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
6
7
  export interface IControlWrapperSizes {}
7
8
 
8
9
  export type IControlWrapperSize = keyof IControlWrapperSizes;
9
10
 
11
+ export type IGroupPlacement = (typeof GROUP_PLACEMENTS)[number];
12
+
10
13
  // подумать над extend HTMLAttributes<HTMLDivElement>
11
14
  export interface IControlWrapperIcon {
12
15
  key?: Key;
@@ -1,14 +1,9 @@
1
- import { useEffect, useState } from 'react';
1
+ import { FC, useEffect, useState } from 'react';
2
2
  import { format, isValid } from 'date-fns';
3
- import { ComponentStory } from '@storybook/react';
4
- import { DateInput } from './DateInput';
3
+ import { type Meta } from '@storybook/react';
4
+ import { DateInput, IDateInputProps } from './DateInput';
5
5
 
6
- export default {
7
- title: 'Inputs/DateInput',
8
- component: DateInput,
9
- };
10
-
11
- const Template: ComponentStory<typeof DateInput> = ({ date, startDate, endDate, ...args }) => {
6
+ const Story: FC<IDateInputProps> = ({ date, startDate, endDate, ...args }) => {
12
7
  const [value, setValue] = useState(date);
13
8
 
14
9
  const startDateValue = isValid(startDate)
@@ -35,26 +30,14 @@ const Template: ComponentStory<typeof DateInput> = ({ date, startDate, endDate,
35
30
  );
36
31
  };
37
32
 
38
- export const Default = Template.bind({});
39
-
40
- Default.args = {
41
- date: '23.01.2023',
42
- startDate: undefined,
43
- endDate: undefined,
44
- isRange: false,
45
- };
46
-
47
- Default.parameters = {
48
- controls: {
49
- exclude: [
50
- 'data',
51
- 'testId',
52
- 'tabIndex',
53
- 'onChange',
54
- 'onFocus',
55
- 'onBlur',
56
- 'onPaste',
57
- 'onKeyDown',
58
- ],
33
+ const meta: Meta<typeof Story> = {
34
+ title: 'Inputs/DateInput',
35
+ component: Story,
36
+ args: {
37
+ date: '23.01.2023',
38
+ isRange: false,
59
39
  },
60
40
  };
41
+
42
+ export default meta;
43
+ export const Default = {};