@qoretechnologies/reqore 0.20.6 → 0.21.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/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/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +1 -4
- package/dist/components/Drawer/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 +6 -6
- package/dist/components/Table/index.d.ts.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 +69 -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/Drawer/index.tsx +2 -1
- 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 +8 -8
- 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/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/Modal/Modal.stories.tsx +79 -1
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +10 -0
- 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 +74 -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 }) =>
|
|
@@ -4,7 +4,7 @@ import React, { useState } from 'react';
|
|
|
4
4
|
import { 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 { IReqoreCustomTheme,
|
|
7
|
+
import { IReqoreCustomTheme, 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';
|
|
@@ -18,12 +18,12 @@ export type TReqoreTableColumnContent =
|
|
|
18
18
|
| React.FC<{ [key: string]: any; _selectId?: string }>
|
|
19
19
|
| 'time-ago'
|
|
20
20
|
| 'tag'
|
|
21
|
-
| `tag:${
|
|
21
|
+
| `tag:${TReqoreIntent}`
|
|
22
22
|
| `tag:#${string}`
|
|
23
23
|
| 'title'
|
|
24
|
-
| `title:${
|
|
24
|
+
| `title:${TReqoreIntent}`
|
|
25
25
|
| 'text'
|
|
26
|
-
| `text:${
|
|
26
|
+
| `text:${TReqoreIntent}`;
|
|
27
27
|
|
|
28
28
|
export interface IReqoreTableColumn {
|
|
29
29
|
dataId: string;
|
|
@@ -38,7 +38,7 @@ export interface IReqoreTableColumn {
|
|
|
38
38
|
icon?: IReqoreIconName;
|
|
39
39
|
iconSize?: string;
|
|
40
40
|
tooltip?: string;
|
|
41
|
-
intent?:
|
|
41
|
+
intent?: TReqoreIntent;
|
|
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,7 +46,7 @@ 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
|
|
|
@@ -63,13 +63,13 @@ export interface IReqoreTableProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
63
63
|
striped?: boolean;
|
|
64
64
|
selectable?: boolean;
|
|
65
65
|
selected?: string[];
|
|
66
|
-
selectedRowIntent?:
|
|
66
|
+
selectedRowIntent?: TReqoreIntent;
|
|
67
67
|
onSortChange?: (sort?: IReqoreTableSort) => void;
|
|
68
68
|
onSelectedChange?: (selected?: any[]) => void;
|
|
69
69
|
selectToggleTooltip?: string;
|
|
70
70
|
onRowClick?: IReqoreTableRowClick;
|
|
71
71
|
customTheme?: IReqoreCustomTheme;
|
|
72
|
-
intent?:
|
|
72
|
+
intent?: TReqoreIntent;
|
|
73
73
|
rounded?: boolean;
|
|
74
74
|
flat?: boolean;
|
|
75
75
|
size?: TSizes;
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { IReqoreTabsListItem } from '.';
|
|
4
4
|
import { TABS_PADDING_TO_PX, TSizes } from '../../constants/sizes';
|
|
@@ -87,15 +87,14 @@ const ReqoreTabsListItem = forwardRef(
|
|
|
87
87
|
}: IReqoreTabListItemProps,
|
|
88
88
|
ref
|
|
89
89
|
) => {
|
|
90
|
-
const
|
|
91
|
-
const combinedRef = useCombinedRefs(innerRef, ref);
|
|
90
|
+
const { targetRef } = useCombinedRefs(ref);
|
|
92
91
|
const theme = useReqoreTheme('main', customTheme);
|
|
93
92
|
const _intent = activeIntent || intent;
|
|
94
93
|
const activeColor = _intent ? theme.intents[_intent] : theme.main;
|
|
95
94
|
|
|
96
95
|
return (
|
|
97
96
|
<StyledTabListItem
|
|
98
|
-
ref={
|
|
97
|
+
ref={targetRef}
|
|
99
98
|
{...props}
|
|
100
99
|
className={className}
|
|
101
100
|
intent={intent}
|