@qoretechnologies/reqore 0.30.4 → 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 +1 -4
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +7 -10
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.js +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 -20
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +55 -241
- 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 +9 -9
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +1 -1
- 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 +6 -9
- 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/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/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 +3 -4
- 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 -20
- 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/utils.d.ts +0 -2
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +2 -4
- 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 +5 -17
- package/src/components/Checkbox/index.tsx +1 -1
- 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 +103 -426
- package/src/components/Drawer/index.tsx +27 -28
- package/src/components/Dropdown/index.tsx +1 -3
- package/src/components/Effect/index.tsx +0 -1
- package/src/components/Icon/index.tsx +62 -81
- package/src/components/Input/index.tsx +4 -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/helpers.ts +6 -12
- package/src/components/Table/index.tsx +0 -1
- 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 +0 -4
- package/src/components/Tag/group.tsx +12 -6
- package/src/components/Tag/index.tsx +35 -67
- 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/utils.ts +0 -3
- 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 +6 -14
- 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 +34 -220
- 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 -32
- 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
|
);
|
|
@@ -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
|
};
|
|
@@ -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();
|
|
@@ -212,13 +211,11 @@ const ReqoreTabsList = ({
|
|
|
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) =>
|
|
@@ -21,13 +21,10 @@ import {
|
|
|
21
21
|
} from '../../helpers/colors';
|
|
22
22
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
23
23
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
24
|
-
import { ActiveIconScale, InactiveIconScale } from '../../styles';
|
|
25
24
|
import {
|
|
26
25
|
IReqoreDisabled,
|
|
27
26
|
IReqoreIntent,
|
|
28
27
|
IWithReqoreEffect,
|
|
29
|
-
IWithReqoreFixed,
|
|
30
|
-
IWithReqoreFluid,
|
|
31
28
|
IWithReqoreMinimal,
|
|
32
29
|
IWithReqoreTooltip,
|
|
33
30
|
} from '../../types/global';
|
|
@@ -37,7 +34,6 @@ import ReqoreIcon from '../Icon';
|
|
|
37
34
|
|
|
38
35
|
export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
|
|
39
36
|
icon: IReqoreIconName;
|
|
40
|
-
show?: boolean;
|
|
41
37
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
42
38
|
}
|
|
43
39
|
|
|
@@ -46,9 +42,7 @@ export interface IReqoreTagProps
|
|
|
46
42
|
IWithReqoreTooltip,
|
|
47
43
|
IReqoreDisabled,
|
|
48
44
|
IWithReqoreEffect,
|
|
49
|
-
IWithReqoreMinimal
|
|
50
|
-
IWithReqoreFluid,
|
|
51
|
-
IWithReqoreFixed {
|
|
45
|
+
IWithReqoreMinimal {
|
|
52
46
|
size?: TSizes;
|
|
53
47
|
label?: string | number;
|
|
54
48
|
labelKey?: string | number;
|
|
@@ -56,9 +50,6 @@ export interface IReqoreTagProps
|
|
|
56
50
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
57
51
|
icon?: IReqoreIconName;
|
|
58
52
|
rightIcon?: IReqoreIconName;
|
|
59
|
-
iconColor?: TReqoreEffectColor;
|
|
60
|
-
leftIconColor?: TReqoreEffectColor;
|
|
61
|
-
rightIconColor?: TReqoreEffectColor;
|
|
62
53
|
color?: TReqoreEffectColor;
|
|
63
54
|
actions?: IReqoreTagAction[];
|
|
64
55
|
width?: string;
|
|
@@ -86,14 +77,10 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
86
77
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
87
78
|
|
|
88
79
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
89
|
-
width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
90
|
-
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
91
80
|
border-radius: ${({ asBadge, size }) => (asBadge ? 18 : RADIUS_FROM_SIZE[size])}px;
|
|
92
81
|
width: ${({ width }) => width || undefined};
|
|
93
82
|
transition: all 0.2s ease-out;
|
|
94
83
|
|
|
95
|
-
${InactiveIconScale};
|
|
96
|
-
|
|
97
84
|
${({ wrap, hasWidth }) =>
|
|
98
85
|
wrap || hasWidth
|
|
99
86
|
? css`
|
|
@@ -119,24 +106,16 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
119
106
|
`}
|
|
120
107
|
|
|
121
108
|
${({ theme, color, interactive, minimal, effect }) =>
|
|
122
|
-
interactive
|
|
109
|
+
interactive && !effect?.gradient
|
|
123
110
|
? css`
|
|
124
111
|
cursor: pointer;
|
|
125
112
|
&:hover {
|
|
126
|
-
.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
css`
|
|
133
|
-
background-color: ${changeLightness(color || theme.main, color ? 0.05 : 0.15)};
|
|
134
|
-
color: ${minimal
|
|
135
|
-
? getReadableColor(theme, undefined, undefined, false, theme.originalMain)
|
|
136
|
-
: color
|
|
137
|
-
? getReadableColorFrom(color)
|
|
138
|
-
: getReadableColor(theme, undefined, undefined)};
|
|
139
|
-
`}
|
|
113
|
+
background-color: ${changeLightness(color || theme.main, color ? 0.05 : 0.15)};
|
|
114
|
+
color: ${minimal
|
|
115
|
+
? getReadableColor(theme, undefined, undefined, false, theme.originalMain)
|
|
116
|
+
: color
|
|
117
|
+
? getReadableColorFrom(color)
|
|
118
|
+
: getReadableColor(theme, undefined, undefined)};
|
|
140
119
|
}
|
|
141
120
|
`
|
|
142
121
|
: undefined}
|
|
@@ -151,6 +130,8 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
151
130
|
`}
|
|
152
131
|
`;
|
|
153
132
|
|
|
133
|
+
const StyledTagRightIcon = styled(ReqoreIcon)``;
|
|
134
|
+
|
|
154
135
|
const StyledTagKeyWrapper = styled.span<{ size: TSizes }>`
|
|
155
136
|
display: flex;
|
|
156
137
|
align-items: center;
|
|
@@ -246,9 +227,6 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
246
227
|
minimal,
|
|
247
228
|
wrap = false,
|
|
248
229
|
width,
|
|
249
|
-
leftIconColor,
|
|
250
|
-
rightIconColor,
|
|
251
|
-
iconColor,
|
|
252
230
|
...rest
|
|
253
231
|
}: IReqoreTagProps,
|
|
254
232
|
ref
|
|
@@ -298,14 +276,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
298
276
|
hasWidth={!!width}
|
|
299
277
|
hasKey={!!labelKey}
|
|
300
278
|
>
|
|
301
|
-
{icon &&
|
|
302
|
-
<ReqoreIcon
|
|
303
|
-
icon={icon}
|
|
304
|
-
size={size}
|
|
305
|
-
margin={label ? 'left' : 'both'}
|
|
306
|
-
color={leftIconColor || iconColor}
|
|
307
|
-
/>
|
|
308
|
-
)}
|
|
279
|
+
{icon && <ReqoreIcon icon={icon} size={size} margin={label ? 'left' : 'both'} />}
|
|
309
280
|
{labelKey && (
|
|
310
281
|
<StyledTagContentKey wrap={wrap} hasWidth={!!width} size={size}>
|
|
311
282
|
{labelKey}
|
|
@@ -328,40 +299,37 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
328
299
|
</StyledTagContent>
|
|
329
300
|
) : null}
|
|
330
301
|
{rightIcon && (
|
|
331
|
-
<
|
|
302
|
+
<StyledTagRightIcon
|
|
332
303
|
icon={rightIcon}
|
|
333
304
|
size={size}
|
|
334
305
|
margin={label || icon ? 'right' : 'both'}
|
|
335
|
-
color={rightIconColor || iconColor}
|
|
336
306
|
/>
|
|
337
307
|
)}
|
|
338
308
|
</StyledTagContentWrapper>
|
|
339
309
|
) : null}
|
|
340
310
|
{_size(actions)
|
|
341
|
-
? actions
|
|
342
|
-
.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
</React.Fragment>
|
|
364
|
-
))
|
|
311
|
+
? actions.map((action, index) => (
|
|
312
|
+
<React.Fragment key={index}>
|
|
313
|
+
<ReqorePopover
|
|
314
|
+
component={StyledButtonWrapper}
|
|
315
|
+
componentProps={{
|
|
316
|
+
size,
|
|
317
|
+
color: getCustomColor(action.intent),
|
|
318
|
+
className: 'reqore-tag-action',
|
|
319
|
+
onClick: action.onClick,
|
|
320
|
+
effect: rest.effect,
|
|
321
|
+
}}
|
|
322
|
+
{...(action.tooltip
|
|
323
|
+
? typeof action.tooltip === 'string'
|
|
324
|
+
? { tooltip: action.tooltip }
|
|
325
|
+
: action.tooltip
|
|
326
|
+
: {})}
|
|
327
|
+
noWrapper
|
|
328
|
+
>
|
|
329
|
+
<ReqoreIcon icon={action.icon} size={size} />
|
|
330
|
+
</ReqorePopover>
|
|
331
|
+
</React.Fragment>
|
|
332
|
+
))
|
|
365
333
|
: null}
|
|
366
334
|
{onRemoveClick && !rest.disabled ? (
|
|
367
335
|
<ReqorePopover
|
|
@@ -373,7 +341,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
|
|
|
373
341
|
onClick: onRemoveClick,
|
|
374
342
|
effect: rest.effect,
|
|
375
343
|
}}
|
|
376
|
-
|
|
344
|
+
noWrapper
|
|
377
345
|
content='Remove'
|
|
378
346
|
>
|
|
379
347
|
<ReqoreIcon icon='CloseLine' size={size} />
|
|
@@ -181,7 +181,7 @@ export const ReqoreTree = ({
|
|
|
181
181
|
return (
|
|
182
182
|
<StyledTreeWrapper className='reqore-tree'>
|
|
183
183
|
{showControls && (
|
|
184
|
-
<ReqoreControlGroup stack size={size}
|
|
184
|
+
<ReqoreControlGroup stack size={size}>
|
|
185
185
|
{isDeep() && !allExpanded ? (
|
|
186
186
|
<ReqoreButton
|
|
187
187
|
flat
|
package/src/constants/sizes.ts
CHANGED
|
@@ -37,19 +37,19 @@ export const HEADER_SIZE_TO_NUMBER = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const SIZE_TO_PX = {
|
|
40
|
-
tiny:
|
|
41
|
-
small:
|
|
40
|
+
tiny: 10,
|
|
41
|
+
small: 20,
|
|
42
42
|
normal: 30,
|
|
43
43
|
big: 40,
|
|
44
44
|
huge: 50,
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export const BADGE_SIZE_TO_PX = {
|
|
48
|
-
tiny:
|
|
49
|
-
small:
|
|
50
|
-
normal:
|
|
51
|
-
big:
|
|
52
|
-
huge:
|
|
48
|
+
tiny: 10,
|
|
49
|
+
small: 18,
|
|
50
|
+
normal: 24,
|
|
51
|
+
big: 30,
|
|
52
|
+
huge: 36,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const TABS_SIZE_TO_PX = {
|
|
@@ -109,9 +109,9 @@ export const PADDING_FROM_SIZE = {
|
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
export const RADIUS_FROM_SIZE = {
|
|
112
|
-
tiny:
|
|
113
|
-
small:
|
|
114
|
-
normal: 5
|
|
112
|
+
tiny: 1,
|
|
113
|
+
small: 3,
|
|
114
|
+
normal: 5,
|
|
115
115
|
big: 7,
|
|
116
116
|
huge: 9,
|
|
117
117
|
};
|