@max-ts/components 0.0.2 → 0.1.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 (214) hide show
  1. package/.storybook/main.ts +14 -14
  2. package/.turbo/turbo-build.log +13 -495
  3. package/.turbo/turbo-type$colon$check.log +1 -756
  4. package/CHANGELOG.md +6 -0
  5. package/dist/components/Autocomplete/styles.d.ts +1 -1
  6. package/dist/components/Button/Button.d.ts +4 -4
  7. package/dist/components/Button/useLogic/useLogic.d.ts +1 -1
  8. package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +37 -0
  9. package/dist/components/ConfirmDialog/index.d.ts +1 -0
  10. package/dist/components/ConfirmDialog/styles.d.ts +9 -0
  11. package/dist/components/ConfirmDialog/useLogic/index.d.ts +1 -0
  12. package/dist/components/ConfirmDialog/useLogic/useLogic.d.ts +10 -0
  13. package/dist/components/DataGrid/Row/NestedChildren/styles.d.ts +1 -1
  14. package/dist/components/DataGrid/Row/styles.d.ts +1 -1
  15. package/dist/components/DropdownButton/DropdownButton.d.ts +9 -0
  16. package/dist/components/DropdownButton/index.d.ts +1 -0
  17. package/dist/components/Filename/Filename.d.ts +21 -0
  18. package/dist/components/Filename/index.d.ts +1 -0
  19. package/dist/components/Filename/styles.d.ts +17 -0
  20. package/dist/components/Filename/useLogic/index.d.ts +1 -0
  21. package/dist/components/Filename/useLogic/useLogic.d.ts +16 -0
  22. package/dist/components/Filename/useLogic/utils/findExtension/constants.d.ts +1 -0
  23. package/dist/components/Filename/useLogic/utils/findExtension/findExtension.d.ts +1 -0
  24. package/dist/components/Filename/useLogic/utils/findExtension/index.d.ts +1 -0
  25. package/dist/components/Filename/useLogic/utils/index.d.ts +1 -0
  26. package/dist/components/Filename/useLogic/utils/truncateString/constants.d.ts +1 -0
  27. package/dist/components/Filename/useLogic/utils/truncateString/index.d.ts +1 -0
  28. package/dist/components/Filename/useLogic/utils/truncateString/truncateString.d.ts +4 -0
  29. package/dist/components/FormLabel/FormLabel.d.ts +4 -0
  30. package/dist/components/FormLabel/index.d.ts +1 -0
  31. package/dist/components/FormLabel/styles.d.ts +1 -0
  32. package/dist/components/IconButton/IconButton.d.ts +2 -2
  33. package/dist/components/IconButton/styles.d.ts +2 -2
  34. package/dist/components/ListItemButton/ListItemButton.d.ts +2 -2
  35. package/dist/components/MenuItem/MenuItem.d.ts +1 -1
  36. package/dist/components/MenuList/types.d.ts +2 -2
  37. package/dist/components/NavMenu/Item/ItemButton/ItemButton.d.ts +1 -1
  38. package/dist/components/NavMenu/Item/ItemButton/styles.d.ts +1 -1
  39. package/dist/components/ProgressBar/ProgressBar.d.ts +12 -0
  40. package/dist/components/ProgressBar/index.d.ts +1 -0
  41. package/dist/components/Radio/Icon/Icon.d.ts +6 -0
  42. package/dist/components/Radio/Icon/index.d.ts +1 -0
  43. package/dist/components/Radio/Radio.d.ts +9 -0
  44. package/dist/components/Radio/constants.d.ts +8 -0
  45. package/dist/components/Radio/index.d.ts +1 -0
  46. package/dist/components/Radio/styles.d.ts +5 -0
  47. package/dist/components/RadioField/RadioField.d.ts +25 -0
  48. package/dist/components/RadioField/index.d.ts +1 -0
  49. package/dist/components/RadioField/styles.d.ts +2 -0
  50. package/dist/components/RadioGroup/RadioGroup.d.ts +30 -0
  51. package/dist/components/RadioGroup/RadioGroupContext/RadioGroupContext.d.ts +4 -0
  52. package/dist/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/RadioGroupContextProvider.d.ts +6 -0
  53. package/dist/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/index.d.ts +1 -0
  54. package/dist/components/RadioGroup/RadioGroupContext/index.d.ts +2 -0
  55. package/dist/components/RadioGroup/index.d.ts +2 -0
  56. package/dist/components/RadioGroupField/RadioGroupField.d.ts +8 -0
  57. package/dist/components/RadioGroupField/index.d.ts +1 -0
  58. package/dist/components/SearchField/styles.d.ts +1 -1
  59. package/dist/components/Select/styles.d.ts +2 -2
  60. package/dist/components/Skeleton/Skeleton.d.ts +14 -0
  61. package/dist/components/Skeleton/index.d.ts +1 -0
  62. package/dist/components/Skeleton/styles.d.ts +1 -0
  63. package/dist/components/Switch/Switch.d.ts +4 -0
  64. package/dist/components/Switch/index.d.ts +1 -0
  65. package/dist/components/Switch/styles.d.ts +1 -0
  66. package/dist/components/Tab/Tab.d.ts +7 -0
  67. package/dist/components/Tab/index.d.ts +1 -0
  68. package/dist/components/Tab/styles.d.ts +1 -0
  69. package/dist/components/Tabs/Tabs.d.ts +13 -0
  70. package/dist/components/Tabs/index.d.ts +1 -0
  71. package/dist/components/Tabs/styles.d.ts +2 -0
  72. package/dist/components/TextArea/TextArea.d.ts +3 -0
  73. package/dist/components/TextArea/index.d.ts +1 -0
  74. package/dist/hooks/index.d.ts +1 -0
  75. package/dist/hooks/useToggle/index.d.ts +1 -0
  76. package/dist/hooks/useToggle/useToggle.d.ts +43 -0
  77. package/dist/index.js +2 -2
  78. package/dist/index.mjs +150 -150
  79. package/package.json +1 -1
  80. package/rslib.config.ts +26 -26
  81. package/src/components/Accordion/Accordion.stories.tsx +2 -0
  82. package/src/components/ActionCell/ActionCell.stories.tsx +1 -0
  83. package/src/components/ActionCell/MainAction/MainAction.tsx +1 -0
  84. package/src/components/AsyncAutocomplete/AsyncAutocomplete.stories.tsx +1 -0
  85. package/src/components/Autocomplete/Autocomplete.stories.tsx +1 -0
  86. package/src/components/Badge/Badge.stories.tsx +1 -0
  87. package/src/components/BottomDrawer/BottomDrawer.stories.tsx +2 -1
  88. package/src/components/Button/Button.stories.tsx +2 -1
  89. package/src/components/Button/Button.tsx +9 -10
  90. package/src/components/Button/useLogic/useLogic.ts +2 -5
  91. package/src/components/Checkbox/Checkbox.stories.tsx +1 -3
  92. package/src/components/CheckboxField/CheckboxField.stories.tsx +1 -0
  93. package/src/components/Chevron/Chevron.stories.tsx +1 -0
  94. package/src/components/CircularProgress/CircularProgress.stories.tsx +1 -0
  95. package/src/components/Collapse/Collapse.stories.tsx +1 -0
  96. package/src/components/ConfirmAction/ConfirmAction.stories.tsx +1 -3
  97. package/src/components/ConfirmDialog/ConfirmDialog.stories.tsx +69 -0
  98. package/src/components/ConfirmDialog/ConfirmDialog.tsx +83 -0
  99. package/src/components/ConfirmDialog/index.ts +1 -0
  100. package/src/components/ConfirmDialog/styles.ts +8 -0
  101. package/src/components/ConfirmDialog/useLogic/index.ts +1 -0
  102. package/src/components/ConfirmDialog/useLogic/useLogic.ts +23 -0
  103. package/src/components/ContentState/ContentState.stories.tsx +1 -0
  104. package/src/components/CopyTypography/CopyTypography.stories.tsx +1 -2
  105. package/src/components/DataGrid/DataGrid.stories.tsx +1 -0
  106. package/src/components/DataGridActionCell/DataGridActionCell.stories.tsx +1 -0
  107. package/src/components/DataGridPagination/DataGridPagination.stories.tsx +1 -0
  108. package/src/components/Description/Description.stories.tsx +1 -0
  109. package/src/components/DescriptionList/DescriptionList.stories.tsx +1 -0
  110. package/src/components/Dialog/Dialog.stories.tsx +1 -0
  111. package/src/components/DialogActions/DialogActions.stories.tsx +1 -3
  112. package/src/components/DialogContent/DialogContent.stories.tsx +1 -3
  113. package/src/components/DialogContentText/DialogContentText.stories.tsx +1 -0
  114. package/src/components/DialogHeader/DialogHeader.stories.tsx +1 -0
  115. package/src/components/Divider/Divider.stories.tsx +1 -0
  116. package/src/components/DropdownButton/DropdownButton.stories.tsx +191 -0
  117. package/src/components/DropdownButton/DropdownButton.tsx +46 -0
  118. package/src/components/DropdownButton/index.ts +1 -0
  119. package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +1 -0
  120. package/src/components/Filename/Filename.stories.tsx +244 -0
  121. package/src/components/Filename/Filename.tsx +57 -0
  122. package/src/components/Filename/index.ts +1 -0
  123. package/src/components/Filename/styles.ts +18 -0
  124. package/src/components/Filename/useLogic/index.ts +1 -0
  125. package/src/components/Filename/useLogic/useLogic.ts +36 -0
  126. package/src/components/Filename/useLogic/utils/findExtension/constants.ts +16 -0
  127. package/src/components/Filename/useLogic/utils/findExtension/findExtension.ts +17 -0
  128. package/src/components/Filename/useLogic/utils/findExtension/index.ts +1 -0
  129. package/src/components/Filename/useLogic/utils/index.ts +1 -0
  130. package/src/components/Filename/useLogic/utils/truncateString/constants.ts +1 -0
  131. package/src/components/Filename/useLogic/utils/truncateString/index.ts +1 -0
  132. package/src/components/Filename/useLogic/utils/truncateString/truncateString.ts +24 -0
  133. package/src/components/FormLabel/FormLabel.tsx +11 -0
  134. package/src/components/FormLabel/index.ts +1 -0
  135. package/src/components/FormLabel/styles.ts +6 -0
  136. package/src/components/GuidTypography/GuidTypography.stories.tsx +1 -0
  137. package/src/components/IconButton/IconButton.stories.tsx +1 -1
  138. package/src/components/IconButton/IconButton.tsx +11 -16
  139. package/src/components/IconButton/styles.ts +24 -24
  140. package/src/components/IconDropdownButton/IconDropdownButton.stories.tsx +1 -0
  141. package/src/components/InternalErrorPlaceholder/InternalErrorPlaceholder.stories.tsx +1 -0
  142. package/src/components/Link/Link.stories.tsx +1 -0
  143. package/src/components/List/List.stories.tsx +1 -0
  144. package/src/components/ListItem/ListItem.stories.tsx +1 -0
  145. package/src/components/ListItemButton/ListItemButton.stories.tsx +1 -0
  146. package/src/components/ListItemButton/ListItemButton.tsx +3 -9
  147. package/src/components/ListItemIcon/ListItemIcon.stories.tsx +1 -0
  148. package/src/components/ListItemText/ListItemText.stories.tsx +1 -0
  149. package/src/components/ListSubheader/ListSubheader.stories.tsx +1 -0
  150. package/src/components/Menu/Menu.stories.tsx +1 -0
  151. package/src/components/MenuItem/MenuItem.stories.tsx +1 -0
  152. package/src/components/MenuItem/MenuItem.tsx +1 -2
  153. package/src/components/MenuList/MenuList.stories.tsx +1 -0
  154. package/src/components/MenuList/types.ts +3 -8
  155. package/src/components/NavMenu/Item/ItemButton/ItemButton.tsx +1 -2
  156. package/src/components/NavMenu/NavMenu.stories.tsx +1 -0
  157. package/src/components/OutdatedReleasePlaceholder/OutdatedReleasePlaceholder.stories.tsx +1 -0
  158. package/src/components/OverflowTypography/OverflowTypography.stories.tsx +1 -8
  159. package/src/components/Pagination/Pagination.stories.tsx +1 -0
  160. package/src/components/Placeholder/Placeholder.stories.tsx +1 -0
  161. package/src/components/Popover/Popover.stories.tsx +1 -0
  162. package/src/components/ProgressBar/ProgressBar.stories.tsx +31 -0
  163. package/src/components/ProgressBar/ProgressBar.tsx +26 -0
  164. package/src/components/ProgressBar/index.ts +1 -0
  165. package/src/components/Radio/Icon/Icon.tsx +37 -0
  166. package/src/components/Radio/Icon/index.ts +1 -0
  167. package/src/components/Radio/Radio.stories.tsx +32 -0
  168. package/src/components/Radio/Radio.tsx +24 -0
  169. package/src/components/Radio/constants.ts +9 -0
  170. package/src/components/Radio/index.ts +1 -0
  171. package/src/components/Radio/styles.ts +70 -0
  172. package/src/components/RadioField/RadioField.stories.tsx +74 -0
  173. package/src/components/RadioField/RadioField.tsx +55 -0
  174. package/src/components/RadioField/index.ts +1 -0
  175. package/src/components/RadioField/styles.ts +10 -0
  176. package/src/components/RadioGroup/RadioGroup.stories.tsx +60 -0
  177. package/src/components/RadioGroup/RadioGroup.tsx +79 -0
  178. package/src/components/RadioGroup/RadioGroupContext/RadioGroupContext.ts +9 -0
  179. package/src/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/RadioGroupContextProvider.tsx +18 -0
  180. package/src/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/index.ts +1 -0
  181. package/src/components/RadioGroup/RadioGroupContext/index.ts +3 -0
  182. package/src/components/RadioGroup/index.ts +3 -0
  183. package/src/components/RadioGroupField/RadioGroupField.tsx +17 -0
  184. package/src/components/RadioGroupField/index.ts +1 -0
  185. package/src/components/Select/Select.stories.tsx +0 -4
  186. package/src/components/Skeleton/Skeleton.stories.tsx +78 -0
  187. package/src/components/Skeleton/Skeleton.tsx +31 -0
  188. package/src/components/Skeleton/index.ts +1 -0
  189. package/src/components/Skeleton/styles.ts +16 -0
  190. package/src/components/Switch/Switch.stories.tsx +179 -0
  191. package/src/components/Switch/Switch.tsx +14 -0
  192. package/src/components/Switch/index.ts +1 -0
  193. package/src/components/Switch/styles.ts +14 -0
  194. package/src/components/Tab/Tab.stories.tsx +53 -0
  195. package/src/components/Tab/Tab.tsx +20 -0
  196. package/src/components/Tab/index.ts +1 -0
  197. package/src/components/Tab/styles.ts +22 -0
  198. package/src/components/Tabs/Tabs.stories.tsx +74 -0
  199. package/src/components/Tabs/Tabs.tsx +27 -0
  200. package/src/components/Tabs/index.ts +1 -0
  201. package/src/components/Tabs/styles.ts +20 -0
  202. package/src/components/Tag/Tag.stories.tsx +1 -1
  203. package/src/components/TagBadge/TagBadge.stories.tsx +1 -5
  204. package/src/components/TextArea/TextArea.stories.tsx +81 -0
  205. package/src/components/TextArea/TextArea.tsx +12 -0
  206. package/src/components/TextArea/index.ts +1 -0
  207. package/src/components/TextField/TextField.stories.tsx +1 -4
  208. package/src/components/Tooltip/Tooltip.stories.tsx +1 -4
  209. package/src/components/Typography/Typography.stories.tsx +2 -4
  210. package/src/hooks/index.ts +1 -0
  211. package/src/hooks/useToggle/index.ts +1 -0
  212. package/src/hooks/useToggle/useToggle.ts +76 -0
  213. package/test.tsx +1 -0
  214. package/tsconfig.json +3 -2
@@ -0,0 +1 @@
1
+ export * from './FormLabel';
@@ -0,0 +1,6 @@
1
+ import { FormLabel, styled } from '@mui/material';
2
+
3
+ export const StyledFormLabel = styled(FormLabel)`
4
+ font-size: ${({ theme }) => theme.typography.pointer.fontSize};
5
+ line-height: ${({ theme }) => theme.typography.pointer.lineHeight};
6
+ `;
@@ -3,6 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { CopyTypography } from '../CopyTypography';
4
4
 
5
5
  import { styled } from '@mui/material';
6
+ import React from 'react';
6
7
  import { GuidTypography } from './GuidTypography';
7
8
 
8
9
  const meta: Meta<typeof GuidTypography> = {
@@ -3,8 +3,8 @@ import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { ActionCell, type Actions } from '../ActionCell';
4
4
  import { DataGrid, type DataGridColumns } from '../DataGrid';
5
5
 
6
- import { styled } from '@mui/material';
7
6
  import { Download, Eye, Filter, Printer, Send } from 'lucide-react';
7
+ import React from 'react';
8
8
  import { Container } from '../Container';
9
9
  import { IconButton } from './IconButton';
10
10
 
@@ -1,4 +1,4 @@
1
- import { type ElementType, type ForwardedRef, useMemo } from 'react';
1
+ import { useMemo } from 'react';
2
2
 
3
3
  import { type ButtonProps, ButtonVariants } from '../Button';
4
4
  import {
@@ -8,22 +8,17 @@ import {
8
8
 
9
9
  import { StyledButton } from './styles';
10
10
 
11
- export type IconButtonProps<
12
- RootComponent extends React.ElementType,
13
- AdditionalProps = object,
14
- > = ButtonProps<RootComponent, AdditionalProps> & {
15
- /**
16
- * Флаг отображения индикатора загрузки
17
- * @example <IconButton loading />
18
- */
19
- loading?: boolean;
20
- };
11
+ export type IconButtonProps<RootComponent extends React.ElementType> =
12
+ ButtonProps<RootComponent> & {
13
+ /**
14
+ * Флаг отображения индикатора загрузки
15
+ * @example <IconButton loading />
16
+ */
17
+ loading?: boolean;
18
+ };
21
19
 
22
- export const IconButton = <
23
- RootComponent extends React.ElementType,
24
- AdditionalProps = object,
25
- >(
26
- props: IconButtonProps<RootComponent, AdditionalProps>,
20
+ export const IconButton = <RootComponent extends React.ElementType = 'button'>(
21
+ props: IconButtonProps<RootComponent>,
27
22
  ) => {
28
23
  const {
29
24
  variant = ButtonVariants.Contained,
@@ -1,44 +1,44 @@
1
1
  import { styled } from '@mui/material';
2
- import { Button, ButtonSizes, type ButtonProps } from '../Button';
2
+ import { Button, type ButtonProps, ButtonSizes } from '../Button';
3
3
 
4
4
  type GetValueOptions = {
5
- type?: string | undefined;
6
- values: Record<string, string>;
7
- defaultValue: string;
5
+ type?: string | undefined;
6
+ values: Record<string, string>;
7
+ defaultValue: string;
8
8
  };
9
9
 
10
10
  const getValue = ({ type, values, defaultValue }: GetValueOptions) => {
11
- if (!type) {
12
- return defaultValue;
13
- }
11
+ if (!type) {
12
+ return defaultValue;
13
+ }
14
14
 
15
- return values[type] || defaultValue;
15
+ return values[type] || defaultValue;
16
16
  };
17
17
 
18
18
  /**
19
19
  * Получить значения для высоты кнопки в зависимости от size параметра
20
20
  */
21
21
  export const getButtonHeight = (options: ButtonProps<'button'>): string =>
22
- getValue({
23
- type: options.size,
24
- values: {
25
- [ButtonSizes.Large]: '40px',
26
- },
27
- defaultValue: '32px',
28
- });
22
+ getValue({
23
+ type: options.size,
24
+ values: {
25
+ [ButtonSizes.Large]: '40px',
26
+ },
27
+ defaultValue: '32px',
28
+ });
29
29
 
30
30
  export const getButtonHeightMobile = (options: ButtonProps<'button'>): string =>
31
- getValue({
32
- type: options.size,
33
- values: {
34
- [ButtonSizes.Small]: '36px',
35
- },
36
- defaultValue: '48px',
37
- });
31
+ getValue({
32
+ type: options.size,
33
+ values: {
34
+ [ButtonSizes.Small]: '36px',
35
+ },
36
+ defaultValue: '48px',
37
+ });
38
38
 
39
39
  export const StyledButton = styled(Button, {
40
- shouldForwardProp: (prop) =>
41
- prop !== 'startIcon' && prop !== 'endIcon' && prop !== 'loading',
40
+ shouldForwardProp: (prop) =>
41
+ prop !== 'startIcon' && prop !== 'endIcon' && prop !== 'loading',
42
42
  })`
43
43
  pointer-events: ${({ loading }) => loading && 'none'};
44
44
 
@@ -6,6 +6,7 @@ import { IconButton } from '../IconButton';
6
6
  import { MenuItem } from '../MenuItem';
7
7
 
8
8
  import { EllipsisVertical, Pencil } from 'lucide-react';
9
+ import React from 'react';
9
10
  import { IconDropdownButton } from './IconDropdownButton';
10
11
 
11
12
  const meta: Meta<typeof IconDropdownButton> = {
@@ -2,6 +2,7 @@ import type { Meta } from '@storybook/react';
2
2
 
3
3
  import { ConfigProvider } from '../ConfigProvider';
4
4
 
5
+ import React from 'react';
5
6
  import { InternalErrorPlaceholder } from './InternalErrorPlaceholder';
6
7
 
7
8
  const errorIllustration = '../../illustrations/error.svg';
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
2
2
 
3
3
  import { Typography } from '../Typography';
4
4
 
5
+ import React from 'react';
5
6
  import { Link } from './Link';
6
7
 
7
8
  /**
@@ -11,6 +11,7 @@ import { ListItemText } from '../ListItemText';
11
11
  import { ListSubheader } from '../ListSubheader';
12
12
 
13
13
  import { Dot, House } from 'lucide-react';
14
+ import React from 'react';
14
15
  import { List } from './List';
15
16
 
16
17
  const meta: Meta<typeof List> = {
@@ -8,6 +8,7 @@ import { ListItemText } from '../ListItemText';
8
8
  import { ListSubheader } from '../ListSubheader';
9
9
 
10
10
  import { House } from 'lucide-react';
11
+ import React from 'react';
11
12
  import { ListItem } from './ListItem';
12
13
 
13
14
  const meta: Meta<typeof ListItem> = {
@@ -10,6 +10,7 @@ import { ListItemText } from '../ListItemText';
10
10
  import { ListSubheader } from '../ListSubheader';
11
11
 
12
12
  import { House } from 'lucide-react';
13
+ import React from 'react';
13
14
  import { ListItemButton } from './ListItemButton';
14
15
 
15
16
  const meta: Meta<typeof ListItemButton> = {
@@ -11,11 +11,8 @@ import type { WithoutEmotionSpecific } from '../types';
11
11
  export type ListItemButtonProps<
12
12
  RootComponent extends
13
13
  React.ElementType = ListItemButtonTypeMap['defaultComponent'],
14
- AdditionalProps = object,
15
14
  > = Omit<
16
- WithoutEmotionSpecific<
17
- MuiListItemButtonProps<RootComponent, AdditionalProps>
18
- >,
15
+ WithoutEmotionSpecific<MuiListItemButtonProps<RootComponent>>,
19
16
  'disableRipple'
20
17
  > & {
21
18
  tooltipPlacement?: TooltipProps['placement'];
@@ -34,11 +31,8 @@ export type ListItemButtonProps<
34
31
  withoutContainer?: boolean;
35
32
  };
36
33
 
37
- export const ListItemButton = <
38
- RootComponent extends React.ElementType,
39
- AdditionalProps,
40
- >(
41
- props: ListItemButtonProps<RootComponent, AdditionalProps>,
34
+ export const ListItemButton = <RootComponent extends React.ElementType>(
35
+ props: ListItemButtonProps<RootComponent>,
42
36
  ) => {
43
37
  const {
44
38
  disabledReason,
@@ -4,6 +4,7 @@ import { List } from '../List';
4
4
  import { ListItemText } from '../ListItemText';
5
5
 
6
6
  import { House } from 'lucide-react';
7
+ import React from 'react';
7
8
  import { ListItemButton } from '../ListItemButton';
8
9
  import { ListItemIcon } from './ListItemIcon';
9
10
 
@@ -3,6 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { List } from '../List';
4
4
  import { ListItem } from '../ListItem';
5
5
 
6
+ import React from 'react';
6
7
  import { ListItemText } from './ListItemText';
7
8
 
8
9
  const meta: Meta<typeof ListItemText> = {
@@ -6,6 +6,7 @@ import { ListItemIcon } from '../ListItemIcon';
6
6
  import { ListItemText } from '../ListItemText';
7
7
 
8
8
  import { House } from 'lucide-react';
9
+ import React from 'react';
9
10
  import { ListSubheader } from './ListSubheader';
10
11
 
11
12
  const meta: Meta<typeof ListSubheader> = {
@@ -6,6 +6,7 @@ import { ListItemIcon } from '../ListItemIcon';
6
6
  import { MenuItem } from '../MenuItem';
7
7
 
8
8
  import { Building2, LogOut, Settings, User } from 'lucide-react';
9
+ import React from 'react';
9
10
  import { Menu } from './Menu';
10
11
 
11
12
  const meta: Meta<typeof Menu> = {
@@ -4,6 +4,7 @@ import { ListItemIcon } from '../ListItemIcon';
4
4
  import { MenuList } from '../MenuList';
5
5
 
6
6
  import { User } from 'lucide-react';
7
+ import React from 'react';
7
8
  import { MenuItem, type MenuItemProps } from './MenuItem';
8
9
 
9
10
  const meta: Meta<typeof MenuItem> = {
@@ -10,8 +10,7 @@ import type { WithoutEmotionSpecific } from '../types';
10
10
 
11
11
  export type MenuItemProps<
12
12
  RootComponent extends React.ElementType = MenuItemTypeMap['defaultComponent'],
13
- AdditionalProps = object,
14
- > = WithoutEmotionSpecific<MuiMenuItemProps<RootComponent, AdditionalProps>> & {
13
+ > = WithoutEmotionSpecific<MuiMenuItemProps<RootComponent>> & {
15
14
  /**
16
15
  * Текст тултипа при заблокированном состоянии элемента меню
17
16
  */
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
2
3
 
3
4
  import { Divider } from '../Divider';
4
5
  import { ListItemIcon } from '../ListItemIcon';
@@ -1,11 +1,6 @@
1
- import type {
2
- MenuListTypeMap,
3
- MenuListProps as MuiMenuListProps,
4
- } from '@mui/material/MenuList';
1
+ import type { MenuListProps as MuiMenuListProps } from '@mui/material/MenuList';
5
2
 
6
3
  import type { WithoutEmotionSpecific } from '../types';
7
4
 
8
- export type MenuListProps<
9
- RootComponent extends React.ElementType = MenuListTypeMap['defaultComponent'],
10
- AdditionalProps = object,
11
- > = WithoutEmotionSpecific<MuiMenuListProps<RootComponent, AdditionalProps>>;
5
+ export type MenuListProps<RootComponent extends React.ElementType> =
6
+ WithoutEmotionSpecific<MuiMenuListProps<RootComponent>>;
@@ -14,8 +14,7 @@ import {
14
14
 
15
15
  export type NavMenuItemButtonProps<
16
16
  RootComponent extends ElementType = ElementType,
17
- AdditionalProps = object,
18
- > = ListItemButtonProps<RootComponent, AdditionalProps> & {
17
+ > = ListItemButtonProps<RootComponent> & {
19
18
  opened?: boolean;
20
19
  collapsedIn: boolean;
21
20
  selected?: boolean;
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
2
3
 
3
4
  import { OverflowTypography } from '../OverflowTypography';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import type { Meta } from '@storybook/react';
2
+ import React from 'react';
2
3
 
3
4
  import { ConfigProvider } from '../ConfigProvider';
4
5
 
@@ -1,16 +1,9 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
2
3
 
3
4
  import { styled } from '@mui/material';
4
5
  import { OverflowTypography } from './OverflowTypography';
5
6
 
6
- /**
7
- * ##Мотивация
8
- * Вариация [Typography](/story/components-data-display-typography--docs) элемента, с автоматической проверкой на переполнение текстового контента, и если есть переполнение, то тогда добавляется кастомизируемая обертка ```Tooltip```.
9
- *
10
- * ### [Figma]()
11
- * ### [Guide]()
12
- */
13
-
14
7
  const meta: Meta<typeof OverflowTypography> = {
15
8
  title: 'Components/Data Display/OverflowTypography',
16
9
  component: OverflowTypography,
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
2
3
  import { type ChangeEvent, useState } from 'react';
3
4
 
4
5
  import { Typography } from '../Typography';
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
2
3
 
3
4
  import { Button } from '../Button';
4
5
  import { ConfigProvider } from '../ConfigProvider';
@@ -1,5 +1,6 @@
1
1
  import { type PopoverOrigin, styled } from '@mui/material';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
+ import React from 'react';
3
4
  import { type MouseEvent, useState } from 'react';
4
5
 
5
6
  import { Button } from '../Button';
@@ -0,0 +1,31 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import React from 'react';
4
+ import { ProgressBar } from './ProgressBar';
5
+
6
+ /**
7
+ *
8
+ Прогресс-бар — это индикатор, который отображает прогресс выполнения задачи.
9
+ */
10
+
11
+ const meta: Meta<typeof ProgressBar> = {
12
+ title: 'Components/ProgressBar',
13
+ component: ProgressBar,
14
+ };
15
+
16
+ type Story = StoryObj<typeof ProgressBar>;
17
+
18
+ export const Interaction: Story = {
19
+ args: {
20
+ value: 33,
21
+ },
22
+ parameters: {
23
+ docs: {
24
+ disable: true,
25
+ },
26
+ },
27
+ };
28
+
29
+ export default meta;
30
+
31
+ export const Example = ({ value = 25 }) => <ProgressBar value={value} />;
@@ -0,0 +1,26 @@
1
+ import { LinearProgress as MuiLinearProgress } from '@mui/material';
2
+
3
+ export type ProgressBarProps = {
4
+ /**
5
+ * Текущий прогресс загрузки (от 0 до 100)
6
+ * @example <ProgressBar value={25} />
7
+ */
8
+ value: number;
9
+
10
+ /**
11
+ * Название класса, применяется к корневому компоненту
12
+ */
13
+ className?: string;
14
+ };
15
+
16
+ export const ProgressBar = ({ className, value }: ProgressBarProps) => {
17
+ const clampedValue = Math.max(0, Math.min(value, 100));
18
+
19
+ return (
20
+ <MuiLinearProgress
21
+ className={className}
22
+ variant='determinate'
23
+ value={clampedValue}
24
+ />
25
+ );
26
+ };
@@ -0,0 +1 @@
1
+ export * from './ProgressBar';
@@ -0,0 +1,37 @@
1
+ import { SvgIcon } from '@mui/material';
2
+
3
+ import { CHECKED_ICON_CLASSES, DEFAULT_ICON_CLASSES } from '../constants';
4
+
5
+ export const DefaultIcon = ({ ...props }) => (
6
+ <SvgIcon viewBox='0 0 24 24' {...props}>
7
+ <circle
8
+ cx='12'
9
+ cy='12'
10
+ r='10'
11
+ className={DEFAULT_ICON_CLASSES.outerCircle}
12
+ />
13
+ <circle
14
+ cx='12'
15
+ cy='12'
16
+ r='8'
17
+ className={DEFAULT_ICON_CLASSES.innerCircle}
18
+ />
19
+ </SvgIcon>
20
+ );
21
+
22
+ export const CheckedCircleIcon = ({ ...props }) => (
23
+ <SvgIcon viewBox='0 0 24 24' {...props}>
24
+ <circle
25
+ cx='12'
26
+ cy='12'
27
+ r='10'
28
+ className={CHECKED_ICON_CLASSES.outerCircle}
29
+ />
30
+ <circle
31
+ cx='12'
32
+ cy='12'
33
+ r='4'
34
+ className={CHECKED_ICON_CLASSES.innerCircle}
35
+ />
36
+ </SvgIcon>
37
+ );
@@ -0,0 +1 @@
1
+ export * from './Icon';
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import React from 'react';
4
+ import { Radio } from './Radio';
5
+
6
+ const meta: Meta<typeof Radio> = {
7
+ title: 'Components/Inputs/Radio',
8
+ component: Radio,
9
+ };
10
+
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof Radio>;
14
+
15
+ export const Interaction: Story = {
16
+ args: {
17
+ checked: false,
18
+ disabled: false,
19
+ isError: false,
20
+ },
21
+ parameters: {
22
+ docs: {
23
+ disable: true,
24
+ },
25
+ },
26
+ };
27
+
28
+ export const Example = () => <Radio />;
29
+
30
+ export const Disabled = () => <Radio disabled />;
31
+
32
+ export const WithError = () => <Radio isError />;
@@ -0,0 +1,24 @@
1
+ import type { RadioProps as MuiRadioProps } from '@mui/material';
2
+
3
+ import type { WithoutEmotionSpecific } from '../types';
4
+
5
+ import { CheckedCircleIcon, DefaultIcon } from './Icon';
6
+ import { StyledRadio } from './styles';
7
+
8
+ export type RadioProps = Omit<
9
+ WithoutEmotionSpecific<MuiRadioProps>,
10
+ 'size' | 'color'
11
+ > & {
12
+ /**
13
+ * Флаг для применения error стилей.
14
+ */
15
+ isError?: boolean;
16
+ };
17
+
18
+ export const Radio = ({
19
+ icon = <DefaultIcon />,
20
+ checkedIcon = <CheckedCircleIcon />,
21
+ ...props
22
+ }: RadioProps) => {
23
+ return <StyledRadio icon={icon} checkedIcon={checkedIcon} {...props} />;
24
+ };
@@ -0,0 +1,9 @@
1
+ export const DEFAULT_ICON_CLASSES = {
2
+ innerCircle: 'RadioIcon-innerCircle',
3
+ outerCircle: 'RadioIcon-outerCircle',
4
+ } as const;
5
+
6
+ export const CHECKED_ICON_CLASSES = {
7
+ innerCircle: 'RadioCheckedIcon-innerCircle',
8
+ outerCircle: 'RadioCheckedIcon-outerCircle',
9
+ } as const;
@@ -0,0 +1 @@
1
+ export * from './Radio';
@@ -0,0 +1,70 @@
1
+ import { Radio, css, styled } from '@mui/material';
2
+
3
+ import type { Theme } from '../../theme';
4
+ import { CHECKED_ICON_CLASSES, DEFAULT_ICON_CLASSES } from './constants';
5
+
6
+ type StyledRadioProps = {
7
+ isError?: boolean;
8
+ };
9
+
10
+ const getErrorStyles = (theme: Theme) => css`
11
+ &.MuiRadio-root:not(.Mui-disabled) {
12
+ color: ${theme.palette.red[800]};
13
+
14
+ &:hover {
15
+ & > svg {
16
+ color: ${theme.palette.red[700]};
17
+ }
18
+ }
19
+ }
20
+ `;
21
+
22
+ export const StyledRadio = styled(Radio, {
23
+ shouldForwardProp: (prop) => prop !== 'isError',
24
+ })<StyledRadioProps>`
25
+ padding: 5px;
26
+
27
+ color: ${({ theme }) => theme.palette.grey[300]};
28
+
29
+ border-radius: unset;
30
+
31
+ & > svg > .${DEFAULT_ICON_CLASSES.innerCircle} {
32
+ fill: ${({ theme }) => theme.palette.common.white};
33
+ }
34
+
35
+ &:hover {
36
+ background: none;
37
+
38
+ & > svg > .${DEFAULT_ICON_CLASSES.innerCircle} {
39
+ fill: ${({ theme }) => theme.palette.grey[100]};
40
+ }
41
+ }
42
+
43
+ &.Mui-disabled:not(.Mui-checked) {
44
+ color: ${({ theme }) => theme.palette.grey[200]};
45
+
46
+ & > svg > .${DEFAULT_ICON_CLASSES.innerCircle} {
47
+ fill: ${({ theme }) => theme.palette.grey[200]};
48
+ }
49
+ }
50
+
51
+ &.Mui-checked {
52
+ color: ${({ theme }) => theme.palette.primary.main};
53
+
54
+ &:hover {
55
+ & > svg {
56
+ color: ${({ theme }) => theme.palette.primary[700]};
57
+ }
58
+ }
59
+
60
+ &.Mui-disabled {
61
+ color: ${({ theme }) => theme.palette.grey[400]};
62
+ }
63
+
64
+ & > svg > .${CHECKED_ICON_CLASSES.innerCircle} {
65
+ fill: ${({ theme }) => theme.palette.common.white};
66
+ }
67
+ }
68
+
69
+ ${({ isError, theme }) => isError && getErrorStyles(theme)}
70
+ `;