@qoretechnologies/reqore 0.25.10 → 0.26.1
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/.gitpod.yml +2 -2
- 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 +19 -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 +118 -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 +17 -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/components/Tree/index.d.ts +1 -0
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +4 -3
- package/dist/components/Tree/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 +6 -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 +2 -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 +41 -25
- package/src/components/ControlGroup/index.tsx +1 -0
- package/src/components/Effect/index.tsx +137 -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 +7 -4
- package/src/components/Panel/index.tsx +29 -26
- 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/components/Tree/index.tsx +6 -2
- package/src/constants/sizes.ts +8 -0
- package/src/constants/theme.ts +1 -0
- package/src/containers/ReqoreProvider.tsx +14 -8
- package/src/containers/UIProvider.tsx +13 -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 +18 -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
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
2
3
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
3
4
|
import { getReadableColor } from '../../helpers/colors';
|
|
5
|
+
import { IWithReqoreEffect } from '../../types/global';
|
|
6
|
+
import { StyledTextEffect } from '../Effect';
|
|
4
7
|
|
|
5
|
-
export interface
|
|
6
|
-
|
|
8
|
+
export interface IReqoreHeadingProps
|
|
9
|
+
extends IWithReqoreEffect,
|
|
10
|
+
React.HTMLAttributes<HTMLHeadingElement> {
|
|
7
11
|
intent?: TReqoreIntent;
|
|
12
|
+
size?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IReqoreHeadingStyle extends IReqoreHeadingProps {
|
|
16
|
+
theme: IReqoreTheme;
|
|
8
17
|
}
|
|
9
18
|
|
|
10
|
-
const
|
|
19
|
+
export const StyledHeader = styled(StyledTextEffect)`
|
|
11
20
|
margin: 0;
|
|
12
21
|
padding: 0;
|
|
13
|
-
color: ${
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const ReqoreH1: React.FC<Omit<IReqoreHeaderStyle, 'theme'>> = styled.h1<IReqoreHeaderStyle>`
|
|
17
|
-
${(props) => style(props)};
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
export const ReqoreH2: React.FC<Omit<IReqoreHeaderStyle, 'theme'>> = styled.h2<IReqoreHeaderStyle>`
|
|
21
|
-
${(props) => style(props)};
|
|
22
|
+
color: ${({ theme, intent }) =>
|
|
23
|
+
intent ? theme.intents[intent] : getReadableColor(theme, undefined, undefined, true)};
|
|
22
24
|
`;
|
|
23
25
|
|
|
24
|
-
export const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
export const ReqoreHeading = ({ size, children, ...props }: IReqoreHeadingProps) => {
|
|
27
|
+
const HTMLheaderElement = useMemo(() => {
|
|
28
|
+
return `h${size}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
29
|
+
}, [size]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<StyledHeader as={HTMLheaderElement} {...props}>
|
|
33
|
+
{children}
|
|
34
|
+
</StyledHeader>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const ReqoreH1 = (props: IReqoreHeadingProps) => <ReqoreHeading size={1} {...props} />;
|
|
39
|
+
export const ReqoreH2 = (props: IReqoreHeadingProps) => <ReqoreHeading size={2} {...props} />;
|
|
40
|
+
export const ReqoreH3 = (props: IReqoreHeadingProps) => <ReqoreHeading size={3} {...props} />;
|
|
41
|
+
export const ReqoreH4 = (props: IReqoreHeadingProps) => <ReqoreHeading size={4} {...props} />;
|
|
42
|
+
export const ReqoreH5 = (props: IReqoreHeadingProps) => <ReqoreHeading size={5} {...props} />;
|
|
43
|
+
export const ReqoreH6 = (props: IReqoreHeadingProps) => <ReqoreHeading size={6} {...props} />;
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
IReqoreIntent,
|
|
14
14
|
IReqoreReadOnly,
|
|
15
15
|
IWithReqoreCustomTheme,
|
|
16
|
+
IWithReqoreEffect,
|
|
16
17
|
} from '../../types/global';
|
|
17
18
|
import { IReqoreIconName } from '../../types/icons';
|
|
19
|
+
import { StyledEffect } from '../Effect';
|
|
18
20
|
import ReqoreIcon from '../Icon';
|
|
19
21
|
import ReqoreInputClearButton from '../InputClearButton';
|
|
20
22
|
|
|
@@ -23,7 +25,8 @@ export interface IReqoreInputProps
|
|
|
23
25
|
IReqoreDisabled,
|
|
24
26
|
IReqoreReadOnly,
|
|
25
27
|
IReqoreIntent,
|
|
26
|
-
IWithReqoreCustomTheme
|
|
28
|
+
IWithReqoreCustomTheme,
|
|
29
|
+
IWithReqoreEffect {
|
|
27
30
|
autoFocus?: boolean;
|
|
28
31
|
tooltip?: string;
|
|
29
32
|
width?: number;
|
|
@@ -37,6 +40,7 @@ export interface IReqoreInputProps
|
|
|
37
40
|
icon?: IReqoreIconName;
|
|
38
41
|
flat?: boolean;
|
|
39
42
|
rounded?: boolean;
|
|
43
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
@@ -66,7 +70,7 @@ const StyledIconWrapper = styled.div<IReqoreInputStyle>`
|
|
|
66
70
|
align-items: center;
|
|
67
71
|
`;
|
|
68
72
|
|
|
69
|
-
export const StyledInput = styled
|
|
73
|
+
export const StyledInput = styled(StyledEffect)<IReqoreInputStyle>`
|
|
70
74
|
height: 100%;
|
|
71
75
|
width: 100%;
|
|
72
76
|
flex: 1;
|
|
@@ -96,25 +100,28 @@ export const StyledInput = styled.input<IReqoreInputStyle>`
|
|
|
96
100
|
: undefined}
|
|
97
101
|
|
|
98
102
|
background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
|
|
99
|
-
minimal ? 'transparent' : rgba(theme.main, 0.
|
|
100
|
-
color: ${({ theme }: IReqoreInputStyle) =>
|
|
103
|
+
minimal ? 'transparent' : rgba(theme.main, 0.1)};
|
|
104
|
+
color: ${({ theme }: IReqoreInputStyle) =>
|
|
105
|
+
getReadableColor(theme, undefined, undefined, true, theme.originalMain)};
|
|
101
106
|
|
|
102
107
|
transition: all 0.2s ease-out;
|
|
103
108
|
|
|
104
109
|
&:active,
|
|
105
110
|
&:focus {
|
|
106
111
|
background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
|
|
107
|
-
minimal ? 'transparent' : rgba(theme.main, 0.
|
|
112
|
+
minimal ? 'transparent' : rgba(theme.main, 0.15)};
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
&::placeholder {
|
|
111
116
|
transition: all 0.2s ease-out;
|
|
112
|
-
color: ${({ theme }) =>
|
|
117
|
+
color: ${({ theme }) =>
|
|
118
|
+
rgba(getReadableColor(theme, undefined, undefined, true, theme.originalMain), 0.3)};
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
&:focus {
|
|
116
122
|
&::placeholder {
|
|
117
|
-
color: ${({ theme }) =>
|
|
123
|
+
color: ${({ theme }) =>
|
|
124
|
+
rgba(getReadableColor(theme, undefined, undefined, true, theme.originalMain), 0.5)};
|
|
118
125
|
}
|
|
119
126
|
}
|
|
120
127
|
|
|
@@ -174,6 +181,7 @@ const ReqoreInput = forwardRef(
|
|
|
174
181
|
)}
|
|
175
182
|
<StyledInput
|
|
176
183
|
{...rest}
|
|
184
|
+
as='input'
|
|
177
185
|
theme={theme}
|
|
178
186
|
_size={size}
|
|
179
187
|
minimal={minimal}
|
|
@@ -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,13 +60,13 @@ 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;
|
|
65
67
|
min-height: ${({ size = 'normal' }: IReqoreNotificationStyle) => TABS_SIZE_TO_PX[size]}px;
|
|
66
68
|
display: flex;
|
|
67
|
-
flex: 0 auto;
|
|
69
|
+
flex: 0 0 auto;
|
|
68
70
|
overflow: auto;
|
|
69
71
|
position: relative;
|
|
70
72
|
transition: all 0.2s ease-out;
|
|
@@ -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,10 @@ 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
|
|
144
|
+
padding: ${({ noHorizontalPadding, contentSize }: IStyledPanel) =>
|
|
145
|
+
`0 ${noHorizontalPadding ? 0 : '5px'} 0 ${
|
|
146
|
+
noHorizontalPadding ? 0 : `${TEXT_FROM_SIZE[contentSize]}px`
|
|
147
|
+
}`};
|
|
141
148
|
border-bottom: ${({ theme, isCollapsed, flat, opacity = 1 }) =>
|
|
142
149
|
!isCollapsed && !flat
|
|
143
150
|
? `1px solid ${rgba(changeLightness(getMainBackgroundColor(theme), 0.2), opacity)}`
|
|
@@ -158,7 +165,7 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
|
|
|
158
165
|
`;
|
|
159
166
|
|
|
160
167
|
export const StyledPanelBottomActions = styled(StyledPanelTitle)`
|
|
161
|
-
padding
|
|
168
|
+
padding: ${({ noHorizontalPadding }: IStyledPanel) => `0 ${noHorizontalPadding ? 0 : '5px'}`};
|
|
162
169
|
border-bottom: 0;
|
|
163
170
|
border-top: ${({ theme, flat, opacity = 1 }) =>
|
|
164
171
|
!flat
|
|
@@ -183,23 +190,12 @@ export const StyledPanelContent = styled.div<IStyledPanel>`
|
|
|
183
190
|
font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
|
|
184
191
|
`;
|
|
185
192
|
|
|
186
|
-
export const StyledPanelTitleLabel = styled.span`
|
|
187
|
-
white-space: nowrap;
|
|
188
|
-
text-overflow: ellipsis;
|
|
189
|
-
overflow: hidden;
|
|
190
|
-
margin: 0;
|
|
191
|
-
`;
|
|
192
|
-
|
|
193
193
|
export const StyledPanelTitleHeader = styled.div`
|
|
194
194
|
display: flex;
|
|
195
195
|
justify-content: center;
|
|
196
196
|
align-items: center;
|
|
197
197
|
overflow: hidden;
|
|
198
198
|
padding-right: 5px;
|
|
199
|
-
|
|
200
|
-
${StyledPanelTitleLabel} {
|
|
201
|
-
font-weight: 600;
|
|
202
|
-
}
|
|
203
199
|
`;
|
|
204
200
|
|
|
205
201
|
export const ReqorePanel = forwardRef(
|
|
@@ -222,6 +218,8 @@ export const ReqorePanel = forwardRef(
|
|
|
222
218
|
onCollapseChange,
|
|
223
219
|
padded = true,
|
|
224
220
|
contentStyle,
|
|
221
|
+
contentEffect,
|
|
222
|
+
headerEffect = {},
|
|
225
223
|
headerSize = 4,
|
|
226
224
|
contentSize = 'normal',
|
|
227
225
|
minimal,
|
|
@@ -271,9 +269,7 @@ export const ReqorePanel = forwardRef(
|
|
|
271
269
|
(actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
|
|
272
270
|
if (Array.isArray(actionOrActions)) {
|
|
273
271
|
return (
|
|
274
|
-
<ReqoreControlGroup stack
|
|
275
|
-
{actionOrActions.map(renderActions)}
|
|
276
|
-
</ReqoreControlGroup>
|
|
272
|
+
<ReqoreControlGroup stack>{actionOrActions.map(renderActions)}</ReqoreControlGroup>
|
|
277
273
|
);
|
|
278
274
|
}
|
|
279
275
|
|
|
@@ -330,10 +326,6 @@ export const ReqorePanel = forwardRef(
|
|
|
330
326
|
[actions, theme]
|
|
331
327
|
);
|
|
332
328
|
|
|
333
|
-
const HTMLheaderElement = useMemo(() => {
|
|
334
|
-
return `h${headerSize}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
335
|
-
}, [headerSize]);
|
|
336
|
-
|
|
337
329
|
const interactive: boolean = !!(
|
|
338
330
|
rest.onClick ||
|
|
339
331
|
rest.onMouseOver ||
|
|
@@ -353,6 +345,7 @@ export const ReqorePanel = forwardRef(
|
|
|
353
345
|
className={`${className || ''} reqore-panel`}
|
|
354
346
|
interactive={interactive}
|
|
355
347
|
theme={theme}
|
|
348
|
+
effect={contentEffect}
|
|
356
349
|
>
|
|
357
350
|
{hasTitleBar && (
|
|
358
351
|
<StyledPanelTitle
|
|
@@ -362,6 +355,7 @@ export const ReqorePanel = forwardRef(
|
|
|
362
355
|
className='reqore-panel-title'
|
|
363
356
|
onClick={handleCollapseClick}
|
|
364
357
|
theme={theme}
|
|
358
|
+
contentSize={contentSize}
|
|
365
359
|
opacity={rest.opacity ?? (minimal ? 0 : 1)}
|
|
366
360
|
noHorizontalPadding={rest.opacity === 0}
|
|
367
361
|
>
|
|
@@ -374,12 +368,20 @@ export const ReqorePanel = forwardRef(
|
|
|
374
368
|
/>
|
|
375
369
|
)}
|
|
376
370
|
{typeof label === 'string' ? (
|
|
377
|
-
<
|
|
371
|
+
<ReqoreHeading
|
|
372
|
+
size={headerSize}
|
|
373
|
+
effect={{
|
|
374
|
+
noWrap: true,
|
|
375
|
+
...headerEffect,
|
|
376
|
+
}}
|
|
377
|
+
>
|
|
378
|
+
{label}
|
|
379
|
+
</ReqoreHeading>
|
|
378
380
|
) : (
|
|
379
381
|
label
|
|
380
382
|
)}
|
|
381
383
|
</StyledPanelTitleHeader>
|
|
382
|
-
<ReqoreControlGroup
|
|
384
|
+
<ReqoreControlGroup>
|
|
383
385
|
{actions.map(renderActions)}
|
|
384
386
|
{collapsible && (
|
|
385
387
|
<ReqoreButton
|
|
@@ -404,6 +406,7 @@ export const ReqorePanel = forwardRef(
|
|
|
404
406
|
)}
|
|
405
407
|
{!_isCollapsed || (_isCollapsed && !unMountContentOnCollapse) ? (
|
|
406
408
|
<StyledPanelContent
|
|
409
|
+
as={'div'}
|
|
407
410
|
className='reqore-panel-content'
|
|
408
411
|
hasLabel={!!label}
|
|
409
412
|
isCollapsed={_isCollapsed}
|
|
@@ -424,8 +427,8 @@ export const ReqorePanel = forwardRef(
|
|
|
424
427
|
opacity={rest.opacity ?? (minimal ? 0 : 1)}
|
|
425
428
|
noHorizontalPadding={rest.opacity === 0}
|
|
426
429
|
>
|
|
427
|
-
<ReqoreControlGroup
|
|
428
|
-
<ReqoreControlGroup
|
|
430
|
+
<ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
431
|
+
<ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
429
432
|
</StyledPanelBottomActions>
|
|
430
433
|
) : null}
|
|
431
434
|
</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) {
|