@qoretechnologies/reqore 0.20.7 → 0.22.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/__tests__/dropdown.test.tsx +1 -1
- package/__tests__/table.test.tsx +20 -18
- package/dist/components/Breadcrumbs/index.d.ts +2 -2
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/item.js +3 -4
- package/dist/components/Breadcrumbs/item.js.map +1 -1
- package/dist/components/Button/index.d.ts +3 -7
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +28 -19
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts +3 -4
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +35 -12
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Comment/index.d.ts +2 -2
- package/dist/components/ControlGroup/index.d.ts +1 -0
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +3 -2
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Header/index.d.ts +2 -2
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Icon/index.d.ts +2 -2
- package/dist/components/Input/index.d.ts +2 -4
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +57 -28
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts +3 -2
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +7 -4
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts +7 -6
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +9 -67
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Message/index.d.ts +2 -2
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Navbar/item.d.ts.map +1 -1
- package/dist/components/Navbar/item.js +12 -5
- package/dist/components/Navbar/item.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +4 -4
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Panel/index.d.ts +3 -3
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Paragraph/index.d.ts +2 -2
- package/dist/components/Paragraph/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +7 -6
- package/dist/components/Sidebar/index.js.map +1 -1
- package/dist/components/Table/index.d.ts +10 -11
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +5 -4
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +6 -6
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Tabs/index.d.ts +5 -5
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +2 -3
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tag/index.d.ts +5 -10
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +10 -7
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +4 -2
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +55 -15
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -1
- package/dist/containers/ReqoreProvider.d.ts +4 -4
- package/dist/helpers/colors.d.ts +2 -2
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/hooks/useCombinedRefs.d.ts +10 -1
- package/dist/hooks/useCombinedRefs.d.ts.map +1 -1
- package/dist/hooks/useCombinedRefs.js +18 -2
- package/dist/hooks/useCombinedRefs.js.map +1 -1
- package/dist/hooks/useTheme.d.ts +2 -2
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +5 -3
- package/dist/styles.js.map +1 -1
- package/dist/types/global.d.ts +83 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Breadcrumbs/index.tsx +2 -2
- package/src/components/Breadcrumbs/item.tsx +4 -5
- package/src/components/Button/index.tsx +77 -49
- package/src/components/Checkbox/index.tsx +27 -17
- package/src/components/Comment/index.tsx +2 -2
- package/src/components/ControlGroup/index.tsx +3 -3
- package/src/components/Header/index.tsx +2 -2
- package/src/components/Icon/index.tsx +2 -2
- package/src/components/Input/index.tsx +58 -44
- package/src/components/Menu/index.tsx +14 -3
- package/src/components/Menu/item.tsx +42 -132
- package/src/components/Message/index.tsx +2 -2
- package/src/components/Navbar/item.tsx +20 -3
- package/src/components/Notifications/notification.tsx +4 -4
- package/src/components/Panel/index.tsx +3 -3
- package/src/components/Paragraph/index.tsx +2 -2
- package/src/components/Sidebar/index.tsx +11 -0
- package/src/components/Table/index.tsx +23 -15
- package/src/components/Table/row.tsx +11 -11
- package/src/components/Tabs/index.tsx +5 -5
- package/src/components/Tabs/item.tsx +3 -4
- package/src/components/Tag/index.tsx +18 -21
- package/src/components/Textarea/index.tsx +76 -28
- package/src/constants/theme.ts +1 -1
- package/src/containers/ReqoreProvider.tsx +4 -4
- package/src/helpers/colors.ts +2 -2
- package/src/hooks/useCombinedRefs.ts +9 -2
- package/src/hooks/useTheme.ts +2 -2
- package/src/mock/data.json +11000 -0
- package/src/mock/tableData.ts +5 -14
- package/src/stories/Button/Button.stories.tsx +4 -1
- package/src/stories/Checkbox/Checkbox.stories.tsx +5 -4
- package/src/stories/Input/Input.stories.tsx +39 -6
- package/src/stories/Menu/Menu.stories.tsx +14 -2
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +10 -0
- package/src/stories/Table/Table.stories.tsx +12 -1
- package/src/stories/Tag/Tag.stories.tsx +7 -1
- package/src/stories/TextArea/TextArea.stories.tsx +83 -13
- package/src/styles.ts +11 -2
- package/src/types/global.ts +89 -0
- package/tests.json +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import React, { forwardRef, useContext
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import React, { forwardRef, useContext } from 'react';
|
|
2
|
+
import { ReqoreButton, ReqoreControlGroup } from '../..';
|
|
3
|
+
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
4
4
|
import PopoverContext from '../../context/PopoverContext';
|
|
5
|
-
import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
|
|
6
5
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
7
6
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
8
|
-
import { IReqoreComponent, TReqoreTooltipProp } from '../../types/global';
|
|
7
|
+
import { IReqoreComponent, IWithReqoreCustomTheme, TReqoreTooltipProp } from '../../types/global';
|
|
9
8
|
import { IReqoreIconName } from '../../types/icons';
|
|
10
|
-
import ReqoreIcon from '../Icon';
|
|
11
9
|
|
|
12
10
|
// @ts-ignore
|
|
13
|
-
export interface IReqoreMenuItemProps
|
|
11
|
+
export interface IReqoreMenuItemProps
|
|
12
|
+
extends IReqoreComponent,
|
|
13
|
+
React.HTMLAttributes<HTMLElement>,
|
|
14
|
+
IWithReqoreCustomTheme {
|
|
14
15
|
children?: string;
|
|
15
16
|
label?: string | number;
|
|
16
17
|
icon?: IReqoreIconName;
|
|
@@ -21,120 +22,23 @@ export interface IReqoreMenuItemProps extends IReqoreComponent, React.HTMLAttrib
|
|
|
21
22
|
onClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
|
|
22
23
|
onRightIconClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
|
|
23
24
|
tooltip?: TReqoreTooltipProp;
|
|
24
|
-
intent?:
|
|
25
|
+
intent?: TReqoreIntent;
|
|
26
|
+
wrapText?: boolean;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
const StyledElementContent = styled.div<{
|
|
28
|
-
theme: IReqoreTheme;
|
|
29
|
-
hasRightIcon?: boolean;
|
|
30
|
-
}>`
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
33
|
-
flex: 1;
|
|
34
|
-
margin-right: 3px;
|
|
35
|
-
word-break: break-word;
|
|
36
|
-
|
|
37
|
-
${({ hasRightIcon }) =>
|
|
38
|
-
hasRightIcon &&
|
|
39
|
-
css`
|
|
40
|
-
margin-right: 33px;
|
|
41
|
-
`}
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
29
|
export interface IReqoreMenuItemStyle {
|
|
45
30
|
theme: IReqoreTheme;
|
|
46
31
|
selected: boolean;
|
|
47
32
|
disabled: boolean;
|
|
48
|
-
intent?:
|
|
33
|
+
intent?: TReqoreIntent;
|
|
49
34
|
}
|
|
50
35
|
|
|
51
|
-
const StyledElement = styled.div<IReqoreMenuItemStyle>`
|
|
52
|
-
min-height: 35px;
|
|
53
|
-
color: ${({ theme, selected, intent }) =>
|
|
54
|
-
intent
|
|
55
|
-
? getReadableColorFrom(theme.intents[intent], true)
|
|
56
|
-
: getReadableColor(theme, undefined, undefined, !selected)};
|
|
57
|
-
display: flex;
|
|
58
|
-
justify-content: space-between;
|
|
59
|
-
align-items: center;
|
|
60
|
-
padding: 4px 6px;
|
|
61
|
-
position: relative;
|
|
62
|
-
width: 100%;
|
|
63
|
-
z-index: 0;
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
transition: background-color 0.05s ease-out;
|
|
66
|
-
border-radius: 4px;
|
|
67
|
-
${({ theme, selected, intent }: IReqoreMenuItemStyle) => {
|
|
68
|
-
const bg = intent ? theme.intents[intent] : theme.main;
|
|
69
|
-
|
|
70
|
-
return css`
|
|
71
|
-
background-color: ${selected ? changeLightness(bg!, 0.07) : bg};
|
|
72
|
-
`;
|
|
73
|
-
}};
|
|
74
|
-
overflow: hidden;
|
|
75
|
-
|
|
76
|
-
${({ theme, selected, disabled, intent }) =>
|
|
77
|
-
!disabled
|
|
78
|
-
? css`
|
|
79
|
-
${!selected &&
|
|
80
|
-
css`
|
|
81
|
-
&:hover {
|
|
82
|
-
background-color: ${changeLightness(
|
|
83
|
-
intent ? theme.intents[intent] : theme.main,
|
|
84
|
-
0.05
|
|
85
|
-
)};
|
|
86
|
-
}
|
|
87
|
-
`}
|
|
88
|
-
|
|
89
|
-
&:hover {
|
|
90
|
-
color: ${({ theme }) =>
|
|
91
|
-
intent
|
|
92
|
-
? getReadableColorFrom(theme.intents[intent])
|
|
93
|
-
: getReadableColor(theme, undefined, undefined)};
|
|
94
|
-
text-decoration: none;
|
|
95
|
-
}
|
|
96
|
-
`
|
|
97
|
-
: css`
|
|
98
|
-
cursor: not-allowed;
|
|
99
|
-
> * {
|
|
100
|
-
opacity: 0.5;
|
|
101
|
-
}
|
|
102
|
-
`}
|
|
103
|
-
|
|
104
|
-
&:not(:first-child) {
|
|
105
|
-
margin-top: 4px;
|
|
106
|
-
}
|
|
107
|
-
`;
|
|
108
|
-
|
|
109
36
|
export interface IReqoreMenuItemRightIconStyle {
|
|
110
37
|
theme: IReqoreTheme;
|
|
111
38
|
interactive?: boolean;
|
|
112
|
-
intent?:
|
|
39
|
+
intent?: TReqoreIntent;
|
|
113
40
|
}
|
|
114
41
|
|
|
115
|
-
const StyledRightIcon = styled.div<IReqoreMenuItemRightIconStyle>`
|
|
116
|
-
${({ theme, interactive, intent }) => css`
|
|
117
|
-
position: absolute;
|
|
118
|
-
right: 0px;
|
|
119
|
-
height: 100%;
|
|
120
|
-
width: 33px;
|
|
121
|
-
display: flex;
|
|
122
|
-
justify-content: center;
|
|
123
|
-
align-items: center;
|
|
124
|
-
top: 0;
|
|
125
|
-
z-index: 1;
|
|
126
|
-
transition: background-color 0.2s ease-out;
|
|
127
|
-
|
|
128
|
-
${interactive &&
|
|
129
|
-
css`
|
|
130
|
-
cursor: pointer;
|
|
131
|
-
&:hover {
|
|
132
|
-
background-color: ${changeLightness(intent ? theme.intents[intent] : theme.main, 0.09)};
|
|
133
|
-
}
|
|
134
|
-
`}
|
|
135
|
-
`}
|
|
136
|
-
`;
|
|
137
|
-
|
|
138
42
|
const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
139
43
|
(
|
|
140
44
|
{
|
|
@@ -152,15 +56,15 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
152
56
|
_popoverId,
|
|
153
57
|
tooltip,
|
|
154
58
|
intent,
|
|
59
|
+
wrapText,
|
|
155
60
|
...rest
|
|
156
61
|
},
|
|
157
62
|
ref: any
|
|
158
63
|
) => {
|
|
159
64
|
const { removePopover } = useContext(PopoverContext);
|
|
160
|
-
const
|
|
161
|
-
const combinedRef = useCombinedRefs(innerRef, ref);
|
|
65
|
+
const { targetRef } = useCombinedRefs(ref);
|
|
162
66
|
|
|
163
|
-
const handleClick = (event: React.MouseEvent<
|
|
67
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
164
68
|
event.persist();
|
|
165
69
|
|
|
166
70
|
onClick?.(id, event);
|
|
@@ -183,35 +87,41 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
183
87
|
}
|
|
184
88
|
};
|
|
185
89
|
|
|
186
|
-
useTooltip(
|
|
90
|
+
useTooltip(targetRef.current, tooltip);
|
|
187
91
|
|
|
188
92
|
return (
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
93
|
+
<ReqoreControlGroup stack fluid>
|
|
94
|
+
<ReqoreButton
|
|
95
|
+
//@ts-ignore
|
|
96
|
+
as={as}
|
|
97
|
+
{...rest}
|
|
98
|
+
flat
|
|
99
|
+
className='reqore-menu-item'
|
|
100
|
+
fluid
|
|
101
|
+
onClick={handleClick}
|
|
102
|
+
active={selected}
|
|
103
|
+
ref={targetRef}
|
|
104
|
+
disabled={disabled}
|
|
105
|
+
intent={intent}
|
|
106
|
+
icon={icon}
|
|
107
|
+
wrap={wrapText}
|
|
108
|
+
>
|
|
202
109
|
{label || children}
|
|
203
|
-
</
|
|
110
|
+
</ReqoreButton>
|
|
204
111
|
{rightIcon && (
|
|
205
|
-
<
|
|
112
|
+
<ReqoreButton
|
|
113
|
+
icon={rightIcon}
|
|
114
|
+
flat
|
|
115
|
+
fixed
|
|
116
|
+
customTheme={rest.customTheme}
|
|
206
117
|
className='reqore-menu-item-right-icon'
|
|
207
|
-
interactive={!!onRightIconClick}
|
|
208
118
|
onClick={handleRightIconClick}
|
|
209
119
|
intent={intent}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
120
|
+
active={selected}
|
|
121
|
+
wrap={wrapText}
|
|
122
|
+
/>
|
|
213
123
|
)}
|
|
214
|
-
</
|
|
124
|
+
</ReqoreControlGroup>
|
|
215
125
|
);
|
|
216
126
|
}
|
|
217
127
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { useMount, useUnmount } from 'react-use';
|
|
3
3
|
import { TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
4
|
-
import {
|
|
4
|
+
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
5
5
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
6
6
|
import { IReqoreIconName } from '../../types/icons';
|
|
7
7
|
import ReqoreIcon from '../Icon';
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '../Notifications/notification';
|
|
16
16
|
|
|
17
17
|
export interface IReqoreMessageProps {
|
|
18
|
-
intent?:
|
|
18
|
+
intent?: TReqoreIntent;
|
|
19
19
|
title?: string;
|
|
20
20
|
children: any;
|
|
21
21
|
icon?: IReqoreIconName;
|
|
@@ -2,6 +2,12 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { IReqoreTheme } from '../../constants/theme';
|
|
4
4
|
import { changeLightness, getMainColor } from '../../helpers/colors';
|
|
5
|
+
import {
|
|
6
|
+
ActiveIconScale,
|
|
7
|
+
DisabledElement,
|
|
8
|
+
InactiveIconScale,
|
|
9
|
+
ScaleIconOnHover,
|
|
10
|
+
} from '../../styles';
|
|
5
11
|
|
|
6
12
|
export interface IReqoreNavbarItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
13
|
children?: any;
|
|
@@ -27,6 +33,18 @@ const StyledNavbarItem = styled.div<IReqoreNavbarItemStyle>`
|
|
|
27
33
|
background-color: ${({ theme, active, type }) =>
|
|
28
34
|
active && (theme[type]?.hoverColor || changeLightness(getMainColor(theme, type), 0.05))};
|
|
29
35
|
|
|
36
|
+
${InactiveIconScale}
|
|
37
|
+
|
|
38
|
+
${({ active }: IReqoreNavbarItemStyle) => {
|
|
39
|
+
if (active) {
|
|
40
|
+
return css`
|
|
41
|
+
${ActiveIconScale}
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return undefined;
|
|
46
|
+
}}
|
|
47
|
+
|
|
30
48
|
${({ interactive, theme, type }: IReqoreNavbarItemStyle) => {
|
|
31
49
|
if (interactive) {
|
|
32
50
|
return css`
|
|
@@ -36,6 +54,7 @@ const StyledNavbarItem = styled.div<IReqoreNavbarItemStyle>`
|
|
|
36
54
|
background-color: ${theme[type]?.hoverColor ||
|
|
37
55
|
changeLightness(getMainColor(theme, type), 0.05)};
|
|
38
56
|
}
|
|
57
|
+
${ScaleIconOnHover}
|
|
39
58
|
`;
|
|
40
59
|
}
|
|
41
60
|
|
|
@@ -47,9 +66,7 @@ const StyledNavbarItem = styled.div<IReqoreNavbarItemStyle>`
|
|
|
47
66
|
${({ disabled }) =>
|
|
48
67
|
disabled &&
|
|
49
68
|
css`
|
|
50
|
-
|
|
51
|
-
pointer-events: none;
|
|
52
|
-
cursor: not-allowed;
|
|
69
|
+
${DisabledElement}
|
|
53
70
|
`}
|
|
54
71
|
`;
|
|
55
72
|
|
|
@@ -5,7 +5,7 @@ import { useMount, useUnmount } from 'react-use';
|
|
|
5
5
|
import styled, { css, keyframes } from 'styled-components';
|
|
6
6
|
import { SPRING_CONFIG } from '../../constants/animations';
|
|
7
7
|
import { PADDING_FROM_SIZE, TABS_SIZE_TO_PX, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
8
|
-
import {
|
|
8
|
+
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
9
9
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
10
10
|
import { fadeIn } from '../../helpers/animations';
|
|
11
11
|
import {
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
import { IReqoreIconName } from '../../types/icons';
|
|
18
18
|
import ReqoreIcon from '../Icon';
|
|
19
19
|
|
|
20
|
-
export type IReqoreNotificationType =
|
|
20
|
+
export type IReqoreNotificationType = TReqoreIntent;
|
|
21
21
|
|
|
22
22
|
export interface IReqoreNotificationProps {
|
|
23
23
|
type?: IReqoreNotificationType;
|
|
24
|
-
intent?:
|
|
24
|
+
intent?: TReqoreIntent;
|
|
25
25
|
title?: string;
|
|
26
26
|
content: string;
|
|
27
27
|
icon?: IReqoreIconName;
|
|
@@ -40,7 +40,7 @@ export interface IReqoreNotificationStyle {
|
|
|
40
40
|
type?: IReqoreNotificationType;
|
|
41
41
|
clickable?: boolean;
|
|
42
42
|
timeout?: number;
|
|
43
|
-
intent?:
|
|
43
|
+
intent?: TReqoreIntent;
|
|
44
44
|
hasShadow?: boolean;
|
|
45
45
|
fluid?: boolean;
|
|
46
46
|
flat?: boolean;
|
|
@@ -4,7 +4,7 @@ import { forwardRef, ReactElement, useCallback, useMemo, useState } from 'react'
|
|
|
4
4
|
import { useUpdateEffect } from 'react-use';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import { RADIUS_FROM_SIZE } from '../../constants/sizes';
|
|
7
|
-
import { IReqoreCustomTheme,
|
|
7
|
+
import { IReqoreCustomTheme, IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
8
8
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
9
9
|
import {
|
|
10
10
|
changeDarkness,
|
|
@@ -24,7 +24,7 @@ export interface IReqorePanelAction {
|
|
|
24
24
|
icon?: IReqoreIconName;
|
|
25
25
|
label?: string;
|
|
26
26
|
onClick?: () => void;
|
|
27
|
-
intent?:
|
|
27
|
+
intent?: TReqoreIntent;
|
|
28
28
|
actions?: IReqoreDropdownItemProps[];
|
|
29
29
|
className?: string;
|
|
30
30
|
id?: string;
|
|
@@ -46,7 +46,7 @@ export interface IReqorePanelProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
46
46
|
actions?: IReqorePanelAction[];
|
|
47
47
|
bottomActions?: IReqorePanelBottomAction[];
|
|
48
48
|
customTheme?: IReqoreCustomTheme;
|
|
49
|
-
intent?:
|
|
49
|
+
intent?: TReqoreIntent;
|
|
50
50
|
flat?: boolean;
|
|
51
51
|
unMountContentOnCollapse?: boolean;
|
|
52
52
|
onCollapseChange?: (isCollapsed?: boolean) => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import {
|
|
2
|
+
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
3
3
|
import { getReadableColor } from '../../helpers/colors';
|
|
4
4
|
|
|
5
5
|
export interface IReqoreParagraphStyle extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
6
6
|
theme: IReqoreTheme;
|
|
7
|
-
intent?:
|
|
7
|
+
intent?: TReqoreIntent;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const style = ({ theme, intent }: IReqoreParagraphStyle) => css`
|
|
@@ -11,6 +11,7 @@ import { changeLightness, getMainColor, getReadableColor } from '../../helpers/c
|
|
|
11
11
|
import { transformMenu } from '../../helpers/sidebar';
|
|
12
12
|
import useLatestZIndex from '../../hooks/useLatestZIndex';
|
|
13
13
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
14
|
+
import { ActiveIconScale, InactiveIconScale, ScaleIconOnHover } from '../../styles';
|
|
14
15
|
import { IReqoreIconName } from '../../types/icons';
|
|
15
16
|
import { StyledBackdrop } from '../Drawer';
|
|
16
17
|
import ReqoreIcon from '../Icon';
|
|
@@ -198,6 +199,8 @@ const StyledSidebar = styled.div<IReqoreSidebarStyle>`
|
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
.sidebarItem.active {
|
|
202
|
+
${ActiveIconScale}
|
|
203
|
+
|
|
201
204
|
color: ${({ theme }) =>
|
|
202
205
|
theme.sidebar?.item?.activeColor ||
|
|
203
206
|
theme.sidebar?.item?.color ||
|
|
@@ -219,6 +222,8 @@ const StyledSidebar = styled.div<IReqoreSidebarStyle>`
|
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
.sidebarSubItem.active {
|
|
225
|
+
${ActiveIconScale}
|
|
226
|
+
|
|
222
227
|
color: ${({ theme }) =>
|
|
223
228
|
theme.sidebar?.subItem?.activeColor ||
|
|
224
229
|
theme.sidebar?.subItem?.color ||
|
|
@@ -240,6 +245,8 @@ const StyledSidebar = styled.div<IReqoreSidebarStyle>`
|
|
|
240
245
|
}
|
|
241
246
|
|
|
242
247
|
.sidebarItem {
|
|
248
|
+
${InactiveIconScale}
|
|
249
|
+
|
|
243
250
|
position: relative;
|
|
244
251
|
|
|
245
252
|
span.bp3-icon:not(.favorite) {
|
|
@@ -259,6 +266,8 @@ const StyledSidebar = styled.div<IReqoreSidebarStyle>`
|
|
|
259
266
|
theme.sidebar?.item?.background || getMainColor(theme, 'sidebar')};
|
|
260
267
|
|
|
261
268
|
&:hover {
|
|
269
|
+
${ScaleIconOnHover}
|
|
270
|
+
|
|
262
271
|
color: ${({ theme }) =>
|
|
263
272
|
theme.sidebar?.item?.hoverColor || theme.sidebar?.item?.color || 'inherit'};
|
|
264
273
|
background-color: ${({ theme }) =>
|
|
@@ -298,6 +307,8 @@ const StyledSidebar = styled.div<IReqoreSidebarStyle>`
|
|
|
298
307
|
theme.sidebar?.subItem?.background || darken(0.04, getMainColor(theme, 'sidebar'))};
|
|
299
308
|
|
|
300
309
|
&:hover {
|
|
310
|
+
${ScaleIconOnHover}
|
|
311
|
+
|
|
301
312
|
color: ${({ theme }) =>
|
|
302
313
|
theme.sidebar?.subItem?.hoverColor || theme.sidebar?.subItem?.color || 'inherit'};
|
|
303
314
|
background-color: ${({ theme }) =>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
import { size as count } from 'lodash';
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import { useUpdateEffect } from 'react-use';
|
|
4
|
+
import { useMeasure, useUpdateEffect } from 'react-use';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import { TABLE_SIZE_TO_PX, TSizes } from '../../constants/sizes';
|
|
7
|
-
import {
|
|
7
|
+
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
8
8
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
9
9
|
import { changeLightness, getReadableColor } from '../../helpers/colors';
|
|
10
10
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
11
|
+
import { IReqoreIntent, IWithReqoreCustomTheme, IWithReqoreFlat } from '../../types/global';
|
|
11
12
|
import { IReqoreIconName } from '../../types/icons';
|
|
12
13
|
import ReqoreTableBody from './body';
|
|
13
14
|
import ReqoreTableHeader, { StyledColumnGroupHeader } from './header';
|
|
@@ -18,14 +19,14 @@ export type TReqoreTableColumnContent =
|
|
|
18
19
|
| React.FC<{ [key: string]: any; _selectId?: string }>
|
|
19
20
|
| 'time-ago'
|
|
20
21
|
| 'tag'
|
|
21
|
-
| `tag:${
|
|
22
|
+
| `tag:${TReqoreIntent}`
|
|
22
23
|
| `tag:#${string}`
|
|
23
24
|
| 'title'
|
|
24
|
-
| `title:${
|
|
25
|
+
| `title:${TReqoreIntent}`
|
|
25
26
|
| 'text'
|
|
26
|
-
| `text:${
|
|
27
|
+
| `text:${TReqoreIntent}`;
|
|
27
28
|
|
|
28
|
-
export interface IReqoreTableColumn {
|
|
29
|
+
export interface IReqoreTableColumn extends IReqoreIntent {
|
|
29
30
|
dataId: string;
|
|
30
31
|
header?: string | JSX.Element;
|
|
31
32
|
grow?: 1 | 2 | 3 | 4;
|
|
@@ -38,7 +39,6 @@ export interface IReqoreTableColumn {
|
|
|
38
39
|
icon?: IReqoreIconName;
|
|
39
40
|
iconSize?: string;
|
|
40
41
|
tooltip?: string;
|
|
41
|
-
intent?: IReqoreIntent;
|
|
42
42
|
cellTooltip?: (data: { [key: string]: any; _selectId?: string }) => string | JSX.Element;
|
|
43
43
|
onCellClick?: (data: { [key: string]: any; _selectId?: string }) => void;
|
|
44
44
|
}
|
|
@@ -46,14 +46,18 @@ export interface IReqoreTableColumn {
|
|
|
46
46
|
export interface IReqoreTableRowData {
|
|
47
47
|
[key: string]: any;
|
|
48
48
|
_selectId?: string;
|
|
49
|
-
_intent?:
|
|
49
|
+
_intent?: TReqoreIntent;
|
|
50
50
|
_disabled?: boolean;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export type IReqoreTableRowClick = (data: IReqoreTableRowData) => void;
|
|
54
54
|
export type IReqoreTableData = IReqoreTableRowData[];
|
|
55
55
|
|
|
56
|
-
export interface IReqoreTableProps
|
|
56
|
+
export interface IReqoreTableProps
|
|
57
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
58
|
+
IReqoreIntent,
|
|
59
|
+
IWithReqoreFlat,
|
|
60
|
+
IWithReqoreCustomTheme {
|
|
57
61
|
columns: IReqoreTableColumn[];
|
|
58
62
|
data?: IReqoreTableData;
|
|
59
63
|
className?: string;
|
|
@@ -63,21 +67,20 @@ export interface IReqoreTableProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
63
67
|
striped?: boolean;
|
|
64
68
|
selectable?: boolean;
|
|
65
69
|
selected?: string[];
|
|
66
|
-
selectedRowIntent?:
|
|
70
|
+
selectedRowIntent?: TReqoreIntent;
|
|
67
71
|
onSortChange?: (sort?: IReqoreTableSort) => void;
|
|
68
72
|
onSelectedChange?: (selected?: any[]) => void;
|
|
69
73
|
selectToggleTooltip?: string;
|
|
70
74
|
onRowClick?: IReqoreTableRowClick;
|
|
71
|
-
customTheme?: IReqoreCustomTheme;
|
|
72
|
-
intent?: IReqoreIntent;
|
|
73
75
|
rounded?: boolean;
|
|
74
|
-
flat?: boolean;
|
|
75
76
|
size?: TSizes;
|
|
77
|
+
fill?: boolean;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
export interface IReqoreTableStyle {
|
|
79
81
|
theme: IReqoreTheme;
|
|
80
82
|
width?: number;
|
|
83
|
+
fill?: number;
|
|
81
84
|
striped?: boolean;
|
|
82
85
|
selectable?: boolean;
|
|
83
86
|
rounded?: boolean;
|
|
@@ -90,8 +93,9 @@ export interface IReqoreTableSort {
|
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
const StyledTableWrapper = styled.div<IReqoreTableStyle>`
|
|
93
|
-
${({ theme, width, rounded, flat }: IReqoreTableStyle) => css`
|
|
96
|
+
${({ theme, width, rounded, flat, fill }: IReqoreTableStyle) => css`
|
|
94
97
|
width: ${width ? `${width}px` : '100%'};
|
|
98
|
+
height: ${fill ? '100%' : 'auto'};
|
|
95
99
|
|
|
96
100
|
position: relative;
|
|
97
101
|
clear: both;
|
|
@@ -136,6 +140,7 @@ const ReqoreTable = ({
|
|
|
136
140
|
selectedRowIntent,
|
|
137
141
|
size,
|
|
138
142
|
intent,
|
|
143
|
+
fill,
|
|
139
144
|
...rest
|
|
140
145
|
}: IReqoreTableProps) => {
|
|
141
146
|
const [leftScroll, setLeftScroll] = useState<number>(0);
|
|
@@ -143,6 +148,7 @@ const ReqoreTable = ({
|
|
|
143
148
|
const [_sort, setSort] = useState<IReqoreTableSort>(fixSort(sort));
|
|
144
149
|
const [_selected, setSelected] = useState<string[]>([]);
|
|
145
150
|
const [_selectedQuant, setSelectedQuant] = useState<'all' | 'none' | 'some'>('none');
|
|
151
|
+
const [wrapperRef, sizes] = useMeasure();
|
|
146
152
|
const theme = useReqoreTheme('main', customTheme, intent);
|
|
147
153
|
|
|
148
154
|
useUpdateEffect(() => {
|
|
@@ -228,9 +234,11 @@ const ReqoreTable = ({
|
|
|
228
234
|
<ReqoreThemeProvider theme={theme}>
|
|
229
235
|
<StyledTableWrapper
|
|
230
236
|
{...rest}
|
|
237
|
+
fill={fill}
|
|
231
238
|
className={`${className || ''} reqore-table`}
|
|
232
239
|
rounded={rounded}
|
|
233
240
|
width={width}
|
|
241
|
+
ref={wrapperRef}
|
|
234
242
|
>
|
|
235
243
|
<ReqoreTableHeader
|
|
236
244
|
columns={columns}
|
|
@@ -247,7 +255,7 @@ const ReqoreTable = ({
|
|
|
247
255
|
data={_sort ? sortTableData(_data, _sort) : _data}
|
|
248
256
|
columns={columns}
|
|
249
257
|
setLeftScroll={setLeftScroll}
|
|
250
|
-
height={height}
|
|
258
|
+
height={fill ? sizes.height : height}
|
|
251
259
|
selectable={selectable}
|
|
252
260
|
onSelectClick={handleSelectClick}
|
|
253
261
|
onRowClick={onRowClick}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '.';
|
|
12
12
|
import { ReqorePopover } from '../..';
|
|
13
13
|
import { SIZE_TO_PX, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
14
|
-
import {
|
|
14
|
+
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
15
15
|
import { changeLightness, getReadableColorFrom } from '../../helpers/colors';
|
|
16
16
|
import { ReqoreH4 } from '../Header';
|
|
17
17
|
import ReqoreIcon from '../Icon';
|
|
@@ -27,7 +27,7 @@ export interface IReqoreTableRowOptions {
|
|
|
27
27
|
selected?: string[];
|
|
28
28
|
onRowClick?: IReqoreTableRowClick;
|
|
29
29
|
striped?: boolean;
|
|
30
|
-
selectedRowIntent?:
|
|
30
|
+
selectedRowIntent?: TReqoreIntent;
|
|
31
31
|
size?: TSizes;
|
|
32
32
|
flat?: boolean;
|
|
33
33
|
}
|
|
@@ -41,9 +41,9 @@ export interface IReqoreTableRowProps extends React.HTMLAttributes<HTMLTableRowE
|
|
|
41
41
|
export interface IReqoreTableRowStyle {
|
|
42
42
|
theme: IReqoreTheme;
|
|
43
43
|
interactive?: boolean;
|
|
44
|
-
intent?:
|
|
44
|
+
intent?: TReqoreIntent;
|
|
45
45
|
selected?: boolean;
|
|
46
|
-
selectedIntent?:
|
|
46
|
+
selectedIntent?: TReqoreIntent;
|
|
47
47
|
flat?: boolean;
|
|
48
48
|
disabled?: boolean;
|
|
49
49
|
hovered?: boolean;
|
|
@@ -61,7 +61,7 @@ export interface IReqoreTableCellStyle {
|
|
|
61
61
|
grow?: number;
|
|
62
62
|
theme?: IReqoreTheme;
|
|
63
63
|
align?: 'center' | 'left' | 'right';
|
|
64
|
-
intent?:
|
|
64
|
+
intent?: TReqoreIntent;
|
|
65
65
|
interactive?: boolean;
|
|
66
66
|
interactiveCell?: boolean;
|
|
67
67
|
size?: TSizes;
|
|
@@ -69,7 +69,7 @@ export interface IReqoreTableCellStyle {
|
|
|
69
69
|
disabled?: boolean;
|
|
70
70
|
selected?: boolean;
|
|
71
71
|
hovered?: boolean;
|
|
72
|
-
selectedIntent?:
|
|
72
|
+
selectedIntent?: TReqoreIntent;
|
|
73
73
|
even?: boolean;
|
|
74
74
|
striped?: boolean;
|
|
75
75
|
}
|
|
@@ -211,9 +211,9 @@ const ReqoreTableRow = ({
|
|
|
211
211
|
// Separate the content string by colon
|
|
212
212
|
let [type, intentOrColor] = content.split(':');
|
|
213
213
|
// Check if the intent starts with hash for tags
|
|
214
|
-
let intent:
|
|
214
|
+
let intent: TReqoreIntent = intentOrColor?.startsWith('#')
|
|
215
215
|
? undefined
|
|
216
|
-
: (intentOrColor as
|
|
216
|
+
: (intentOrColor as TReqoreIntent);
|
|
217
217
|
let color: string =
|
|
218
218
|
intentOrColor?.startsWith('#') && type === 'tag' ? intentOrColor : undefined;
|
|
219
219
|
// Render content based on the type
|
|
@@ -225,15 +225,15 @@ const ReqoreTableRow = ({
|
|
|
225
225
|
<ReqoreTag
|
|
226
226
|
label={data[dataId]}
|
|
227
227
|
size={size}
|
|
228
|
-
intent={intent as
|
|
228
|
+
intent={intent as TReqoreIntent}
|
|
229
229
|
color={color}
|
|
230
230
|
/>
|
|
231
231
|
);
|
|
232
232
|
case 'title':
|
|
233
|
-
return <ReqoreH4 intent={intent as
|
|
233
|
+
return <ReqoreH4 intent={intent as TReqoreIntent}>{data[dataId]}</ReqoreH4>;
|
|
234
234
|
case 'text':
|
|
235
235
|
return (
|
|
236
|
-
<ReqoreP className='reqore-table-text' intent={intent as
|
|
236
|
+
<ReqoreP className='reqore-table-text' intent={intent as TReqoreIntent}>
|
|
237
237
|
{data[dataId]}
|
|
238
238
|
</ReqoreP>
|
|
239
239
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactElement, useEffect, useState } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { TSizes } from '../../constants/sizes';
|
|
4
|
-
import { IReqoreCustomTheme,
|
|
4
|
+
import { IReqoreCustomTheme, TReqoreIntent } from '../../constants/theme';
|
|
5
5
|
import { TReqoreTooltipProp } from '../../types/global';
|
|
6
6
|
import { IReqoreIconName } from '../../types/icons';
|
|
7
7
|
import ReqoreTabsList from './list';
|
|
@@ -16,8 +16,8 @@ export interface IReqoreTabsListItem {
|
|
|
16
16
|
props?: React.HTMLAttributes<any>;
|
|
17
17
|
onClick?: (event: any) => any;
|
|
18
18
|
onCloseClick?: (id: string | number) => any;
|
|
19
|
-
activeIntent?:
|
|
20
|
-
intent?:
|
|
19
|
+
activeIntent?: TReqoreIntent;
|
|
20
|
+
intent?: TReqoreIntent;
|
|
21
21
|
closeIcon?: IReqoreIconName;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -29,13 +29,13 @@ export interface IReqoreTabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
29
29
|
fill?: boolean;
|
|
30
30
|
fillParent?: boolean;
|
|
31
31
|
vertical?: boolean;
|
|
32
|
-
activeTabIntent?:
|
|
32
|
+
activeTabIntent?: TReqoreIntent;
|
|
33
33
|
wrapTabNames?: boolean;
|
|
34
34
|
flat?: boolean;
|
|
35
35
|
size?: TSizes;
|
|
36
36
|
width?: string;
|
|
37
37
|
customTheme?: IReqoreCustomTheme;
|
|
38
|
-
intent?:
|
|
38
|
+
intent?: TReqoreIntent;
|
|
39
39
|
// Internal prop, ignore!
|
|
40
40
|
_testWidth?: number;
|
|
41
41
|
}
|