@qoretechnologies/reqore 0.25.9 → 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__/dropdown.test.tsx +133 -12
- 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/Collection/item.d.ts +2 -2
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +6 -3
- package/dist/components/Collection/item.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/Dropdown/index.d.ts +8 -7
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +12 -5
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/item.d.ts +2 -2
- package/dist/components/Dropdown/item.d.ts.map +1 -1
- package/dist/components/Dropdown/item.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +9 -2
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +13 -5
- package/dist/components/Dropdown/list.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/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +0 -1
- package/dist/components/InternalPopover/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 +5 -3
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +17 -27
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/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/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +23 -9
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/hooks/useWhyDidYouUpdate.d.ts +2 -0
- package/dist/hooks/useWhyDidYouUpdate.d.ts.map +1 -0
- package/dist/hooks/useWhyDidYouUpdate.js +47 -0
- package/dist/hooks/useWhyDidYouUpdate.js.map +1 -0
- 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/Collection/item.tsx +6 -3
- package/src/components/ControlGroup/index.tsx +1 -0
- package/src/components/Dropdown/index.tsx +62 -36
- package/src/components/Dropdown/item.tsx +3 -6
- package/src/components/Dropdown/list.tsx +82 -56
- 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/InternalPopover/index.tsx +0 -2
- 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 +83 -79
- package/src/components/Popover/index.tsx +40 -38
- 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/hooks/usePopover.tsx +34 -20
- package/src/hooks/useWhyDidYouUpdate.ts +32 -0
- 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/Collection/Collection.stories.tsx +1 -1
- package/src/stories/Dropdown/Dropdown.stories.tsx +62 -34
- 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 +41 -5
- 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
|
|
@@ -31,13 +31,15 @@ import ReqoreButton, { IReqoreButtonProps } from '../Button';
|
|
|
31
31
|
import { StyledCollectionItemContent } from '../Collection/item';
|
|
32
32
|
import ReqoreControlGroup from '../ControlGroup';
|
|
33
33
|
import ReqoreDropdown from '../Dropdown';
|
|
34
|
-
import {
|
|
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 {
|
|
38
40
|
label?: string | number;
|
|
39
41
|
onClick?: () => void;
|
|
40
|
-
actions?:
|
|
42
|
+
actions?: IReqoreDropdownItem[];
|
|
41
43
|
customContent?: () => string | React.ReactNode;
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -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,
|
|
@@ -267,70 +264,66 @@ export const ReqorePanel = forwardRef(
|
|
|
267
264
|
[leftBottomActions, rightBottomActions]
|
|
268
265
|
);
|
|
269
266
|
|
|
270
|
-
const renderActions = (
|
|
271
|
-
actionOrActions: IReqorePanelAction | IReqorePanelAction[],
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
267
|
+
const renderActions = useCallback(
|
|
268
|
+
(actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
|
|
269
|
+
if (Array.isArray(actionOrActions)) {
|
|
270
|
+
return (
|
|
271
|
+
<ReqoreControlGroup stack>{actionOrActions.map(renderActions)}</ReqoreControlGroup>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const {
|
|
276
|
+
id,
|
|
277
|
+
actions,
|
|
278
|
+
label,
|
|
279
|
+
intent,
|
|
280
|
+
className,
|
|
281
|
+
customContent,
|
|
282
|
+
...rest
|
|
283
|
+
}: IReqorePanelAction = actionOrActions;
|
|
284
|
+
|
|
285
|
+
if (size(actions)) {
|
|
286
|
+
return (
|
|
287
|
+
<ReqoreDropdown<IReqoreButtonProps>
|
|
288
|
+
{...rest}
|
|
289
|
+
key={index}
|
|
290
|
+
label={label}
|
|
291
|
+
items={actions}
|
|
292
|
+
intent={intent}
|
|
293
|
+
className={className}
|
|
294
|
+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => e.stopPropagation()}
|
|
295
|
+
id={id}
|
|
296
|
+
/>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (customContent) {
|
|
301
|
+
return customContent();
|
|
302
|
+
}
|
|
284
303
|
|
|
285
|
-
if (size(actions)) {
|
|
286
304
|
return (
|
|
287
|
-
<
|
|
305
|
+
<ReqoreButton
|
|
288
306
|
{...rest}
|
|
307
|
+
id={id}
|
|
289
308
|
key={index}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
className={className}
|
|
310
|
+
customTheme={theme}
|
|
311
|
+
intent={intent}
|
|
312
|
+
onClick={
|
|
313
|
+
rest.onClick
|
|
314
|
+
? (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
315
|
+
e.stopPropagation();
|
|
316
|
+
rest.onClick?.();
|
|
317
|
+
}
|
|
318
|
+
: undefined
|
|
319
|
+
}
|
|
320
|
+
>
|
|
321
|
+
{label}
|
|
322
|
+
</ReqoreButton>
|
|
302
323
|
);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
return customContent();
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return (
|
|
310
|
-
<ReqoreButton
|
|
311
|
-
{...rest}
|
|
312
|
-
id={id}
|
|
313
|
-
key={index}
|
|
314
|
-
className={className}
|
|
315
|
-
customTheme={theme}
|
|
316
|
-
intent={intent}
|
|
317
|
-
onClick={
|
|
318
|
-
rest.onClick
|
|
319
|
-
? (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
320
|
-
e.stopPropagation();
|
|
321
|
-
rest.onClick?.();
|
|
322
|
-
}
|
|
323
|
-
: undefined
|
|
324
|
-
}
|
|
325
|
-
>
|
|
326
|
-
{label}
|
|
327
|
-
</ReqoreButton>
|
|
328
|
-
);
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
const HTMLheaderElement = useMemo(() => {
|
|
332
|
-
return `h${headerSize}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
333
|
-
}, [headerSize]);
|
|
324
|
+
},
|
|
325
|
+
[actions, theme]
|
|
326
|
+
);
|
|
334
327
|
|
|
335
328
|
const interactive: boolean = !!(
|
|
336
329
|
rest.onClick ||
|
|
@@ -351,6 +344,7 @@ export const ReqorePanel = forwardRef(
|
|
|
351
344
|
className={`${className || ''} reqore-panel`}
|
|
352
345
|
interactive={interactive}
|
|
353
346
|
theme={theme}
|
|
347
|
+
effect={contentEffect}
|
|
354
348
|
>
|
|
355
349
|
{hasTitleBar && (
|
|
356
350
|
<StyledPanelTitle
|
|
@@ -360,6 +354,7 @@ export const ReqorePanel = forwardRef(
|
|
|
360
354
|
className='reqore-panel-title'
|
|
361
355
|
onClick={handleCollapseClick}
|
|
362
356
|
theme={theme}
|
|
357
|
+
contentSize={contentSize}
|
|
363
358
|
opacity={rest.opacity ?? (minimal ? 0 : 1)}
|
|
364
359
|
noHorizontalPadding={rest.opacity === 0}
|
|
365
360
|
>
|
|
@@ -372,12 +367,20 @@ export const ReqorePanel = forwardRef(
|
|
|
372
367
|
/>
|
|
373
368
|
)}
|
|
374
369
|
{typeof label === 'string' ? (
|
|
375
|
-
<
|
|
370
|
+
<ReqoreHeading
|
|
371
|
+
size={headerSize}
|
|
372
|
+
effect={{
|
|
373
|
+
noWrap: true,
|
|
374
|
+
...headerEffect,
|
|
375
|
+
}}
|
|
376
|
+
>
|
|
377
|
+
{label}
|
|
378
|
+
</ReqoreHeading>
|
|
376
379
|
) : (
|
|
377
380
|
label
|
|
378
381
|
)}
|
|
379
382
|
</StyledPanelTitleHeader>
|
|
380
|
-
<ReqoreControlGroup
|
|
383
|
+
<ReqoreControlGroup>
|
|
381
384
|
{actions.map(renderActions)}
|
|
382
385
|
{collapsible && (
|
|
383
386
|
<ReqoreButton
|
|
@@ -402,6 +405,7 @@ export const ReqorePanel = forwardRef(
|
|
|
402
405
|
)}
|
|
403
406
|
{!_isCollapsed || (_isCollapsed && !unMountContentOnCollapse) ? (
|
|
404
407
|
<StyledPanelContent
|
|
408
|
+
as={'div'}
|
|
405
409
|
className='reqore-panel-content'
|
|
406
410
|
hasLabel={!!label}
|
|
407
411
|
isCollapsed={_isCollapsed}
|
|
@@ -422,8 +426,8 @@ export const ReqorePanel = forwardRef(
|
|
|
422
426
|
opacity={rest.opacity ?? (minimal ? 0 : 1)}
|
|
423
427
|
noHorizontalPadding={rest.opacity === 0}
|
|
424
428
|
>
|
|
425
|
-
<ReqoreControlGroup
|
|
426
|
-
<ReqoreControlGroup
|
|
429
|
+
<ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
430
|
+
<ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
427
431
|
</StyledPanelBottomActions>
|
|
428
432
|
) : null}
|
|
429
433
|
</StyledPanel>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { memo, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import usePopover, { IPopoverOptions } from '../../hooks/usePopover';
|
|
4
4
|
import { IReqoreComponent } from '../../types/global';
|
|
@@ -17,49 +17,51 @@ export const StyledPopover = styled.span`
|
|
|
17
17
|
overflow: hidden;
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
|
-
const Popover = (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
const Popover = memo(
|
|
21
|
+
({
|
|
22
|
+
component: Component,
|
|
23
|
+
componentProps,
|
|
24
|
+
children,
|
|
25
|
+
isReqoreComponent,
|
|
26
|
+
noWrapper,
|
|
27
|
+
wrapperTag = 'span',
|
|
28
|
+
wrapperStyle = {},
|
|
29
|
+
_insidePopover,
|
|
30
|
+
_popoverId,
|
|
31
|
+
...rest
|
|
32
|
+
}: IReqorePopoverProps) => {
|
|
33
|
+
const [ref, setRef] = useState(undefined);
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
usePopover({ targetElement: ref, ...rest });
|
|
36
|
+
|
|
37
|
+
if (isReqoreComponent || noWrapper) {
|
|
38
|
+
return (
|
|
39
|
+
<Component
|
|
40
|
+
{...componentProps}
|
|
41
|
+
_insidePopover={_insidePopover}
|
|
42
|
+
_popoverId={_popoverId}
|
|
43
|
+
ref={setRef}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</Component>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
35
49
|
|
|
36
|
-
if (isReqoreComponent || noWrapper) {
|
|
37
50
|
return (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
<StyledPopover
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
as={wrapperTag}
|
|
55
|
+
className='reqore-popover-wrapper'
|
|
42
56
|
ref={setRef}
|
|
57
|
+
style={wrapperStyle}
|
|
43
58
|
>
|
|
44
|
-
{
|
|
45
|
-
|
|
59
|
+
<Component {...componentProps} _insidePopover={_insidePopover} _popoverId={_popoverId}>
|
|
60
|
+
{children}
|
|
61
|
+
</Component>
|
|
62
|
+
</StyledPopover>
|
|
46
63
|
);
|
|
47
64
|
}
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
<StyledPopover
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
as={wrapperTag}
|
|
54
|
-
className='reqore-popover-wrapper'
|
|
55
|
-
ref={setRef}
|
|
56
|
-
style={wrapperStyle}
|
|
57
|
-
>
|
|
58
|
-
<Component {...componentProps} _insidePopover={_insidePopover} _popoverId={_popoverId}>
|
|
59
|
-
{children}
|
|
60
|
-
</Component>
|
|
61
|
-
</StyledPopover>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
65
|
+
);
|
|
64
66
|
|
|
65
67
|
export default Popover;
|