@qoretechnologies/reqore 0.30.5 → 0.30.6
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/CODE_OF_CONDUCT.md +105 -0
- package/CONTRIBUTING.MD +78 -0
- package/LICENSE +1 -1
- package/README.md +44 -2
- package/SECURITY.md +5 -0
- package/__tests__/collection.test.tsx +1 -1
- package/__tests__/{control_group.test.tsx → control_group.text.tsx} +2 -4
- package/__tests__/modal.test.tsx +2 -74
- package/__tests__/panel.test.tsx +24 -96
- package/__tests__/popover.test.tsx +2 -24
- package/__tests__/tabs.test.tsx +0 -75
- package/dist/components/Button/index.d.ts +2 -7
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +20 -30
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +3 -6
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +2 -7
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +53 -57
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +5 -5
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +4 -15
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/column.d.ts.map +1 -1
- package/dist/components/Columns/column.js +1 -1
- package/dist/components/Columns/column.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +4 -21
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +55 -250
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +3 -3
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +16 -27
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +0 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +3 -3
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Effect/index.d.ts +10 -10
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +6 -7
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +6 -5
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +7 -14
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +0 -2
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +4 -10
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +10 -12
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +0 -2
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +2 -2
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +2 -2
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +10 -10
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Notifications/index.d.ts +1 -1
- package/dist/components/Notifications/index.d.ts.map +1 -1
- package/dist/components/Notifications/notification.d.ts +1 -1
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Panel/index.d.ts +6 -13
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +44 -78
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +2 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Spacer/index.d.ts +0 -2
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +7 -29
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Table/header.js +2 -2
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.js +2 -2
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +2 -3
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +3 -6
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +3 -4
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +5 -0
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +7 -3
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +1 -3
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +3 -8
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +1 -4
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +4 -12
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +0 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +7 -7
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +6 -7
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +2 -2
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +8 -7
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -6
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +12 -24
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tree/index.js +1 -1
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/constants/animations.js +1 -1
- package/dist/constants/sizes.d.ts +2 -2
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +10 -10
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -1
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +8 -10
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +2 -4
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +0 -7
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +0 -2
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +2 -6
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/utils.d.ts +0 -3
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +2 -17
- package/dist/helpers/utils.js.map +1 -1
- package/dist/hooks/useLatestZIndex.js +2 -2
- package/dist/hooks/useLatestZIndex.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +0 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +6 -8
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/styles.d.ts +0 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +5 -6
- package/dist/styles.js.map +1 -1
- package/dist/types/global.d.ts +1 -27
- package/dist/types/global.d.ts.map +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
- package/src/components/Button/index.tsx +34 -79
- package/src/components/Checkbox/index.tsx +2 -3
- package/src/components/Collection/index.tsx +60 -93
- package/src/components/Collection/item.tsx +9 -29
- package/src/components/Columns/column.tsx +0 -1
- package/src/components/ControlGroup/index.tsx +104 -449
- package/src/components/Drawer/index.tsx +27 -28
- package/src/components/Dropdown/index.tsx +1 -3
- package/src/components/Effect/index.tsx +14 -22
- package/src/components/Icon/index.tsx +62 -81
- package/src/components/Input/index.tsx +3 -8
- package/src/components/InternalPopover/index.tsx +126 -131
- package/src/components/Menu/index.tsx +1 -7
- package/src/components/Message/index.tsx +1 -9
- package/src/components/MultiSelect/index.tsx +188 -180
- package/src/components/Panel/index.tsx +100 -227
- package/src/components/Popover/index.tsx +3 -1
- package/src/components/Spacer/index.tsx +14 -63
- package/src/components/Table/header.tsx +2 -2
- package/src/components/Table/headerCell.tsx +2 -2
- package/src/components/Table/helpers.ts +6 -12
- package/src/components/Table/index.tsx +0 -1
- package/src/components/Table/row.tsx +7 -2
- package/src/components/Tabs/content.tsx +3 -11
- package/src/components/Tabs/index.tsx +3 -14
- package/src/components/Tabs/item.tsx +5 -28
- package/src/components/Tabs/list.tsx +3 -7
- package/src/components/Tag/group.tsx +12 -6
- package/src/components/Tag/index.tsx +35 -69
- package/src/components/Tree/index.tsx +1 -1
- package/src/constants/animations.ts +1 -1
- package/src/constants/sizes.ts +10 -10
- package/src/containers/PopoverProvider.tsx +8 -11
- package/src/containers/ReqoreProvider.tsx +35 -40
- package/src/containers/UIProvider.tsx +0 -7
- package/src/context/ReqoreContext.tsx +0 -2
- package/src/helpers/colors.ts +2 -8
- package/src/helpers/utils.ts +0 -18
- package/src/hooks/useLatestZIndex.ts +2 -2
- package/src/hooks/usePopover.tsx +6 -9
- package/src/mock/collectionData.tsx +2 -33
- package/src/stories/Button/Button.stories.tsx +7 -72
- package/src/stories/Checkbox/Checkbox.stories.tsx +3 -6
- package/src/stories/Collection/Collection.stories.tsx +2 -18
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +33 -282
- package/src/stories/Drawer/Drawer.stories.tsx +3 -70
- package/src/stories/Dropdown/Dropdown.stories.tsx +3 -13
- package/src/stories/Icon/Icon.stories.tsx +0 -1
- package/src/stories/Input/Input.stories.tsx +3 -5
- package/src/stories/Menu/Menu.stories.tsx +0 -2
- package/src/stories/Message/Message.stories.tsx +0 -7
- package/src/stories/Panel/Panel.stories.tsx +13 -147
- package/src/stories/Popover/Popover.stories.tsx +82 -88
- package/src/stories/Tabs/Tabs.stories.tsx +15 -33
- package/src/stories/Tag/Tag.stories.tsx +3 -23
- package/src/stories/TextArea/TextArea.stories.tsx +3 -3
- package/src/styles.ts +0 -6
- package/src/types/global.ts +0 -28
- package/tests.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo
|
|
1
|
+
import { memo } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { SIZE_TO_NUMBER, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
4
4
|
import { changeLightness } from '../../helpers/colors';
|
|
@@ -6,68 +6,32 @@ import { useReqoreTheme } from '../../hooks/useTheme';
|
|
|
6
6
|
import { IReqoreIntent, IWithReqoreCustomTheme, IWithReqoreEffect } from '../../types/global';
|
|
7
7
|
import { StyledEffect } from '../Effect';
|
|
8
8
|
|
|
9
|
-
export const StyledSpacer = styled
|
|
10
|
-
display: ${({ horizontal }) => (horizontal ? 'inline-flex' : 'flex')};
|
|
11
|
-
vertical-align: middle;
|
|
12
|
-
|
|
13
|
-
${({ horizontal, vertical }) => {
|
|
14
|
-
if (horizontal) {
|
|
15
|
-
return css`
|
|
16
|
-
flex-flow: row;
|
|
17
|
-
`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (vertical) {
|
|
21
|
-
return css`
|
|
22
|
-
flex-flow: column;
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
25
|
-
}}
|
|
26
|
-
|
|
27
|
-
flex-shrink: 0;
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
export const StyledSpace = styled.div`
|
|
31
|
-
display: inline-block;
|
|
32
|
-
flex: 0 0 auto;
|
|
33
|
-
|
|
9
|
+
export const StyledSpacer = styled(StyledEffect)`
|
|
34
10
|
${({ horizontal, vertical, width, height, lineSize }) => {
|
|
35
11
|
if (horizontal) {
|
|
36
12
|
return css`
|
|
37
|
-
|
|
13
|
+
margin-left: ${width / 2}px;
|
|
14
|
+
margin-right: ${width / 2}px;
|
|
15
|
+
width: ${lineSize === 'none' ? 1 : SIZE_TO_NUMBER[lineSize]}px;
|
|
38
16
|
height: ${height ? `${height}px` : `${TEXT_FROM_SIZE.normal}px`};
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
display: inline-block;
|
|
39
19
|
`;
|
|
40
20
|
}
|
|
41
21
|
|
|
42
22
|
if (vertical) {
|
|
43
23
|
return css`
|
|
24
|
+
margin-top: ${height / 2}px;
|
|
25
|
+
margin-bottom: ${height / 2}px;
|
|
26
|
+
height: ${lineSize === 'none' ? 1 : SIZE_TO_NUMBER[lineSize]}px;
|
|
44
27
|
width: ${width ? `${width}px` : '100%'};
|
|
45
|
-
height: ${height / 2 - lineSize / 2}px;
|
|
46
28
|
`;
|
|
47
29
|
}
|
|
48
30
|
}}
|
|
49
|
-
`;
|
|
50
31
|
|
|
51
|
-
export const StyledLine = styled(StyledEffect)`
|
|
52
|
-
flex-shrink: 0;
|
|
53
32
|
background-color: ${({ theme, lineSize }) =>
|
|
54
33
|
lineSize === 'none' ? 'transparent' : changeLightness(theme.main, 0.2)};
|
|
55
|
-
|
|
56
|
-
${({ horizontal, vertical, width, height, lineSize }) => {
|
|
57
|
-
if (horizontal) {
|
|
58
|
-
return css`
|
|
59
|
-
width: ${lineSize}px;
|
|
60
|
-
height: ${height ? `${height}px` : `${TEXT_FROM_SIZE.normal}px`};
|
|
61
|
-
`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (vertical) {
|
|
65
|
-
return css`
|
|
66
|
-
width: ${width ? `${width}px` : '100%'};
|
|
67
|
-
height: ${lineSize}px;
|
|
68
|
-
`;
|
|
69
|
-
}
|
|
70
|
-
}}
|
|
34
|
+
flex-shrink: 0;
|
|
71
35
|
`;
|
|
72
36
|
|
|
73
37
|
export interface IReqoreSpacerProps
|
|
@@ -102,29 +66,16 @@ export const ReqoreSpacer = memo(
|
|
|
102
66
|
}
|
|
103
67
|
}
|
|
104
68
|
|
|
105
|
-
const _lineSize = useMemo(
|
|
106
|
-
() => (lineSize === 'none' ? 0 : SIZE_TO_NUMBER[lineSize]),
|
|
107
|
-
[lineSize]
|
|
108
|
-
);
|
|
109
|
-
|
|
110
69
|
return (
|
|
111
70
|
<StyledSpacer
|
|
112
71
|
as='div'
|
|
113
72
|
{...rest}
|
|
73
|
+
theme={theme}
|
|
74
|
+
lineSize={lineSize}
|
|
114
75
|
horizontal={horizontal}
|
|
115
76
|
vertical={vertical}
|
|
116
77
|
className='reqore-spacer'
|
|
117
|
-
|
|
118
|
-
<StyledSpace {...rest} horizontal={horizontal} vertical={vertical} lineSize={_lineSize} />
|
|
119
|
-
<StyledLine
|
|
120
|
-
{...rest}
|
|
121
|
-
horizontal={horizontal}
|
|
122
|
-
vertical={vertical}
|
|
123
|
-
theme={theme}
|
|
124
|
-
lineSize={_lineSize}
|
|
125
|
-
/>
|
|
126
|
-
<StyledSpace {...rest} horizontal={horizontal} vertical={vertical} lineSize={_lineSize} />
|
|
127
|
-
</StyledSpacer>
|
|
78
|
+
/>
|
|
128
79
|
);
|
|
129
80
|
}
|
|
130
81
|
);
|
|
@@ -2,9 +2,9 @@ import styled, { css } from 'styled-components';
|
|
|
2
2
|
import { IReqoreTableColumn, IReqoreTableSort } from '.';
|
|
3
3
|
import { IReqoreTheme } from '../../constants/theme';
|
|
4
4
|
import { changeLightness } from '../../helpers/colors';
|
|
5
|
-
import { alignToFlexAlign } from '../../helpers/utils';
|
|
6
5
|
import { IReqoreIconName } from '../../types/icons';
|
|
7
6
|
import ReqoreTableHeaderCell, { StyledTableHeader } from './headerCell';
|
|
7
|
+
import { alignToFlex } from './row';
|
|
8
8
|
|
|
9
9
|
export interface IReqoreTableSectionProps {
|
|
10
10
|
columns: IReqoreTableColumn[];
|
|
@@ -46,7 +46,7 @@ export interface IReqoreTableHeaderStyle {
|
|
|
46
46
|
export const StyledColumnGroupHeader = styled.div<IReqoreTableHeaderStyle>`
|
|
47
47
|
${({ align, theme }) => css`
|
|
48
48
|
background-color: ${changeLightness(theme.main, 0.035)};
|
|
49
|
-
justify-content: ${align ?
|
|
49
|
+
justify-content: ${align ? alignToFlex[align] : 'flex-start'};
|
|
50
50
|
`}
|
|
51
51
|
`;
|
|
52
52
|
|
|
@@ -4,9 +4,9 @@ import styled, { css } from 'styled-components';
|
|
|
4
4
|
import { IReqoreTableColumn, IReqoreTableSort } from '.';
|
|
5
5
|
import { IReqoreTheme } from '../../constants/theme';
|
|
6
6
|
import { changeLightness, getReadableColor } from '../../helpers/colors';
|
|
7
|
-
import { alignToFlexAlign } from '../../helpers/utils';
|
|
8
7
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
9
8
|
import ReqoreIcon from '../Icon';
|
|
9
|
+
import { alignToFlex } from './row';
|
|
10
10
|
|
|
11
11
|
export interface IReqoreTableHeaderCellProps
|
|
12
12
|
extends React.HTMLAttributes<HTMLDivElement>,
|
|
@@ -32,7 +32,7 @@ export const StyledTableHeader = styled.div<IReqoreTableHeaderStyle>`
|
|
|
32
32
|
|
|
33
33
|
${({ align, theme }) => css`
|
|
34
34
|
background-color: ${changeLightness(theme.main, 0.03)};
|
|
35
|
-
justify-content: ${align ?
|
|
35
|
+
justify-content: ${align ? alignToFlex[align] : 'flex-start'};
|
|
36
36
|
`}
|
|
37
37
|
|
|
38
38
|
${({ interactive, theme }) =>
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { firstBy } from
|
|
2
|
-
import { IReqoreTableSort } from
|
|
1
|
+
import { firstBy } from "thenby";
|
|
2
|
+
import { IReqoreTableSort } from ".";
|
|
3
3
|
|
|
4
|
-
export const flipSortDirection = (direction:
|
|
5
|
-
direction ===
|
|
4
|
+
export const flipSortDirection = (direction: "asc" | "desc"): "asc" | "desc" =>
|
|
5
|
+
direction === "asc" ? "desc" : "asc";
|
|
6
6
|
|
|
7
7
|
export const fixSort = (sort?: IReqoreTableSort) => {
|
|
8
|
-
return { ...(sort || {}), direction: sort?.direction ||
|
|
8
|
+
return { ...(sort || {}), direction: sort?.direction || "desc" };
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const sortTableData = (data: any[], sort: IReqoreTableSort) => {
|
|
12
|
-
const { by,
|
|
12
|
+
const { by, direction } = sort;
|
|
13
13
|
|
|
14
14
|
if (!by) {
|
|
15
15
|
return data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
if (thenBy) {
|
|
19
|
-
return [...data].sort(
|
|
20
|
-
firstBy(by, { ignoreCase: true, direction }).thenBy(thenBy, { ignoreCase: true, direction })
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
18
|
return [...data].sort(firstBy(by, { ignoreCase: true, direction }));
|
|
25
19
|
};
|
|
@@ -13,7 +13,6 @@ import { ReqorePopover } from '../..';
|
|
|
13
13
|
import { SIZE_TO_PX, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
14
14
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
15
15
|
import { changeLightness, getReadableColorFrom } from '../../helpers/colors';
|
|
16
|
-
import { alignToFlexAlign } from '../../helpers/utils';
|
|
17
16
|
import { TReqoreColor, TReqoreHexColor } from '../Effect';
|
|
18
17
|
import { ReqoreH4 } from '../Header';
|
|
19
18
|
import ReqoreIcon from '../Icon';
|
|
@@ -76,6 +75,12 @@ export interface IReqoreTableCellStyle {
|
|
|
76
75
|
striped?: boolean;
|
|
77
76
|
}
|
|
78
77
|
|
|
78
|
+
export const alignToFlex = {
|
|
79
|
+
center: 'center',
|
|
80
|
+
left: 'flex-start',
|
|
81
|
+
right: 'flex-end',
|
|
82
|
+
};
|
|
83
|
+
|
|
79
84
|
export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
80
85
|
${({ width, grow }) =>
|
|
81
86
|
css`
|
|
@@ -132,7 +137,7 @@ export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
|
132
137
|
return css`
|
|
133
138
|
display: flex;
|
|
134
139
|
align-items: center;
|
|
135
|
-
justify-content: ${align ?
|
|
140
|
+
justify-content: ${align ? alignToFlex[align] : 'flex-start'};
|
|
136
141
|
flex-shrink: 0;
|
|
137
142
|
border-bottom: ${!flat ? '1px solid ' : undefined};
|
|
138
143
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
export type TReqoreTabsContentPadding = 'horizontal' | 'vertical' | 'none' | 'both' | true | false;
|
|
5
|
-
|
|
6
4
|
export interface IReqoreTabsContent extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
5
|
children?: any;
|
|
8
6
|
tabId: string | number;
|
|
9
|
-
padded?: TReqoreTabsContentPadding;
|
|
10
7
|
}
|
|
11
8
|
|
|
12
9
|
const StyledTabsContent = styled.div`
|
|
@@ -14,16 +11,11 @@ const StyledTabsContent = styled.div`
|
|
|
14
11
|
flex-flow: column;
|
|
15
12
|
overflow: hidden;
|
|
16
13
|
flex: 1;
|
|
17
|
-
padding:
|
|
18
|
-
padded === 'none' || padded === false
|
|
19
|
-
? undefined
|
|
20
|
-
: `${padded === 'both' || padded === true || padded === 'vertical' ? 10 : 0}px ${
|
|
21
|
-
padded === 'both' || padded === true || padded === 'horizontal' ? 10 : 0
|
|
22
|
-
}px}`};
|
|
14
|
+
padding: 10px;
|
|
23
15
|
`;
|
|
24
16
|
|
|
25
|
-
const ReqoreTabsContent = ({ children, className,
|
|
26
|
-
<StyledTabsContent {...rest}
|
|
17
|
+
const ReqoreTabsContent = ({ children, className, ...rest }: IReqoreTabsContent) => (
|
|
18
|
+
<StyledTabsContent {...rest} className={`${className || ''} reqore-tabs-content`}>
|
|
27
19
|
{children}
|
|
28
20
|
</StyledTabsContent>
|
|
29
21
|
);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import React, { ReactElement, useState } from 'react';
|
|
2
|
-
import { useUpdateEffect } from 'react-use';
|
|
1
|
+
import React, { ReactElement, useEffect, useState } from 'react';
|
|
3
2
|
import styled, { css } from 'styled-components';
|
|
4
3
|
import { TSizes } from '../../constants/sizes';
|
|
5
4
|
import { IReqoreCustomTheme, TReqoreIntent } from '../../constants/theme';
|
|
6
5
|
import { IReqoreIconName } from '../../types/icons';
|
|
7
6
|
import { IReqoreButtonProps } from '../Button';
|
|
8
|
-
import { TReqoreTabsContentPadding } from './content';
|
|
9
7
|
import ReqoreTabsList from './list';
|
|
10
8
|
|
|
11
9
|
export interface IReqoreTabsListItem extends Omit<IReqoreButtonProps, 'id'> {
|
|
@@ -28,8 +26,6 @@ export interface IReqoreTabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
28
26
|
fillParent?: boolean;
|
|
29
27
|
vertical?: boolean;
|
|
30
28
|
activeTabIntent?: TReqoreIntent;
|
|
31
|
-
padded?: boolean;
|
|
32
|
-
tabsPadding?: TReqoreTabsContentPadding;
|
|
33
29
|
wrapTabNames?: boolean;
|
|
34
30
|
flat?: boolean;
|
|
35
31
|
size?: TSizes;
|
|
@@ -65,13 +61,11 @@ const ReqoreTabs = ({
|
|
|
65
61
|
wrapTabNames,
|
|
66
62
|
customTheme,
|
|
67
63
|
intent,
|
|
68
|
-
padded,
|
|
69
|
-
tabsPadding,
|
|
70
64
|
...rest
|
|
71
65
|
}: IReqoreTabsProps) => {
|
|
72
66
|
const [_activeTab, setActiveTab] = useState<string | number>(activeTab || tabs[0].id);
|
|
73
67
|
|
|
74
|
-
|
|
68
|
+
useEffect(() => {
|
|
75
69
|
if (activeTab || activeTab === 0) {
|
|
76
70
|
setActiveTab(activeTab);
|
|
77
71
|
|
|
@@ -90,7 +84,6 @@ const ReqoreTabs = ({
|
|
|
90
84
|
>
|
|
91
85
|
<ReqoreTabsList
|
|
92
86
|
tabs={tabs}
|
|
93
|
-
padded={padded}
|
|
94
87
|
flat={flat}
|
|
95
88
|
fill={fill}
|
|
96
89
|
size={size}
|
|
@@ -111,11 +104,7 @@ const ReqoreTabs = ({
|
|
|
111
104
|
}}
|
|
112
105
|
/>
|
|
113
106
|
{React.Children.map(children, (child) =>
|
|
114
|
-
child && child.props?.tabId === _activeTab
|
|
115
|
-
? React.cloneElement(child, {
|
|
116
|
-
padded: child.props?.padded || tabsPadding,
|
|
117
|
-
})
|
|
118
|
-
: null
|
|
107
|
+
child && child.props?.tabId === _activeTab ? child : null
|
|
119
108
|
)}
|
|
120
109
|
</StyledTabs>
|
|
121
110
|
);
|
|
@@ -18,7 +18,6 @@ export interface IReqoreTabListItemProps extends IReqoreTabsListItem, IWithReqor
|
|
|
18
18
|
wrapTabNames?: boolean;
|
|
19
19
|
fill?: boolean;
|
|
20
20
|
className?: string;
|
|
21
|
-
padded?: boolean;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export interface IReqoreTabListItemStyle extends IReqoreTabListItemProps {
|
|
@@ -28,7 +27,7 @@ export interface IReqoreTabListItemStyle extends IReqoreTabListItemProps {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
31
|
-
${({ disabled, vertical, size, fill
|
|
30
|
+
${({ disabled, vertical, size, fill }: IReqoreTabListItemStyle) => {
|
|
32
31
|
return css`
|
|
33
32
|
display: flex;
|
|
34
33
|
flex-shrink: 0;
|
|
@@ -46,40 +45,20 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
46
45
|
border-right: 0;
|
|
47
46
|
}
|
|
48
47
|
${StyledButton}:last-child {
|
|
49
|
-
border-top-right-radius: 0
|
|
50
|
-
border-bottom-right-radius: 0
|
|
48
|
+
border-top-right-radius: 0;
|
|
49
|
+
border-bottom-right-radius: 0;
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
${padded === false &&
|
|
54
|
-
css`
|
|
55
|
-
&:first-child {
|
|
56
|
-
padding-top: 0;
|
|
57
|
-
}
|
|
58
|
-
&:last-child {
|
|
59
|
-
padding-bottom: 0;
|
|
60
|
-
}
|
|
61
|
-
`}
|
|
62
51
|
`
|
|
63
52
|
: css`
|
|
64
53
|
${StyledButton} {
|
|
65
54
|
border-bottom: 0;
|
|
66
55
|
}
|
|
67
56
|
${StyledButton}:first-child {
|
|
68
|
-
border-bottom-left-radius: 0
|
|
57
|
+
border-bottom-left-radius: 0;
|
|
69
58
|
}
|
|
70
59
|
${StyledButton}:last-child {
|
|
71
|
-
border-bottom-right-radius: 0
|
|
60
|
+
border-bottom-right-radius: 0;
|
|
72
61
|
}
|
|
73
|
-
|
|
74
|
-
${padded === false &&
|
|
75
|
-
css`
|
|
76
|
-
&:first-child {
|
|
77
|
-
padding-left: 0;
|
|
78
|
-
}
|
|
79
|
-
&:last-child {
|
|
80
|
-
padding-right: 0;
|
|
81
|
-
}
|
|
82
|
-
`}
|
|
83
62
|
`}
|
|
84
63
|
|
|
85
64
|
${fill &&
|
|
@@ -130,7 +109,6 @@ const ReqoreTabsListItem = memo(
|
|
|
130
109
|
flat = true,
|
|
131
110
|
wrapTabNames,
|
|
132
111
|
id,
|
|
133
|
-
padded,
|
|
134
112
|
...rest
|
|
135
113
|
}: IReqoreTabListItemProps,
|
|
136
114
|
ref
|
|
@@ -151,7 +129,6 @@ const ReqoreTabsListItem = memo(
|
|
|
151
129
|
vertical={vertical}
|
|
152
130
|
theme={theme}
|
|
153
131
|
fill={fill}
|
|
154
|
-
padded={padded}
|
|
155
132
|
>
|
|
156
133
|
{label || icon ? (
|
|
157
134
|
<ReqoreControlGroup stack size={size} fluid={fill || vertical}>
|
|
@@ -162,7 +162,6 @@ const ReqoreTabsList = ({
|
|
|
162
162
|
flat,
|
|
163
163
|
size,
|
|
164
164
|
intent,
|
|
165
|
-
padded,
|
|
166
165
|
...rest
|
|
167
166
|
}: IReqoreTabsListProps) => {
|
|
168
167
|
const [ref, { width }] = useMeasure();
|
|
@@ -204,21 +203,19 @@ const ReqoreTabsList = ({
|
|
|
204
203
|
label: getMoreLabel(item, activeTab),
|
|
205
204
|
active: !!isTabHidden(item, activeTab),
|
|
206
205
|
activeIntent: activeTabIntent,
|
|
207
|
-
intent: !!isTabHidden(item, activeTab) ? activeTabData?.intent : undefined,
|
|
208
|
-
effect: !!isTabHidden(item, activeTab) ? activeTabData?.effect : undefined,
|
|
209
206
|
customTheme: !!isTabHidden(item, activeTab)
|
|
210
|
-
?
|
|
207
|
+
? {
|
|
208
|
+
main: currentTabColor,
|
|
209
|
+
}
|
|
211
210
|
: theme,
|
|
212
211
|
vertical,
|
|
213
212
|
flat,
|
|
214
213
|
size,
|
|
215
|
-
padded,
|
|
216
214
|
className: 'reqore-tabs-list-item-menu',
|
|
217
215
|
} as IReqoreTabListItemProps
|
|
218
216
|
}
|
|
219
217
|
closeOnOutsideClick
|
|
220
218
|
isReqoreComponent
|
|
221
|
-
noWrapper
|
|
222
219
|
handler='hoverStay'
|
|
223
220
|
content={
|
|
224
221
|
<ReqoreMenu customTheme={theme}>
|
|
@@ -281,7 +278,6 @@ const ReqoreTabsList = ({
|
|
|
281
278
|
fill={fill}
|
|
282
279
|
size={size}
|
|
283
280
|
flat={flat}
|
|
284
|
-
padded={padded}
|
|
285
281
|
activeIntent={activeTabIntent}
|
|
286
282
|
wrapTabNames={wrapTabNames}
|
|
287
283
|
{...item}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
+
import { StyledTag } from '.';
|
|
3
4
|
import { GAP_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
4
5
|
import { IWithReqoreMinimal, IWithReqoreSize } from '../../types/global';
|
|
5
6
|
|
|
@@ -10,14 +11,19 @@ export interface IReqoreTagGroup
|
|
|
10
11
|
children: any;
|
|
11
12
|
gapSize?: TSizes;
|
|
12
13
|
columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
13
|
-
|
|
14
|
+
hasBottomMargin?: boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const StyledTagGroup = styled.div`
|
|
17
18
|
flex-shrink: 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
${StyledTag} {
|
|
21
|
+
&:not(:last-child) {
|
|
22
|
+
margin-right: ${({ gapSize }: IReqoreTagGroup) => `${GAP_FROM_SIZE[gapSize]}px`};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
margin-bottom: ${({ hasBottomMargin }) => (hasBottomMargin ? '5px' : '0px')};
|
|
26
|
+
}
|
|
21
27
|
`;
|
|
22
28
|
|
|
23
29
|
const ReqoreTagGroup = ({
|
|
@@ -27,13 +33,13 @@ const ReqoreTagGroup = ({
|
|
|
27
33
|
minimal,
|
|
28
34
|
className,
|
|
29
35
|
columns,
|
|
30
|
-
|
|
36
|
+
hasBottomMargin = true,
|
|
31
37
|
...rest
|
|
32
38
|
}: IReqoreTagGroup) => (
|
|
33
39
|
<StyledTagGroup
|
|
34
40
|
{...rest}
|
|
35
41
|
gapSize={gapSize}
|
|
36
|
-
|
|
42
|
+
hasBottomMargin={hasBottomMargin}
|
|
37
43
|
className={`${className || ''} reqore-tag-group`}
|
|
38
44
|
>
|
|
39
45
|
{React.Children.map(children, (child) =>
|