@qoretechnologies/reqore 0.25.10 → 0.26.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__/effect.test.tsx +70 -0
- package/dist/components/Button/index.d.ts +3 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +15 -14
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +4 -1
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Effect/index.d.ts +29 -0
- package/dist/components/Effect/index.d.ts.map +1 -0
- package/dist/components/Effect/index.js +117 -0
- package/dist/components/Effect/index.js.map +1 -0
- package/dist/components/Header/index.d.ts +14 -8
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +52 -33
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +3 -2
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +8 -7
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts +5 -11
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +4 -4
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Message/index.d.ts +3 -6
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +2 -1
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +3 -2
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +3 -2
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts +3 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +14 -16
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +0 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +1 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +6 -5
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tag/index.d.ts +2 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +6 -4
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +2 -2
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +8 -7
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/constants/sizes.d.ts +7 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +8 -1
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -0
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts +2 -2
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +7 -5
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +9 -3
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +3 -2
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +2 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js +4 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.js +1 -1
- package/dist/helpers/colors.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/types/global.d.ts +13 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/Button/index.tsx +34 -23
- package/src/components/ControlGroup/index.tsx +1 -0
- package/src/components/Effect/index.tsx +134 -0
- package/src/components/Header/index.tsx +33 -28
- package/src/components/Input/index.tsx +15 -7
- package/src/components/Menu/index.tsx +1 -1
- package/src/components/Menu/item.tsx +8 -17
- package/src/components/Message/index.tsx +13 -5
- package/src/components/Notifications/notification.tsx +6 -3
- package/src/components/Panel/index.tsx +27 -25
- package/src/components/Popover/index.tsx +0 -13
- package/src/components/Tabs/item.tsx +92 -79
- package/src/components/Tag/index.tsx +16 -7
- package/src/components/Textarea/index.tsx +14 -7
- package/src/constants/sizes.ts +8 -0
- package/src/constants/theme.ts +1 -0
- package/src/containers/ReqoreProvider.tsx +16 -8
- package/src/containers/UIProvider.tsx +15 -13
- package/src/context/ReqoreContext.tsx +5 -0
- package/src/helpers/colors.ts +1 -1
- package/src/index.tsx +10 -1
- package/src/mock/collectionData.tsx +55 -2
- package/src/stories/Button/Button.stories.tsx +15 -2
- package/src/stories/Header/Header.stories.tsx +71 -0
- package/src/stories/Input/Input.stories.tsx +12 -0
- package/src/stories/Menu/Menu.stories.tsx +14 -0
- package/src/stories/Message/Message.stories.tsx +13 -0
- package/src/stories/Notifications/Notification.stories.tsx +7 -2
- package/src/stories/Panel/Panel.stories.tsx +37 -1
- package/src/stories/Tabs/Tabs.stories.tsx +23 -23
- package/src/stories/Tag/Tag.stories.tsx +16 -0
- package/src/stories/TextArea/TextArea.stories.tsx +18 -0
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
|
@@ -4,26 +4,20 @@ import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
|
4
4
|
import PopoverContext from '../../context/PopoverContext';
|
|
5
5
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
6
6
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
7
|
-
import { IReqoreComponent
|
|
8
|
-
import {
|
|
7
|
+
import { IReqoreComponent } from '../../types/global';
|
|
8
|
+
import { IReqoreButtonProps } from '../Button';
|
|
9
9
|
|
|
10
10
|
// @ts-ignore
|
|
11
11
|
export interface IReqoreMenuItemProps
|
|
12
12
|
extends IReqoreComponent,
|
|
13
13
|
React.HTMLAttributes<HTMLElement>,
|
|
14
|
-
|
|
15
|
-
children?: string;
|
|
14
|
+
IReqoreButtonProps {
|
|
16
15
|
label?: string | number;
|
|
17
|
-
icon?: IReqoreIconName;
|
|
18
|
-
rightIcon?: IReqoreIconName;
|
|
19
16
|
as?: JSX.Element | React.ElementType | never;
|
|
20
17
|
selected?: boolean;
|
|
21
|
-
|
|
22
|
-
onClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
|
|
18
|
+
itemId?: string;
|
|
23
19
|
onRightIconClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
|
|
24
|
-
|
|
25
|
-
intent?: TReqoreIntent;
|
|
26
|
-
wrapText?: boolean;
|
|
20
|
+
onClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
export interface IReqoreMenuItemStyle {
|
|
@@ -51,12 +45,11 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
51
45
|
onClick,
|
|
52
46
|
onRightIconClick,
|
|
53
47
|
disabled,
|
|
54
|
-
|
|
48
|
+
itemId,
|
|
55
49
|
_insidePopover,
|
|
56
50
|
_popoverId,
|
|
57
51
|
tooltip,
|
|
58
52
|
intent,
|
|
59
|
-
wrapText,
|
|
60
53
|
...rest
|
|
61
54
|
},
|
|
62
55
|
ref: any
|
|
@@ -67,7 +60,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
67
60
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
68
61
|
event.persist();
|
|
69
62
|
|
|
70
|
-
onClick?.(
|
|
63
|
+
onClick?.(itemId, event);
|
|
71
64
|
|
|
72
65
|
if (_insidePopover && _popoverId) {
|
|
73
66
|
removePopover!(_popoverId);
|
|
@@ -79,7 +72,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
79
72
|
event.stopPropagation();
|
|
80
73
|
|
|
81
74
|
if (onRightIconClick) {
|
|
82
|
-
onRightIconClick(
|
|
75
|
+
onRightIconClick(itemId, event);
|
|
83
76
|
|
|
84
77
|
if (_insidePopover && _popoverId) {
|
|
85
78
|
removePopover!(_popoverId);
|
|
@@ -104,7 +97,6 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
104
97
|
disabled={disabled}
|
|
105
98
|
intent={intent}
|
|
106
99
|
icon={icon}
|
|
107
|
-
wrap={wrapText}
|
|
108
100
|
>
|
|
109
101
|
{label || children}
|
|
110
102
|
</ReqoreButton>
|
|
@@ -120,7 +112,6 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
|
|
|
120
112
|
readOnly={!onRightIconClick}
|
|
121
113
|
intent={intent}
|
|
122
114
|
active={selected && !!onRightIconClick}
|
|
123
|
-
wrap={wrapText}
|
|
124
115
|
/>
|
|
125
116
|
)}
|
|
126
117
|
</ReqoreControlGroup>
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { animated } from '@react-spring/web';
|
|
1
2
|
import React, { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
2
3
|
import { useMount, useUnmount } from 'react-use';
|
|
3
|
-
import { TEXT_FROM_SIZE
|
|
4
|
-
import { IReqoreTheme
|
|
4
|
+
import { TEXT_FROM_SIZE } from '../../constants/sizes';
|
|
5
|
+
import { IReqoreTheme } from '../../constants/theme';
|
|
5
6
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
6
7
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
IReqoreIntent,
|
|
10
|
+
IWithReqoreCustomTheme,
|
|
11
|
+
IWithReqoreEffect,
|
|
12
|
+
IWithReqoreSize,
|
|
13
|
+
} from '../../types/global';
|
|
8
14
|
import { IReqoreIconName } from '../../types/icons';
|
|
9
15
|
import ReqoreIcon from '../Icon';
|
|
10
16
|
import {
|
|
@@ -18,8 +24,10 @@ import {
|
|
|
18
24
|
|
|
19
25
|
export interface IReqoreMessageProps
|
|
20
26
|
extends IWithReqoreCustomTheme,
|
|
27
|
+
IWithReqoreEffect,
|
|
28
|
+
IWithReqoreSize,
|
|
29
|
+
IReqoreIntent,
|
|
21
30
|
React.HTMLAttributes<HTMLDivElement> {
|
|
22
|
-
intent?: TReqoreIntent;
|
|
23
31
|
title?: string;
|
|
24
32
|
children: any;
|
|
25
33
|
icon?: IReqoreIconName;
|
|
@@ -29,7 +37,6 @@ export interface IReqoreMessageProps
|
|
|
29
37
|
onFinish?: () => any;
|
|
30
38
|
flat?: boolean;
|
|
31
39
|
inverted?: boolean;
|
|
32
|
-
size?: TSizes;
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
export interface IReqoreNotificationStyle extends IReqoreMessageProps {
|
|
@@ -96,6 +103,7 @@ const ReqoreMessage: React.FC<IReqoreMessageProps> = forwardRef(
|
|
|
96
103
|
<ReqoreThemeProvider>
|
|
97
104
|
<StyledReqoreNotification
|
|
98
105
|
{...rest}
|
|
106
|
+
as={animated.div}
|
|
99
107
|
key={`${duration}${intent}${title}${children}`}
|
|
100
108
|
intent={intent}
|
|
101
109
|
timeout={duration}
|
|
@@ -14,16 +14,18 @@ import {
|
|
|
14
14
|
getNotificationIntent,
|
|
15
15
|
getReadableColorFrom,
|
|
16
16
|
} from '../../helpers/colors';
|
|
17
|
+
import { IWithReqoreEffect } from '../../types/global';
|
|
17
18
|
import { IReqoreIconName } from '../../types/icons';
|
|
19
|
+
import { StyledEffect } from '../Effect';
|
|
18
20
|
import ReqoreIcon from '../Icon';
|
|
19
21
|
|
|
20
22
|
export type IReqoreNotificationType = TReqoreIntent;
|
|
21
23
|
|
|
22
|
-
export interface IReqoreNotificationProps {
|
|
24
|
+
export interface IReqoreNotificationProps extends IWithReqoreEffect {
|
|
23
25
|
type?: IReqoreNotificationType;
|
|
24
26
|
intent?: TReqoreIntent;
|
|
25
27
|
title?: string;
|
|
26
|
-
content: string;
|
|
28
|
+
content: string | React.ReactNode;
|
|
27
29
|
icon?: IReqoreIconName;
|
|
28
30
|
onClose?: () => any;
|
|
29
31
|
onClick?: () => any;
|
|
@@ -58,7 +60,7 @@ const timeoutAnimation = keyframes`
|
|
|
58
60
|
}
|
|
59
61
|
`;
|
|
60
62
|
|
|
61
|
-
export const StyledReqoreNotification = styled(
|
|
63
|
+
export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotificationStyle>`
|
|
62
64
|
min-width: ${({ fluid }) => (!fluid ? '200px' : undefined)};
|
|
63
65
|
max-width: ${({ fluid }) => (!fluid ? '450px' : undefined)};
|
|
64
66
|
border-radius: 5px;
|
|
@@ -249,6 +251,7 @@ const ReqoreNotification: React.FC<IReqoreNotificationProps> = forwardRef(
|
|
|
249
251
|
item ? (
|
|
250
252
|
<ReqoreThemeProvider>
|
|
251
253
|
<StyledReqoreNotification
|
|
254
|
+
as={animated.div}
|
|
252
255
|
key={`${duration}${type || intent}${title}${content}`}
|
|
253
256
|
type={type || intent}
|
|
254
257
|
hasShadow
|
|
@@ -32,6 +32,8 @@ import { StyledCollectionItemContent } from '../Collection/item';
|
|
|
32
32
|
import ReqoreControlGroup from '../ControlGroup';
|
|
33
33
|
import ReqoreDropdown from '../Dropdown';
|
|
34
34
|
import { IReqoreDropdownItem } from '../Dropdown/list';
|
|
35
|
+
import { IReqoreEffect, StyledEffect } from '../Effect';
|
|
36
|
+
import { ReqoreHeading } from '../Header';
|
|
35
37
|
import ReqoreIcon from '../Icon';
|
|
36
38
|
|
|
37
39
|
export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreTooltip, IReqoreIntent {
|
|
@@ -58,6 +60,7 @@ export interface IReqorePanelProps
|
|
|
58
60
|
children?: any;
|
|
59
61
|
icon?: IReqoreIconName;
|
|
60
62
|
label?: string | ReactElement<any>;
|
|
63
|
+
|
|
61
64
|
collapsible?: boolean;
|
|
62
65
|
isCollapsed?: boolean;
|
|
63
66
|
onClose?: () => void;
|
|
@@ -74,6 +77,8 @@ export interface IReqorePanelProps
|
|
|
74
77
|
minimal?: boolean;
|
|
75
78
|
headerSize?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
76
79
|
contentSize?: TSizes;
|
|
80
|
+
contentEffect?: IReqoreEffect;
|
|
81
|
+
headerEffect?: IReqoreEffect;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
export interface IStyledPanel extends IReqorePanelProps {
|
|
@@ -81,7 +86,7 @@ export interface IStyledPanel extends IReqorePanelProps {
|
|
|
81
86
|
noHorizontalPadding?: boolean;
|
|
82
87
|
}
|
|
83
88
|
|
|
84
|
-
export const StyledPanel = styled
|
|
89
|
+
export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
|
|
85
90
|
background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
|
|
86
91
|
rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)};
|
|
87
92
|
border-radius: ${({ rounded }) => (rounded ? RADIUS_FROM_SIZE.normal : 0)}px;
|
|
@@ -136,8 +141,8 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
|
|
|
136
141
|
justify-content: space-between;
|
|
137
142
|
height: 40px;
|
|
138
143
|
align-items: center;
|
|
139
|
-
padding: ${({ noHorizontalPadding }: IStyledPanel) =>
|
|
140
|
-
`0 5px 0 ${noHorizontalPadding ? 0 :
|
|
144
|
+
padding: ${({ noHorizontalPadding, contentSize }: IStyledPanel) =>
|
|
145
|
+
`0 5px 0 ${noHorizontalPadding ? 0 : `${TEXT_FROM_SIZE[contentSize]}px`}`};
|
|
141
146
|
border-bottom: ${({ theme, isCollapsed, flat, opacity = 1 }) =>
|
|
142
147
|
!isCollapsed && !flat
|
|
143
148
|
? `1px solid ${rgba(changeLightness(getMainBackgroundColor(theme), 0.2), opacity)}`
|
|
@@ -159,6 +164,7 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
|
|
|
159
164
|
|
|
160
165
|
export const StyledPanelBottomActions = styled(StyledPanelTitle)`
|
|
161
166
|
padding-left: 5px;
|
|
167
|
+
padding-right: 5px;
|
|
162
168
|
border-bottom: 0;
|
|
163
169
|
border-top: ${({ theme, flat, opacity = 1 }) =>
|
|
164
170
|
!flat
|
|
@@ -183,23 +189,12 @@ export const StyledPanelContent = styled.div<IStyledPanel>`
|
|
|
183
189
|
font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
|
|
184
190
|
`;
|
|
185
191
|
|
|
186
|
-
export const StyledPanelTitleLabel = styled.span`
|
|
187
|
-
white-space: nowrap;
|
|
188
|
-
text-overflow: ellipsis;
|
|
189
|
-
overflow: hidden;
|
|
190
|
-
margin: 0;
|
|
191
|
-
`;
|
|
192
|
-
|
|
193
192
|
export const StyledPanelTitleHeader = styled.div`
|
|
194
193
|
display: flex;
|
|
195
194
|
justify-content: center;
|
|
196
195
|
align-items: center;
|
|
197
196
|
overflow: hidden;
|
|
198
197
|
padding-right: 5px;
|
|
199
|
-
|
|
200
|
-
${StyledPanelTitleLabel} {
|
|
201
|
-
font-weight: 600;
|
|
202
|
-
}
|
|
203
198
|
`;
|
|
204
199
|
|
|
205
200
|
export const ReqorePanel = forwardRef(
|
|
@@ -222,6 +217,8 @@ export const ReqorePanel = forwardRef(
|
|
|
222
217
|
onCollapseChange,
|
|
223
218
|
padded = true,
|
|
224
219
|
contentStyle,
|
|
220
|
+
contentEffect,
|
|
221
|
+
headerEffect = {},
|
|
225
222
|
headerSize = 4,
|
|
226
223
|
contentSize = 'normal',
|
|
227
224
|
minimal,
|
|
@@ -271,9 +268,7 @@ export const ReqorePanel = forwardRef(
|
|
|
271
268
|
(actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
|
|
272
269
|
if (Array.isArray(actionOrActions)) {
|
|
273
270
|
return (
|
|
274
|
-
<ReqoreControlGroup stack
|
|
275
|
-
{actionOrActions.map(renderActions)}
|
|
276
|
-
</ReqoreControlGroup>
|
|
271
|
+
<ReqoreControlGroup stack>{actionOrActions.map(renderActions)}</ReqoreControlGroup>
|
|
277
272
|
);
|
|
278
273
|
}
|
|
279
274
|
|
|
@@ -330,10 +325,6 @@ export const ReqorePanel = forwardRef(
|
|
|
330
325
|
[actions, theme]
|
|
331
326
|
);
|
|
332
327
|
|
|
333
|
-
const HTMLheaderElement = useMemo(() => {
|
|
334
|
-
return `h${headerSize}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
335
|
-
}, [headerSize]);
|
|
336
|
-
|
|
337
328
|
const interactive: boolean = !!(
|
|
338
329
|
rest.onClick ||
|
|
339
330
|
rest.onMouseOver ||
|
|
@@ -353,6 +344,7 @@ export const ReqorePanel = forwardRef(
|
|
|
353
344
|
className={`${className || ''} reqore-panel`}
|
|
354
345
|
interactive={interactive}
|
|
355
346
|
theme={theme}
|
|
347
|
+
effect={contentEffect}
|
|
356
348
|
>
|
|
357
349
|
{hasTitleBar && (
|
|
358
350
|
<StyledPanelTitle
|
|
@@ -362,6 +354,7 @@ export const ReqorePanel = forwardRef(
|
|
|
362
354
|
className='reqore-panel-title'
|
|
363
355
|
onClick={handleCollapseClick}
|
|
364
356
|
theme={theme}
|
|
357
|
+
contentSize={contentSize}
|
|
365
358
|
opacity={rest.opacity ?? (minimal ? 0 : 1)}
|
|
366
359
|
noHorizontalPadding={rest.opacity === 0}
|
|
367
360
|
>
|
|
@@ -374,12 +367,20 @@ export const ReqorePanel = forwardRef(
|
|
|
374
367
|
/>
|
|
375
368
|
)}
|
|
376
369
|
{typeof label === 'string' ? (
|
|
377
|
-
<
|
|
370
|
+
<ReqoreHeading
|
|
371
|
+
size={headerSize}
|
|
372
|
+
effect={{
|
|
373
|
+
noWrap: true,
|
|
374
|
+
...headerEffect,
|
|
375
|
+
}}
|
|
376
|
+
>
|
|
377
|
+
{label}
|
|
378
|
+
</ReqoreHeading>
|
|
378
379
|
) : (
|
|
379
380
|
label
|
|
380
381
|
)}
|
|
381
382
|
</StyledPanelTitleHeader>
|
|
382
|
-
<ReqoreControlGroup
|
|
383
|
+
<ReqoreControlGroup>
|
|
383
384
|
{actions.map(renderActions)}
|
|
384
385
|
{collapsible && (
|
|
385
386
|
<ReqoreButton
|
|
@@ -404,6 +405,7 @@ export const ReqorePanel = forwardRef(
|
|
|
404
405
|
)}
|
|
405
406
|
{!_isCollapsed || (_isCollapsed && !unMountContentOnCollapse) ? (
|
|
406
407
|
<StyledPanelContent
|
|
408
|
+
as={'div'}
|
|
407
409
|
className='reqore-panel-content'
|
|
408
410
|
hasLabel={!!label}
|
|
409
411
|
isCollapsed={_isCollapsed}
|
|
@@ -424,8 +426,8 @@ export const ReqorePanel = forwardRef(
|
|
|
424
426
|
opacity={rest.opacity ?? (minimal ? 0 : 1)}
|
|
425
427
|
noHorizontalPadding={rest.opacity === 0}
|
|
426
428
|
>
|
|
427
|
-
<ReqoreControlGroup
|
|
428
|
-
<ReqoreControlGroup
|
|
429
|
+
<ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
430
|
+
<ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
429
431
|
</StyledPanelBottomActions>
|
|
430
432
|
) : null}
|
|
431
433
|
</StyledPanel>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { memo, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import usePopover, { IPopoverOptions } from '../../hooks/usePopover';
|
|
4
|
-
import { useWhyDidYouUpdate } from '../../hooks/useWhyDidYouUpdate';
|
|
5
4
|
import { IReqoreComponent } from '../../types/global';
|
|
6
5
|
|
|
7
6
|
export interface IReqorePopoverProps extends IReqoreComponent, IPopoverOptions {
|
|
@@ -33,18 +32,6 @@ const Popover = memo(
|
|
|
33
32
|
}: IReqorePopoverProps) => {
|
|
34
33
|
const [ref, setRef] = useState(undefined);
|
|
35
34
|
|
|
36
|
-
useWhyDidYouUpdate('popover', {
|
|
37
|
-
component: Component,
|
|
38
|
-
componentProps,
|
|
39
|
-
children,
|
|
40
|
-
isReqoreComponent,
|
|
41
|
-
noWrapper,
|
|
42
|
-
wrapperTag,
|
|
43
|
-
wrapperStyle,
|
|
44
|
-
_insidePopover,
|
|
45
|
-
_popoverId,
|
|
46
|
-
...rest,
|
|
47
|
-
});
|
|
48
35
|
usePopover({ targetElement: ref, ...rest });
|
|
49
36
|
|
|
50
37
|
if (isReqoreComponent || noWrapper) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import { forwardRef, memo } 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';
|
|
5
5
|
import { IReqoreCustomTheme, IReqoreTheme } from '../../constants/theme';
|
|
6
|
+
import { changeLightness } from '../../helpers/colors';
|
|
6
7
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
7
8
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
8
9
|
import ReqoreButton from '../Button';
|
|
@@ -37,7 +38,16 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
37
38
|
padding: ${vertical ? `${TABS_PADDING_TO_PX[size!]}px` : `${TABS_PADDING_TO_PX[size!]}px`};
|
|
38
39
|
${active &&
|
|
39
40
|
css`
|
|
40
|
-
|
|
41
|
+
&:after {
|
|
42
|
+
width: ${vertical ? '5px' : '1px'};
|
|
43
|
+
height: ${vertical ? '1px' : '5px'};
|
|
44
|
+
left: ${vertical ? '0' : '50%'};
|
|
45
|
+
top: ${vertical ? '50%' : undefined};
|
|
46
|
+
bottom: ${vertical ? undefined : '0'};
|
|
47
|
+
content: '';
|
|
48
|
+
position: absolute;
|
|
49
|
+
background-color: ${activeColor};
|
|
50
|
+
}
|
|
41
51
|
`}
|
|
42
52
|
|
|
43
53
|
${fill &&
|
|
@@ -64,87 +74,90 @@ export const StyledTabListItem = styled.div<IReqoreTabListItemStyle>`
|
|
|
64
74
|
}
|
|
65
75
|
`;
|
|
66
76
|
|
|
67
|
-
const ReqoreTabsListItem =
|
|
68
|
-
(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
const ReqoreTabsListItem = memo(
|
|
78
|
+
forwardRef(
|
|
79
|
+
(
|
|
80
|
+
{
|
|
81
|
+
tooltip,
|
|
82
|
+
label,
|
|
83
|
+
props,
|
|
84
|
+
icon,
|
|
85
|
+
active,
|
|
86
|
+
as,
|
|
87
|
+
disabled,
|
|
88
|
+
vertical,
|
|
89
|
+
onClick,
|
|
90
|
+
activeIntent,
|
|
91
|
+
onCloseClick,
|
|
92
|
+
fill,
|
|
93
|
+
intent,
|
|
94
|
+
size = 'normal',
|
|
95
|
+
closeIcon,
|
|
96
|
+
customTheme,
|
|
97
|
+
className,
|
|
98
|
+
}: IReqoreTabListItemProps,
|
|
99
|
+
ref
|
|
100
|
+
) => {
|
|
101
|
+
const { targetRef } = useCombinedRefs(ref);
|
|
102
|
+
const theme = useReqoreTheme('main', customTheme);
|
|
103
|
+
const _intent = activeIntent || intent;
|
|
104
|
+
const activeColor = _intent ? theme.intents[_intent] : changeLightness(theme.main, 0.05);
|
|
94
105
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<ReqoreButton
|
|
114
|
-
flat
|
|
115
|
-
fluid={fill || vertical}
|
|
116
|
-
icon={icon}
|
|
117
|
-
minimal
|
|
118
|
-
intent={active ? activeIntent || intent : intent}
|
|
119
|
-
active={active}
|
|
120
|
-
disabled={disabled}
|
|
121
|
-
onClick={onClick}
|
|
122
|
-
tooltip={tooltip}
|
|
123
|
-
customTheme={customTheme}
|
|
124
|
-
className={`reqore-tabs-list-item ${active ? 'reqore-tabs-list-item-active' : ''}`}
|
|
125
|
-
>
|
|
126
|
-
{label}
|
|
127
|
-
</ReqoreButton>
|
|
128
|
-
{onCloseClick && !disabled ? (
|
|
106
|
+
return (
|
|
107
|
+
<StyledTabListItem
|
|
108
|
+
ref={targetRef}
|
|
109
|
+
{...props}
|
|
110
|
+
className={className}
|
|
111
|
+
intent={intent}
|
|
112
|
+
activeIntent={activeIntent}
|
|
113
|
+
activeColor={activeColor}
|
|
114
|
+
as={as}
|
|
115
|
+
size={size}
|
|
116
|
+
active={active}
|
|
117
|
+
disabled={disabled}
|
|
118
|
+
vertical={vertical}
|
|
119
|
+
theme={theme}
|
|
120
|
+
fill={fill}
|
|
121
|
+
>
|
|
122
|
+
{label || icon ? (
|
|
123
|
+
<ReqoreControlGroup stack size={size} fluid={fill || vertical}>
|
|
129
124
|
<ReqoreButton
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
icon={
|
|
133
|
-
intent={active ? activeIntent || intent : intent}
|
|
125
|
+
flat={!active && !intent}
|
|
126
|
+
fluid={fill || vertical}
|
|
127
|
+
icon={icon}
|
|
134
128
|
minimal
|
|
135
|
-
|
|
129
|
+
intent={active ? activeIntent || intent : intent}
|
|
130
|
+
active={active}
|
|
131
|
+
disabled={disabled}
|
|
132
|
+
onClick={onClick}
|
|
133
|
+
tooltip={tooltip}
|
|
136
134
|
customTheme={customTheme}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
135
|
+
className={`reqore-tabs-list-item ${active ? 'reqore-tabs-list-item-active' : ''}`}
|
|
136
|
+
>
|
|
137
|
+
{label}
|
|
138
|
+
</ReqoreButton>
|
|
139
|
+
{onCloseClick && !disabled ? (
|
|
140
|
+
<ReqoreButton
|
|
141
|
+
fixed
|
|
142
|
+
flat={!active && !intent}
|
|
143
|
+
icon={closeIcon || 'CloseLine'}
|
|
144
|
+
intent={active ? activeIntent || intent : intent}
|
|
145
|
+
minimal
|
|
146
|
+
active={active}
|
|
147
|
+
className='reqore-tabs-list-item-close'
|
|
148
|
+
customTheme={customTheme}
|
|
149
|
+
onClick={(event) => {
|
|
150
|
+
event.stopPropagation();
|
|
151
|
+
onCloseClick?.();
|
|
152
|
+
}}
|
|
153
|
+
/>
|
|
154
|
+
) : null}
|
|
155
|
+
</ReqoreControlGroup>
|
|
156
|
+
) : null}
|
|
157
|
+
</StyledTabListItem>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
)
|
|
148
161
|
);
|
|
149
162
|
|
|
150
163
|
export default ReqoreTabsListItem;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _size from 'lodash/size';
|
|
2
|
+
import { rgba } from 'polished';
|
|
2
3
|
import React, { forwardRef, useContext } from 'react';
|
|
3
4
|
import styled, { css } from 'styled-components';
|
|
4
5
|
import { ReqorePopover } from '../..';
|
|
@@ -14,8 +15,14 @@ import ThemeContext from '../../context/ThemeContext';
|
|
|
14
15
|
import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
|
|
15
16
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
16
17
|
import { useTooltip } from '../../hooks/useTooltip';
|
|
17
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
IReqoreDisabled,
|
|
20
|
+
IReqoreIntent,
|
|
21
|
+
IWithReqoreEffect,
|
|
22
|
+
IWithReqoreTooltip,
|
|
23
|
+
} from '../../types/global';
|
|
18
24
|
import { IReqoreIconName } from '../../types/icons';
|
|
25
|
+
import { StyledEffect } from '../Effect';
|
|
19
26
|
import ReqoreIcon from '../Icon';
|
|
20
27
|
|
|
21
28
|
export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
|
|
@@ -26,7 +33,8 @@ export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, I
|
|
|
26
33
|
export interface IReqoreTagProps
|
|
27
34
|
extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'>,
|
|
28
35
|
IWithReqoreTooltip,
|
|
29
|
-
IReqoreDisabled
|
|
36
|
+
IReqoreDisabled,
|
|
37
|
+
IWithReqoreEffect {
|
|
30
38
|
size?: TSizes;
|
|
31
39
|
label?: string | number;
|
|
32
40
|
labelKey?: string | number;
|
|
@@ -47,7 +55,7 @@ export interface IReqoreTagStyle extends IReqoreTagProps {
|
|
|
47
55
|
interactive?: boolean;
|
|
48
56
|
}
|
|
49
57
|
|
|
50
|
-
export const StyledTag = styled
|
|
58
|
+
export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
51
59
|
display: inline-flex;
|
|
52
60
|
justify-content: center;
|
|
53
61
|
flex-shrink: 0;
|
|
@@ -55,6 +63,7 @@ export const StyledTag = styled.div<IReqoreTagStyle>`
|
|
|
55
63
|
font-family: system-ui;
|
|
56
64
|
font-weight: 600;
|
|
57
65
|
overflow: hidden;
|
|
66
|
+
vertical-align: middle;
|
|
58
67
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
59
68
|
height: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
60
69
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
@@ -67,8 +76,8 @@ export const StyledTag = styled.div<IReqoreTagStyle>`
|
|
|
67
76
|
background-color: ${color || changeLightness(theme.main, 0.1)};
|
|
68
77
|
color: ${color ? getReadableColorFrom(color) : getReadableColor(theme, undefined, undefined)};
|
|
69
78
|
|
|
70
|
-
${
|
|
71
|
-
background-color: ${labelKey ?
|
|
79
|
+
${StyledTagContentWrapper} {
|
|
80
|
+
background-color: ${labelKey ? rgba('#000000', 0.2) : undefined};
|
|
72
81
|
}
|
|
73
82
|
`}
|
|
74
83
|
|
|
@@ -130,14 +139,14 @@ const StyledButtonWrapper = styled.div<IReqoreTagStyle>`
|
|
|
130
139
|
align-items: center;
|
|
131
140
|
transition: all 0.2s ease-out;
|
|
132
141
|
|
|
133
|
-
${({
|
|
142
|
+
${({ color }) =>
|
|
134
143
|
css`
|
|
135
144
|
.reqore-icon {
|
|
136
145
|
transform: scale(0.85);
|
|
137
146
|
}
|
|
138
147
|
&:hover {
|
|
139
148
|
cursor: pointer;
|
|
140
|
-
background-color: ${changeLightness(color
|
|
149
|
+
background-color: ${color ? changeLightness(color, 0.09) : rgba('#000000', 0.2)};
|
|
141
150
|
|
|
142
151
|
.reqore-icon {
|
|
143
152
|
transform: scale(1);
|