@max-ts/components 0.0.2 → 0.1.1

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 (216) hide show
  1. package/.storybook/main.ts +14 -14
  2. package/.turbo/turbo-build.log +11 -493
  3. package/.turbo/turbo-type$colon$check.log +1 -756
  4. package/CHANGELOG.md +12 -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/components/index.d.ts +14 -0
  75. package/dist/hooks/index.d.ts +1 -0
  76. package/dist/hooks/useToggle/index.d.ts +1 -0
  77. package/dist/hooks/useToggle/useToggle.d.ts +43 -0
  78. package/dist/index.js +183 -49
  79. package/dist/index.mjs +312 -178
  80. package/package.json +1 -1
  81. package/rslib.config.ts +26 -26
  82. package/src/components/Accordion/Accordion.stories.tsx +2 -0
  83. package/src/components/ActionCell/ActionCell.stories.tsx +1 -0
  84. package/src/components/ActionCell/MainAction/MainAction.tsx +1 -0
  85. package/src/components/AsyncAutocomplete/AsyncAutocomplete.stories.tsx +1 -0
  86. package/src/components/Autocomplete/Autocomplete.stories.tsx +1 -0
  87. package/src/components/Badge/Badge.stories.tsx +1 -0
  88. package/src/components/BottomDrawer/BottomDrawer.stories.tsx +2 -1
  89. package/src/components/Button/Button.stories.tsx +2 -1
  90. package/src/components/Button/Button.tsx +9 -10
  91. package/src/components/Button/useLogic/useLogic.ts +2 -5
  92. package/src/components/Checkbox/Checkbox.stories.tsx +1 -3
  93. package/src/components/CheckboxField/CheckboxField.stories.tsx +1 -0
  94. package/src/components/Chevron/Chevron.stories.tsx +1 -0
  95. package/src/components/CircularProgress/CircularProgress.stories.tsx +1 -0
  96. package/src/components/Collapse/Collapse.stories.tsx +1 -0
  97. package/src/components/ConfirmAction/ConfirmAction.stories.tsx +1 -3
  98. package/src/components/ConfirmDialog/ConfirmDialog.stories.tsx +69 -0
  99. package/src/components/ConfirmDialog/ConfirmDialog.tsx +83 -0
  100. package/src/components/ConfirmDialog/index.ts +1 -0
  101. package/src/components/ConfirmDialog/styles.ts +8 -0
  102. package/src/components/ConfirmDialog/useLogic/index.ts +1 -0
  103. package/src/components/ConfirmDialog/useLogic/useLogic.ts +23 -0
  104. package/src/components/ContentState/ContentState.stories.tsx +1 -0
  105. package/src/components/CopyTypography/CopyTypography.stories.tsx +1 -2
  106. package/src/components/DataGrid/DataGrid.stories.tsx +1 -0
  107. package/src/components/DataGridActionCell/DataGridActionCell.stories.tsx +1 -0
  108. package/src/components/DataGridPagination/DataGridPagination.stories.tsx +1 -0
  109. package/src/components/Description/Description.stories.tsx +1 -0
  110. package/src/components/DescriptionList/DescriptionList.stories.tsx +1 -0
  111. package/src/components/Dialog/Dialog.stories.tsx +1 -0
  112. package/src/components/DialogActions/DialogActions.stories.tsx +1 -3
  113. package/src/components/DialogContent/DialogContent.stories.tsx +1 -3
  114. package/src/components/DialogContentText/DialogContentText.stories.tsx +1 -0
  115. package/src/components/DialogHeader/DialogHeader.stories.tsx +1 -0
  116. package/src/components/Divider/Divider.stories.tsx +1 -0
  117. package/src/components/DropdownButton/DropdownButton.stories.tsx +191 -0
  118. package/src/components/DropdownButton/DropdownButton.tsx +46 -0
  119. package/src/components/DropdownButton/index.ts +1 -0
  120. package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +1 -0
  121. package/src/components/Filename/Filename.stories.tsx +244 -0
  122. package/src/components/Filename/Filename.tsx +57 -0
  123. package/src/components/Filename/index.ts +1 -0
  124. package/src/components/Filename/styles.ts +18 -0
  125. package/src/components/Filename/useLogic/index.ts +1 -0
  126. package/src/components/Filename/useLogic/useLogic.ts +36 -0
  127. package/src/components/Filename/useLogic/utils/findExtension/constants.ts +16 -0
  128. package/src/components/Filename/useLogic/utils/findExtension/findExtension.ts +17 -0
  129. package/src/components/Filename/useLogic/utils/findExtension/index.ts +1 -0
  130. package/src/components/Filename/useLogic/utils/index.ts +1 -0
  131. package/src/components/Filename/useLogic/utils/truncateString/constants.ts +1 -0
  132. package/src/components/Filename/useLogic/utils/truncateString/index.ts +1 -0
  133. package/src/components/Filename/useLogic/utils/truncateString/truncateString.ts +24 -0
  134. package/src/components/FormLabel/FormLabel.tsx +11 -0
  135. package/src/components/FormLabel/index.ts +1 -0
  136. package/src/components/FormLabel/styles.ts +6 -0
  137. package/src/components/GuidTypography/GuidTypography.stories.tsx +1 -0
  138. package/src/components/IconButton/IconButton.stories.tsx +1 -1
  139. package/src/components/IconButton/IconButton.tsx +11 -16
  140. package/src/components/IconButton/styles.ts +24 -24
  141. package/src/components/IconDropdownButton/IconDropdownButton.stories.tsx +1 -0
  142. package/src/components/InternalErrorPlaceholder/InternalErrorPlaceholder.stories.tsx +1 -0
  143. package/src/components/Link/Link.stories.tsx +1 -0
  144. package/src/components/List/List.stories.tsx +1 -0
  145. package/src/components/ListItem/ListItem.stories.tsx +1 -0
  146. package/src/components/ListItemButton/ListItemButton.stories.tsx +1 -0
  147. package/src/components/ListItemButton/ListItemButton.tsx +3 -9
  148. package/src/components/ListItemIcon/ListItemIcon.stories.tsx +1 -0
  149. package/src/components/ListItemText/ListItemText.stories.tsx +1 -0
  150. package/src/components/ListSubheader/ListSubheader.stories.tsx +1 -0
  151. package/src/components/Menu/Menu.stories.tsx +1 -0
  152. package/src/components/MenuItem/MenuItem.stories.tsx +1 -0
  153. package/src/components/MenuItem/MenuItem.tsx +1 -2
  154. package/src/components/MenuList/MenuList.stories.tsx +1 -0
  155. package/src/components/MenuList/types.ts +3 -8
  156. package/src/components/NavMenu/Item/ItemButton/ItemButton.tsx +1 -2
  157. package/src/components/NavMenu/NavMenu.stories.tsx +1 -0
  158. package/src/components/OutdatedReleasePlaceholder/OutdatedReleasePlaceholder.stories.tsx +1 -0
  159. package/src/components/OverflowTypography/OverflowTypography.stories.tsx +1 -8
  160. package/src/components/Pagination/Pagination.stories.tsx +1 -0
  161. package/src/components/Placeholder/Placeholder.stories.tsx +1 -0
  162. package/src/components/Popover/Popover.stories.tsx +1 -0
  163. package/src/components/ProgressBar/ProgressBar.stories.tsx +31 -0
  164. package/src/components/ProgressBar/ProgressBar.tsx +26 -0
  165. package/src/components/ProgressBar/index.ts +1 -0
  166. package/src/components/Radio/Icon/Icon.tsx +37 -0
  167. package/src/components/Radio/Icon/index.ts +1 -0
  168. package/src/components/Radio/Radio.stories.tsx +32 -0
  169. package/src/components/Radio/Radio.tsx +24 -0
  170. package/src/components/Radio/constants.ts +9 -0
  171. package/src/components/Radio/index.ts +1 -0
  172. package/src/components/Radio/styles.ts +70 -0
  173. package/src/components/RadioField/RadioField.stories.tsx +74 -0
  174. package/src/components/RadioField/RadioField.tsx +55 -0
  175. package/src/components/RadioField/index.ts +1 -0
  176. package/src/components/RadioField/styles.ts +10 -0
  177. package/src/components/RadioGroup/RadioGroup.stories.tsx +60 -0
  178. package/src/components/RadioGroup/RadioGroup.tsx +79 -0
  179. package/src/components/RadioGroup/RadioGroupContext/RadioGroupContext.ts +9 -0
  180. package/src/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/RadioGroupContextProvider.tsx +18 -0
  181. package/src/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/index.ts +1 -0
  182. package/src/components/RadioGroup/RadioGroupContext/index.ts +3 -0
  183. package/src/components/RadioGroup/index.ts +3 -0
  184. package/src/components/RadioGroupField/RadioGroupField.tsx +17 -0
  185. package/src/components/RadioGroupField/index.ts +1 -0
  186. package/src/components/Select/Select.stories.tsx +0 -4
  187. package/src/components/Skeleton/Skeleton.stories.tsx +78 -0
  188. package/src/components/Skeleton/Skeleton.tsx +31 -0
  189. package/src/components/Skeleton/index.ts +1 -0
  190. package/src/components/Skeleton/styles.ts +16 -0
  191. package/src/components/Switch/Switch.stories.tsx +179 -0
  192. package/src/components/Switch/Switch.tsx +14 -0
  193. package/src/components/Switch/index.ts +1 -0
  194. package/src/components/Switch/styles.ts +14 -0
  195. package/src/components/Tab/Tab.stories.tsx +53 -0
  196. package/src/components/Tab/Tab.tsx +20 -0
  197. package/src/components/Tab/index.ts +1 -0
  198. package/src/components/Tab/styles.ts +22 -0
  199. package/src/components/Tabs/Tabs.stories.tsx +74 -0
  200. package/src/components/Tabs/Tabs.tsx +27 -0
  201. package/src/components/Tabs/index.ts +1 -0
  202. package/src/components/Tabs/styles.ts +20 -0
  203. package/src/components/Tag/Tag.stories.tsx +1 -1
  204. package/src/components/TagBadge/TagBadge.stories.tsx +1 -5
  205. package/src/components/TextArea/TextArea.stories.tsx +81 -0
  206. package/src/components/TextArea/TextArea.tsx +8 -0
  207. package/src/components/TextArea/index.ts +1 -0
  208. package/src/components/TextField/TextField.stories.tsx +1 -4
  209. package/src/components/Tooltip/Tooltip.stories.tsx +1 -4
  210. package/src/components/Typography/Typography.stories.tsx +2 -4
  211. package/src/components/index.ts +28 -0
  212. package/src/hooks/index.ts +1 -0
  213. package/src/hooks/useToggle/index.ts +1 -0
  214. package/src/hooks/useToggle/useToggle.ts +76 -0
  215. package/test.tsx +1 -0
  216. package/tsconfig.json +3 -2
@@ -0,0 +1,14 @@
1
+ import { Switch as MuiSwitch, styled, switchClasses } from '@mui/material';
2
+
3
+ export const StyledSwitch = styled(MuiSwitch)`
4
+ .Mui-focusVisible {
5
+ border: 2px solid ${({ theme }) => theme.palette.primary[400]};
6
+ }
7
+ ${`.${switchClasses.track}`}::before {
8
+ display: none;
9
+ }
10
+
11
+ ${`.${switchClasses.track}`}::after {
12
+ display: none;
13
+ }
14
+ `;
@@ -0,0 +1,53 @@
1
+ import { Stack } from '@mui/material';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { type SyntheticEvent, useState } from 'react';
4
+
5
+ import { Tabs } from '../Tabs';
6
+ import { Typography } from '../Typography';
7
+
8
+ import React from 'react';
9
+ import { Tab } from './Tab';
10
+
11
+ const meta: Meta<typeof Tab> = {
12
+ title: 'Components/Navigation/Tabs/Tab',
13
+ component: Tab,
14
+ };
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof Tab>;
19
+
20
+ export const Interaction: Story = {
21
+ args: {
22
+ label: 'Tab',
23
+ },
24
+ parameters: {
25
+ options: { showPanel: false },
26
+ docs: {
27
+ disable: true,
28
+ },
29
+ },
30
+ };
31
+
32
+ export const Example = () => {
33
+ const [value, setValue] = useState(0);
34
+
35
+ const handleChange = (_event: SyntheticEvent, newValue: number) => {
36
+ setValue(newValue);
37
+ };
38
+
39
+ return (
40
+ <Stack gap={4}>
41
+ <Stack gap={4}>
42
+ <Typography variant='h3'>Tab</Typography>
43
+ <Stack gap={1}>
44
+ <Tabs value={value} onChange={handleChange}>
45
+ <Tab label='Tab' />
46
+ <Tab label='Tab' />
47
+ <Tab label='Tab' disabled />
48
+ </Tabs>
49
+ </Stack>
50
+ </Stack>
51
+ </Stack>
52
+ );
53
+ };
@@ -0,0 +1,20 @@
1
+ import type { TabProps as MuiTabProps } from '@mui/material';
2
+ import type { ElementType } from 'react';
3
+
4
+ import type { WithoutEmotionSpecific } from '../types';
5
+
6
+ import { StyledTab } from './styles';
7
+
8
+ export type TabProps<
9
+ TComponent extends ElementType,
10
+ TComponentProps = object,
11
+ > = WithoutEmotionSpecific<MuiTabProps<TComponent, TComponentProps>> & {
12
+ component?: TComponent;
13
+ };
14
+
15
+ export const Tab = <
16
+ TComponent extends ElementType = 'div',
17
+ TComponentProps = object,
18
+ >(
19
+ props: TabProps<TComponent, TComponentProps>,
20
+ ) => <StyledTab {...props} />;
@@ -0,0 +1 @@
1
+ export * from './Tab';
@@ -0,0 +1,22 @@
1
+ import { Tab, styled } from '@mui/material';
2
+
3
+ export const StyledTab = styled(Tab)`
4
+ min-height: 36px;
5
+ margin-right: ${({ theme }) => theme.spacing(4)};
6
+ padding: 0;
7
+
8
+ line-height: 20px;
9
+ color: ${({ theme }) => theme.palette.grey[900]};
10
+
11
+ &:last-child {
12
+ margin-right: 0;
13
+ }
14
+
15
+ &:hover {
16
+ color: ${({ theme }) => theme.palette.primary[800]};
17
+ }
18
+
19
+ &:active {
20
+ color: ${({ theme }) => theme.palette.primary[900]};
21
+ }
22
+ `;
@@ -0,0 +1,74 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { type SyntheticEvent, useState } from 'react';
3
+
4
+ import { Tab } from '../Tab';
5
+
6
+ import React from 'react';
7
+ import { Tabs } from './Tabs';
8
+
9
+ const meta: Meta<typeof Tabs> = {
10
+ title: 'Components/Navigation/Tabs',
11
+ component: Tabs,
12
+ };
13
+
14
+ export default meta;
15
+
16
+ type Story = StoryObj<typeof Tabs>;
17
+
18
+ export const Interaction: Story = {
19
+ args: {
20
+ value: 0,
21
+ onChange: () => {},
22
+ },
23
+ parameters: {
24
+ options: { showPanel: false },
25
+ docs: {
26
+ disable: true,
27
+ },
28
+ },
29
+ };
30
+
31
+ export const Example = () => {
32
+ const [value, setValue] = useState(0);
33
+
34
+ const handleChange = (_event: SyntheticEvent, newValue: number) => {
35
+ setValue(newValue);
36
+ };
37
+
38
+ return (
39
+ <Tabs
40
+ nextFeatureFlags={{ hasBottomDivider: true }}
41
+ value={value}
42
+ onChange={handleChange}
43
+ centered
44
+ >
45
+ <Tab label='Вкладка 1' />
46
+ <Tab label='Вкладка 2' />
47
+ <Tab label='Вкладка 3' />
48
+ <Tab label='Вкладка 4' />
49
+ <Tab label='Вкладка 5' />
50
+ <Tab label='Вкладка 6' />
51
+ </Tabs>
52
+ );
53
+ };
54
+
55
+ export const TabDisabled = () => {
56
+ const [value, setValue] = useState(0);
57
+
58
+ const handleChange = (_event: SyntheticEvent, newValue: number) => {
59
+ setValue(newValue);
60
+ };
61
+
62
+ return (
63
+ <Tabs
64
+ nextFeatureFlags={{ hasBottomDivider: true }}
65
+ value={value}
66
+ onChange={handleChange}
67
+ centered
68
+ >
69
+ <Tab label='Вкладка 1' />
70
+ <Tab label='Вкладка 2' disabled />
71
+ <Tab label='Вкладка 3' disabled />
72
+ </Tabs>
73
+ );
74
+ };
@@ -0,0 +1,27 @@
1
+ import { Tabs as MuiTabs, type TabsProps as MuiTabsProps } from '@mui/material';
2
+
3
+ import type { WithoutEmotionSpecific } from '../types';
4
+
5
+ import { Container, Divider } from './styles';
6
+
7
+ export type TabsProps = WithoutEmotionSpecific<MuiTabsProps> & {
8
+ nextFeatureFlags?: {
9
+ /**
10
+ * @deprecated
11
+ * Флаг включения нижнего разделителя
12
+ * В мажорном релизе, флаг будет удален
13
+ */
14
+ hasBottomDivider: boolean;
15
+ };
16
+ };
17
+
18
+ export const Tabs = ({ nextFeatureFlags, ...tabsProps }: TabsProps) => {
19
+ return nextFeatureFlags?.hasBottomDivider ? (
20
+ <Container>
21
+ <MuiTabs {...tabsProps} />
22
+ <Divider />
23
+ </Container>
24
+ ) : (
25
+ <MuiTabs {...tabsProps} />
26
+ );
27
+ };
@@ -0,0 +1 @@
1
+ export * from './Tabs';
@@ -0,0 +1,20 @@
1
+ import { styled } from '@mui/material';
2
+
3
+ export const Container = styled('div')`
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: flex-start;
7
+
8
+ width: 100%;
9
+ `;
10
+
11
+ export const Divider = styled('div')`
12
+ position: relative;
13
+ z-index: -1;
14
+ bottom: 2px;
15
+
16
+ width: 100%;
17
+ height: 2px;
18
+
19
+ background-color: ${(props) => props.theme.palette.grey[200]};
20
+ `;
@@ -1,6 +1,6 @@
1
1
  import { Stack, styled, useMediaQuery, useTheme } from '@mui/material';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { useState } from 'react';
3
+ import React, { useState } from 'react';
4
4
 
5
5
  import { ActionCell, type Actions } from '../ActionCell';
6
6
  import { DataGrid, type DataGridColumns, type DataGridSort } from '../DataGrid';
@@ -3,13 +3,9 @@ import type { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  import { Tag } from '../Tag';
5
5
 
6
+ import React from 'react';
6
7
  import { TagBadge } from '.';
7
8
 
8
- /**
9
- * ### [Figma](https://www.figma.com/design/3ghN4WjSgkKx5rETR64jqh/Sirius-Design-System-(%D0%90%D0%9A%D0%A2%D0%A3%D0%90%D0%9B%D0%AC%D0%9D%D0%9E)?node-id=284-7165)
10
- * ### [Guide]()
11
- */
12
-
13
9
  const meta: Meta<typeof TagBadge> = {
14
10
  title: 'Components/Data Display/TagBadge',
15
11
  component: TagBadge,
@@ -0,0 +1,81 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { type ChangeEvent, useState } from 'react';
3
+
4
+ import React from 'react';
5
+ import { TextArea } from './TextArea';
6
+
7
+ const meta: Meta<typeof TextArea> = {
8
+ title: 'Components/Inputs/TextArea',
9
+ component: TextArea,
10
+ };
11
+
12
+ export default meta;
13
+
14
+ type Story = StoryObj<typeof TextArea>;
15
+
16
+ export const Interaction: Story = {
17
+ args: {
18
+ label: 'Комментарии',
19
+ helperText: 'Укажите любую доп. информацию',
20
+ },
21
+ parameters: {
22
+ docs: {
23
+ disable: true,
24
+ },
25
+ },
26
+ };
27
+
28
+ export const Example = () => (
29
+ <>
30
+ <TextArea label='Basic' />
31
+ <TextArea label='Disabled' disabled />
32
+ </>
33
+ );
34
+
35
+ export const Controlled = () => {
36
+ const [value, setValue] = useState('');
37
+
38
+ const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
39
+ setValue(event.target.value);
40
+ };
41
+
42
+ return (
43
+ <TextArea label='Доп. информация' value={value} onChange={handleChange} />
44
+ );
45
+ };
46
+
47
+ export const Statuses = () => (
48
+ <>
49
+ <TextArea
50
+ required
51
+ error
52
+ helperText='Обязательно'
53
+ label='Информация об абоненте'
54
+ />
55
+ <TextArea
56
+ success
57
+ helperText='Удачно завершился процесс проверки ключа'
58
+ label='Электронный ключ'
59
+ />
60
+ </>
61
+ );
62
+
63
+ export const Required = () => <TextArea required label='Доп. информация' />;
64
+
65
+ export const FullWidth = () => <TextArea fullWidth label='Длинное поле' />;
66
+
67
+ export const HelperText = () => (
68
+ <>
69
+ <TextArea helperText='Описание поле' label='Доп. информация' />
70
+ <TextArea error helperText='Описание ошибки поля' label='Доп. информация' />
71
+ <TextArea
72
+ success
73
+ helperText='Отображение success статуса'
74
+ label='Доп. информация'
75
+ />
76
+ </>
77
+ );
78
+
79
+ export const Disabled = () => (
80
+ <TextArea disabled helperText='Поле не доступно' label='Доп. информация' />
81
+ );
@@ -0,0 +1,8 @@
1
+ import { TextField } from '../TextField';
2
+ import type { TextFieldProps } from '../TextField';
3
+
4
+ export type TextAreaProps = Omit<TextFieldProps, 'multiline'>;
5
+
6
+ export const TextArea = ({ rows = 7, ...props }: TextAreaProps) => {
7
+ return <TextField multiline rows={rows} {...props} />;
8
+ };
@@ -0,0 +1 @@
1
+ export * from './TextArea';
@@ -3,12 +3,9 @@ import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { type ChangeEvent, useState } from 'react';
4
4
 
5
5
  import { Eye, Search } from 'lucide-react';
6
+ import React from 'react';
6
7
  import { TextField } from './TextField';
7
8
 
8
- /**
9
- * ### [Figma](https://www.figma.com/file/3ghN4WjSgkKx5rETR64jqh/Sirius-Design-System-(%D0%90%D0%9A%D0%A2%D0%A3%D0%90%D0%9B%D0%AC%D0%9D%D0%9E)?type=design&node-id=3211-52609&mode=design&t=lMvg1tmjfSIA2lhp-0)
10
- * ### [Guide]()
11
- */
12
9
  const meta: Meta<typeof TextField> = {
13
10
  title: 'Components/Inputs/TextField',
14
11
  component: TextField,
@@ -5,13 +5,10 @@ import { Button } from '../Button';
5
5
  import { Typography } from '../Typography';
6
6
 
7
7
  import { Info, Plus } from 'lucide-react';
8
+ import React from 'react';
8
9
  import { Container } from '../Container';
9
10
  import { Tooltip } from './Tooltip';
10
11
 
11
- /**
12
- * ### [Figma](https://www.figma.com/file/3ghN4WjSgkKx5rETR64jqh/Sirius-Design-System-(%D0%90%D0%9A%D0%A2%D0%A3%D0%90%D0%9B%D0%AC%D0%9D%D0%9E)?type=design&node-id=13972%3A156442&mode=design&t=LsGtMosbO9B0qzPe-1)
13
- * ### [Guide]()
14
- */
15
12
  const meta: Meta<typeof Tooltip> = {
16
13
  title: 'Components/Data Display/Tooltip',
17
14
  component: Tooltip,
@@ -1,14 +1,12 @@
1
1
  import { styled } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react/*';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import React from 'react';
3
4
  import { Container } from '../Container';
4
5
  import { Paper } from '../Paper';
5
6
  import { Typography } from './Typography';
6
7
 
7
8
  /**
8
9
  * Весь текст должен задаваться через Typography.
9
- *
10
- * ### [Figma](https://www.figma.com/file/3ghN4WjSgkKx5rETR64jqh/Sirius-Design-System-(%D0%90%D0%9A%D0%A2%D0%A3%D0%90%D0%9B%D0%AC%D0%9D%D0%9E)?type=design&node-id=1-347&mode=design&t=lMvg1tmjfSIA2lhp-0)
11
- * ### [Guide]()
12
10
  */
13
11
  const meta: Meta<typeof Typography> = {
14
12
  title: 'Components/Data Display/Typography',
@@ -26,6 +26,8 @@ export * from './ConfigProvider';
26
26
 
27
27
  export * from './ConfirmAction';
28
28
 
29
+ export * from './ConfirmDialog';
30
+
29
31
  export * from './Container';
30
32
 
31
33
  export * from './ContentState';
@@ -56,14 +58,20 @@ export * from './DialogTitle';
56
58
 
57
59
  export * from './Divider';
58
60
 
61
+ export * from './DropdownButton';
62
+
59
63
  export * from './ErrorBoundary';
60
64
 
65
+ export * from './Filename';
66
+
61
67
  export * from './FormControl';
62
68
 
63
69
  export * from './FormControlLabel';
64
70
 
65
71
  export * from './FormHelperText';
66
72
 
73
+ export * from './FormLabel';
74
+
67
75
  export * from './GuidTypography';
68
76
 
69
77
  export * from './IconButton';
@@ -106,16 +114,36 @@ export * from './Placeholder';
106
114
 
107
115
  export * from './Popover';
108
116
 
117
+ export * from './ProgressBar';
118
+
119
+ export * from './Radio';
120
+
121
+ export * from './RadioField';
122
+
123
+ export * from './RadioGroup';
124
+
125
+ export * from './RadioGroupField';
126
+
109
127
  export * from './SearchField';
110
128
 
111
129
  export * from './Select';
112
130
 
131
+ export * from './Skeleton';
132
+
133
+ export * from './Switch';
134
+
135
+ export * from './Tab';
136
+
137
+ export * from './Tabs';
138
+
113
139
  export * from './Tag';
114
140
 
115
141
  export * from './TagBadge';
116
142
 
117
143
  export * from './TagsList';
118
144
 
145
+ export * from './TextArea';
146
+
119
147
  export * from './TextField';
120
148
 
121
149
  export * from './Tooltip';
@@ -1,3 +1,4 @@
1
1
  export * from './useViewportType';
2
2
  export * from './useMenu';
3
3
  export * from './usePopover';
4
+ export * from './useToggle';
@@ -0,0 +1 @@
1
+ export * from './useToggle';
@@ -0,0 +1,76 @@
1
+ import { useState } from 'react';
2
+
3
+ /**
4
+ * тип обозначающий какой угодно рест аргументов
5
+ */
6
+ type Arguments = unknown[];
7
+
8
+ /**
9
+ * хэндлер принимающий на вход неизвестное количество аргументов, неизвестного вида
10
+ */
11
+ type Handler<Args extends Arguments> = (...a: Args) => void;
12
+ /**
13
+ * хэндлер на открытие с неизвестным количеством аргументов, неизвестного вида
14
+ */
15
+ type OpenHandler<Args extends Arguments> = Handler<Args>;
16
+ /**
17
+ * хэндлер на закрытие с неизвестным количеством аргументов, неизвестного вида
18
+ */
19
+ type CloseHandler<Args extends Arguments> = Handler<Args>;
20
+
21
+ type UseToggleResultTuple<
22
+ CloseArgs extends Arguments,
23
+ OpenArgs extends Arguments,
24
+ > = [
25
+ /**
26
+ * флаг активности состояния
27
+ */
28
+ boolean,
29
+ OpenHandler<OpenArgs>,
30
+ CloseHandler<CloseArgs>,
31
+ ];
32
+
33
+ type UseToggleOptions<
34
+ CloseArgs extends Arguments,
35
+ OpenArgs extends Arguments,
36
+ > = {
37
+ /**
38
+ * изначальное состояние активности
39
+ */
40
+ initialState?: boolean;
41
+ /**
42
+ * коллбэк на открытие
43
+ */
44
+ onActive?: OpenHandler<OpenArgs>;
45
+ /**
46
+ * коллбэк на закрытие
47
+ */
48
+ onInactive?: CloseHandler<CloseArgs>;
49
+ };
50
+
51
+ /**
52
+ * хук хранящий стейт активности, и предоставляющий методы переключения с проксируемыми аргументами, позволяет уменьшить бойлерплейт код
53
+ */
54
+ export const useToggle = <
55
+ CloseArgs extends Arguments,
56
+ OpenArgs extends Arguments,
57
+ >(
58
+ params?: UseToggleOptions<CloseArgs, OpenArgs>,
59
+ ): UseToggleResultTuple<CloseArgs, OpenArgs> => {
60
+ const { initialState = false, onInactive, onActive } = params || {};
61
+ const [isActive, setActive] = useState(initialState);
62
+
63
+ // выставляем флаг активности в true, и проксируем все принятые аргументы
64
+ const handleActive: OpenHandler<OpenArgs> = (...args) => {
65
+ setActive(true);
66
+ onActive?.(...args);
67
+ };
68
+
69
+ // выставляем флаг активности в false, и проксируем все принятые аргументы
70
+ const handleInactive: CloseHandler<CloseArgs> = (...args) => {
71
+ setActive(false);
72
+ onInactive?.(...args);
73
+ };
74
+
75
+ return [isActive, handleActive, handleInactive];
76
+ };
package/test.tsx ADDED
@@ -0,0 +1 @@
1
+ import { Select } from './dist';
package/tsconfig.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "outDir": "./dist"
4
+ "outDir": "./dist",
5
+ "isolatedModules": true
5
6
  },
6
7
  "include": ["src"],
7
8
  "exclude": [
@@ -11,5 +12,5 @@
11
12
  "./**/*.test.tsx",
12
13
  "./**/*.test.ts",
13
14
  "./**/*.stories.tsx"
14
- ]
15
+ ],
15
16
  }