@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.
- package/.storybook/main.ts +14 -14
- package/.turbo/turbo-build.log +13 -495
- package/.turbo/turbo-type$colon$check.log +1 -756
- package/CHANGELOG.md +6 -0
- package/dist/components/Autocomplete/styles.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +4 -4
- package/dist/components/Button/useLogic/useLogic.d.ts +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +37 -0
- package/dist/components/ConfirmDialog/index.d.ts +1 -0
- package/dist/components/ConfirmDialog/styles.d.ts +9 -0
- package/dist/components/ConfirmDialog/useLogic/index.d.ts +1 -0
- package/dist/components/ConfirmDialog/useLogic/useLogic.d.ts +10 -0
- package/dist/components/DataGrid/Row/NestedChildren/styles.d.ts +1 -1
- package/dist/components/DataGrid/Row/styles.d.ts +1 -1
- package/dist/components/DropdownButton/DropdownButton.d.ts +9 -0
- package/dist/components/DropdownButton/index.d.ts +1 -0
- package/dist/components/Filename/Filename.d.ts +21 -0
- package/dist/components/Filename/index.d.ts +1 -0
- package/dist/components/Filename/styles.d.ts +17 -0
- package/dist/components/Filename/useLogic/index.d.ts +1 -0
- package/dist/components/Filename/useLogic/useLogic.d.ts +16 -0
- package/dist/components/Filename/useLogic/utils/findExtension/constants.d.ts +1 -0
- package/dist/components/Filename/useLogic/utils/findExtension/findExtension.d.ts +1 -0
- package/dist/components/Filename/useLogic/utils/findExtension/index.d.ts +1 -0
- package/dist/components/Filename/useLogic/utils/index.d.ts +1 -0
- package/dist/components/Filename/useLogic/utils/truncateString/constants.d.ts +1 -0
- package/dist/components/Filename/useLogic/utils/truncateString/index.d.ts +1 -0
- package/dist/components/Filename/useLogic/utils/truncateString/truncateString.d.ts +4 -0
- package/dist/components/FormLabel/FormLabel.d.ts +4 -0
- package/dist/components/FormLabel/index.d.ts +1 -0
- package/dist/components/FormLabel/styles.d.ts +1 -0
- package/dist/components/IconButton/IconButton.d.ts +2 -2
- package/dist/components/IconButton/styles.d.ts +2 -2
- package/dist/components/ListItemButton/ListItemButton.d.ts +2 -2
- package/dist/components/MenuItem/MenuItem.d.ts +1 -1
- package/dist/components/MenuList/types.d.ts +2 -2
- package/dist/components/NavMenu/Item/ItemButton/ItemButton.d.ts +1 -1
- package/dist/components/NavMenu/Item/ItemButton/styles.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +12 -0
- package/dist/components/ProgressBar/index.d.ts +1 -0
- package/dist/components/Radio/Icon/Icon.d.ts +6 -0
- package/dist/components/Radio/Icon/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +9 -0
- package/dist/components/Radio/constants.d.ts +8 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/styles.d.ts +5 -0
- package/dist/components/RadioField/RadioField.d.ts +25 -0
- package/dist/components/RadioField/index.d.ts +1 -0
- package/dist/components/RadioField/styles.d.ts +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +30 -0
- package/dist/components/RadioGroup/RadioGroupContext/RadioGroupContext.d.ts +4 -0
- package/dist/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/RadioGroupContextProvider.d.ts +6 -0
- package/dist/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/index.d.ts +1 -0
- package/dist/components/RadioGroup/RadioGroupContext/index.d.ts +2 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RadioGroupField/RadioGroupField.d.ts +8 -0
- package/dist/components/RadioGroupField/index.d.ts +1 -0
- package/dist/components/SearchField/styles.d.ts +1 -1
- package/dist/components/Select/styles.d.ts +2 -2
- package/dist/components/Skeleton/Skeleton.d.ts +14 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/styles.d.ts +1 -0
- package/dist/components/Switch/Switch.d.ts +4 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/styles.d.ts +1 -0
- package/dist/components/Tab/Tab.d.ts +7 -0
- package/dist/components/Tab/index.d.ts +1 -0
- package/dist/components/Tab/styles.d.ts +1 -0
- package/dist/components/Tabs/Tabs.d.ts +13 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/styles.d.ts +2 -0
- package/dist/components/TextArea/TextArea.d.ts +3 -0
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useToggle/index.d.ts +1 -0
- package/dist/hooks/useToggle/useToggle.d.ts +43 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +150 -150
- package/package.json +1 -1
- package/rslib.config.ts +26 -26
- package/src/components/Accordion/Accordion.stories.tsx +2 -0
- package/src/components/ActionCell/ActionCell.stories.tsx +1 -0
- package/src/components/ActionCell/MainAction/MainAction.tsx +1 -0
- package/src/components/AsyncAutocomplete/AsyncAutocomplete.stories.tsx +1 -0
- package/src/components/Autocomplete/Autocomplete.stories.tsx +1 -0
- package/src/components/Badge/Badge.stories.tsx +1 -0
- package/src/components/BottomDrawer/BottomDrawer.stories.tsx +2 -1
- package/src/components/Button/Button.stories.tsx +2 -1
- package/src/components/Button/Button.tsx +9 -10
- package/src/components/Button/useLogic/useLogic.ts +2 -5
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -3
- package/src/components/CheckboxField/CheckboxField.stories.tsx +1 -0
- package/src/components/Chevron/Chevron.stories.tsx +1 -0
- package/src/components/CircularProgress/CircularProgress.stories.tsx +1 -0
- package/src/components/Collapse/Collapse.stories.tsx +1 -0
- package/src/components/ConfirmAction/ConfirmAction.stories.tsx +1 -3
- package/src/components/ConfirmDialog/ConfirmDialog.stories.tsx +69 -0
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +83 -0
- package/src/components/ConfirmDialog/index.ts +1 -0
- package/src/components/ConfirmDialog/styles.ts +8 -0
- package/src/components/ConfirmDialog/useLogic/index.ts +1 -0
- package/src/components/ConfirmDialog/useLogic/useLogic.ts +23 -0
- package/src/components/ContentState/ContentState.stories.tsx +1 -0
- package/src/components/CopyTypography/CopyTypography.stories.tsx +1 -2
- package/src/components/DataGrid/DataGrid.stories.tsx +1 -0
- package/src/components/DataGridActionCell/DataGridActionCell.stories.tsx +1 -0
- package/src/components/DataGridPagination/DataGridPagination.stories.tsx +1 -0
- package/src/components/Description/Description.stories.tsx +1 -0
- package/src/components/DescriptionList/DescriptionList.stories.tsx +1 -0
- package/src/components/Dialog/Dialog.stories.tsx +1 -0
- package/src/components/DialogActions/DialogActions.stories.tsx +1 -3
- package/src/components/DialogContent/DialogContent.stories.tsx +1 -3
- package/src/components/DialogContentText/DialogContentText.stories.tsx +1 -0
- package/src/components/DialogHeader/DialogHeader.stories.tsx +1 -0
- package/src/components/Divider/Divider.stories.tsx +1 -0
- package/src/components/DropdownButton/DropdownButton.stories.tsx +191 -0
- package/src/components/DropdownButton/DropdownButton.tsx +46 -0
- package/src/components/DropdownButton/index.ts +1 -0
- package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +1 -0
- package/src/components/Filename/Filename.stories.tsx +244 -0
- package/src/components/Filename/Filename.tsx +57 -0
- package/src/components/Filename/index.ts +1 -0
- package/src/components/Filename/styles.ts +18 -0
- package/src/components/Filename/useLogic/index.ts +1 -0
- package/src/components/Filename/useLogic/useLogic.ts +36 -0
- package/src/components/Filename/useLogic/utils/findExtension/constants.ts +16 -0
- package/src/components/Filename/useLogic/utils/findExtension/findExtension.ts +17 -0
- package/src/components/Filename/useLogic/utils/findExtension/index.ts +1 -0
- package/src/components/Filename/useLogic/utils/index.ts +1 -0
- package/src/components/Filename/useLogic/utils/truncateString/constants.ts +1 -0
- package/src/components/Filename/useLogic/utils/truncateString/index.ts +1 -0
- package/src/components/Filename/useLogic/utils/truncateString/truncateString.ts +24 -0
- package/src/components/FormLabel/FormLabel.tsx +11 -0
- package/src/components/FormLabel/index.ts +1 -0
- package/src/components/FormLabel/styles.ts +6 -0
- package/src/components/GuidTypography/GuidTypography.stories.tsx +1 -0
- package/src/components/IconButton/IconButton.stories.tsx +1 -1
- package/src/components/IconButton/IconButton.tsx +11 -16
- package/src/components/IconButton/styles.ts +24 -24
- package/src/components/IconDropdownButton/IconDropdownButton.stories.tsx +1 -0
- package/src/components/InternalErrorPlaceholder/InternalErrorPlaceholder.stories.tsx +1 -0
- package/src/components/Link/Link.stories.tsx +1 -0
- package/src/components/List/List.stories.tsx +1 -0
- package/src/components/ListItem/ListItem.stories.tsx +1 -0
- package/src/components/ListItemButton/ListItemButton.stories.tsx +1 -0
- package/src/components/ListItemButton/ListItemButton.tsx +3 -9
- package/src/components/ListItemIcon/ListItemIcon.stories.tsx +1 -0
- package/src/components/ListItemText/ListItemText.stories.tsx +1 -0
- package/src/components/ListSubheader/ListSubheader.stories.tsx +1 -0
- package/src/components/Menu/Menu.stories.tsx +1 -0
- package/src/components/MenuItem/MenuItem.stories.tsx +1 -0
- package/src/components/MenuItem/MenuItem.tsx +1 -2
- package/src/components/MenuList/MenuList.stories.tsx +1 -0
- package/src/components/MenuList/types.ts +3 -8
- package/src/components/NavMenu/Item/ItemButton/ItemButton.tsx +1 -2
- package/src/components/NavMenu/NavMenu.stories.tsx +1 -0
- package/src/components/OutdatedReleasePlaceholder/OutdatedReleasePlaceholder.stories.tsx +1 -0
- package/src/components/OverflowTypography/OverflowTypography.stories.tsx +1 -8
- package/src/components/Pagination/Pagination.stories.tsx +1 -0
- package/src/components/Placeholder/Placeholder.stories.tsx +1 -0
- package/src/components/Popover/Popover.stories.tsx +1 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +31 -0
- package/src/components/ProgressBar/ProgressBar.tsx +26 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/Radio/Icon/Icon.tsx +37 -0
- package/src/components/Radio/Icon/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +32 -0
- package/src/components/Radio/Radio.tsx +24 -0
- package/src/components/Radio/constants.ts +9 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Radio/styles.ts +70 -0
- package/src/components/RadioField/RadioField.stories.tsx +74 -0
- package/src/components/RadioField/RadioField.tsx +55 -0
- package/src/components/RadioField/index.ts +1 -0
- package/src/components/RadioField/styles.ts +10 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +60 -0
- package/src/components/RadioGroup/RadioGroup.tsx +79 -0
- package/src/components/RadioGroup/RadioGroupContext/RadioGroupContext.ts +9 -0
- package/src/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/RadioGroupContextProvider.tsx +18 -0
- package/src/components/RadioGroup/RadioGroupContext/RadioGroupContextProvider/index.ts +1 -0
- package/src/components/RadioGroup/RadioGroupContext/index.ts +3 -0
- package/src/components/RadioGroup/index.ts +3 -0
- package/src/components/RadioGroupField/RadioGroupField.tsx +17 -0
- package/src/components/RadioGroupField/index.ts +1 -0
- package/src/components/Select/Select.stories.tsx +0 -4
- package/src/components/Skeleton/Skeleton.stories.tsx +78 -0
- package/src/components/Skeleton/Skeleton.tsx +31 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Skeleton/styles.ts +16 -0
- package/src/components/Switch/Switch.stories.tsx +179 -0
- package/src/components/Switch/Switch.tsx +14 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Switch/styles.ts +14 -0
- package/src/components/Tab/Tab.stories.tsx +53 -0
- package/src/components/Tab/Tab.tsx +20 -0
- package/src/components/Tab/index.ts +1 -0
- package/src/components/Tab/styles.ts +22 -0
- package/src/components/Tabs/Tabs.stories.tsx +74 -0
- package/src/components/Tabs/Tabs.tsx +27 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/styles.ts +20 -0
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/TagBadge/TagBadge.stories.tsx +1 -5
- package/src/components/TextArea/TextArea.stories.tsx +81 -0
- package/src/components/TextArea/TextArea.tsx +12 -0
- package/src/components/TextArea/index.ts +1 -0
- package/src/components/TextField/TextField.stories.tsx +1 -4
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -4
- package/src/components/Typography/Typography.stories.tsx +2 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useToggle/index.ts +1 -0
- package/src/hooks/useToggle/useToggle.ts +76 -0
- package/test.tsx +1 -0
- 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,12 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { TextField } from '../TextField';
|
|
4
|
+
import type { TextFieldProps } from '../TextField';
|
|
5
|
+
|
|
6
|
+
export type TextAreaProps = Omit<TextFieldProps, 'multiline'>;
|
|
7
|
+
|
|
8
|
+
export const TextArea = forwardRef<HTMLDivElement, TextAreaProps>(
|
|
9
|
+
({ rows = 7, ...props }, ref) => {
|
|
10
|
+
return <TextField ref={ref} multiline rows={rows} {...props} />;
|
|
11
|
+
},
|
|
12
|
+
);
|
|
@@ -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',
|
package/src/hooks/index.ts
CHANGED
|
@@ -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
|
}
|