@qoretechnologies/reqore 0.28.5 → 0.28.6
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/dist/components/Button/index.js +3 -3
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts +3 -2
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +28 -24
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +2 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +8 -8
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +1 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +12 -2
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +35 -4
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +28 -34
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts +2 -0
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +40 -7
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Message/index.d.ts +3 -2
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +3 -3
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +11 -8
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +6 -6
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/RadioGroup/index.d.ts +8 -6
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.js +6 -12
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/Tag/group.d.ts +2 -1
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +7 -3
- package/dist/components/Tag/group.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/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +1 -2
- package/dist/helpers/colors.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +6 -2
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +3 -3
- package/src/components/Checkbox/index.tsx +58 -30
- package/src/components/ControlGroup/index.tsx +10 -4
- package/src/components/Dropdown/index.tsx +2 -2
- package/src/components/Icon/index.tsx +75 -1
- package/src/components/InternalPopover/index.tsx +105 -47
- package/src/components/Menu/divider.tsx +20 -3
- package/src/components/Message/index.tsx +3 -0
- package/src/components/Notifications/notification.tsx +23 -13
- package/src/components/Panel/index.tsx +14 -10
- package/src/components/RadioGroup/index.tsx +36 -27
- package/src/components/Tag/group.tsx +5 -2
- package/src/constants/sizes.ts +8 -0
- package/src/helpers/colors.ts +2 -4
- package/src/hooks/usePopover.tsx +15 -2
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +7 -1
- package/src/stories/Icon/Icon.stories.tsx +99 -22
- package/src/stories/Message/Message.stories.tsx +7 -1
- package/src/stories/Panel/Panel.stories.tsx +3 -3
- package/src/stories/Popover/Popover.stories.tsx +91 -12
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +29 -2
- package/src/stories/Tag/Tag.stories.tsx +4 -2
- package/src/stories/utils/args.ts +13 -0
- package/tests.json +1 -1
|
@@ -47,7 +47,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
47
47
|
maxHeight,
|
|
48
48
|
maxWidth,
|
|
49
49
|
noArrow = true,
|
|
50
|
-
|
|
50
|
+
transparent,
|
|
51
51
|
openOnMount,
|
|
52
52
|
show,
|
|
53
53
|
targetElement,
|
|
@@ -90,7 +90,7 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
90
90
|
maxHeight={maxHeight}
|
|
91
91
|
maxWidth={maxWidth}
|
|
92
92
|
noArrow={noArrow}
|
|
93
|
-
|
|
93
|
+
transparent={transparent}
|
|
94
94
|
useTargetWidth={useTargetWidth}
|
|
95
95
|
component={component || ReqoreButton}
|
|
96
96
|
componentProps={componentProps}
|
|
@@ -10,12 +10,22 @@ import { isStringSize } from '../../helpers/utils';
|
|
|
10
10
|
import { IReqoreIconName } from '../../types/icons';
|
|
11
11
|
|
|
12
12
|
export interface IReqoreIconProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
13
|
-
icon
|
|
13
|
+
icon?: IReqoreIconName;
|
|
14
14
|
color?: string;
|
|
15
15
|
size?: TSizes | string;
|
|
16
16
|
iconProps?: IconBaseProps;
|
|
17
17
|
intent?: TReqoreIntent;
|
|
18
18
|
margin?: 'right' | 'left' | 'both';
|
|
19
|
+
image?: string;
|
|
20
|
+
rounded?: boolean;
|
|
21
|
+
grayscale?: boolean;
|
|
22
|
+
blur?: number;
|
|
23
|
+
sepia?: boolean;
|
|
24
|
+
invert?: boolean;
|
|
25
|
+
opacity?: number;
|
|
26
|
+
brightness?: number;
|
|
27
|
+
contrast?: number;
|
|
28
|
+
saturate?: number;
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
export const StyledIconWrapper = styled.span<{ margin: 'right' | 'left' | 'both' }>`
|
|
@@ -23,6 +33,51 @@ export const StyledIconWrapper = styled.span<{ margin: 'right' | 'left' | 'both'
|
|
|
23
33
|
flex: 0 0 auto;
|
|
24
34
|
vertical-align: text-bottom;
|
|
25
35
|
transition: all 0.2s ease-out;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
|
|
38
|
+
border-radius: ${({ rounded }) => (rounded ? '50%' : undefined)};
|
|
39
|
+
|
|
40
|
+
${({ grayscale }) =>
|
|
41
|
+
grayscale &&
|
|
42
|
+
css`
|
|
43
|
+
filter: grayscale(100%);
|
|
44
|
+
`};
|
|
45
|
+
${({ blur }) =>
|
|
46
|
+
blur &&
|
|
47
|
+
css`
|
|
48
|
+
filter: blur(${blur}px);
|
|
49
|
+
`};
|
|
50
|
+
${({ sepia }) =>
|
|
51
|
+
sepia &&
|
|
52
|
+
css`
|
|
53
|
+
filter: sepia(100%);
|
|
54
|
+
`};
|
|
55
|
+
${({ invert }) =>
|
|
56
|
+
invert &&
|
|
57
|
+
css`
|
|
58
|
+
filter: invert(100%);
|
|
59
|
+
`};
|
|
60
|
+
${({ opacity }) =>
|
|
61
|
+
opacity || opacity === 0
|
|
62
|
+
? css`
|
|
63
|
+
opacity: ${opacity};
|
|
64
|
+
`
|
|
65
|
+
: undefined};
|
|
66
|
+
${({ brightness }) =>
|
|
67
|
+
brightness &&
|
|
68
|
+
css`
|
|
69
|
+
filter: brightness(${brightness}%);
|
|
70
|
+
`};
|
|
71
|
+
${({ contrast }) =>
|
|
72
|
+
contrast &&
|
|
73
|
+
css`
|
|
74
|
+
filter: contrast(${contrast}%);
|
|
75
|
+
`};
|
|
76
|
+
${({ saturate }) =>
|
|
77
|
+
saturate &&
|
|
78
|
+
css`
|
|
79
|
+
filter: saturate(${saturate}%);
|
|
80
|
+
`};
|
|
26
81
|
|
|
27
82
|
${({ margin, size }) =>
|
|
28
83
|
margin &&
|
|
@@ -38,6 +93,10 @@ export const StyledIconWrapper = styled.span<{ margin: 'right' | 'left' | 'both'
|
|
|
38
93
|
: '10px'
|
|
39
94
|
: undefined};
|
|
40
95
|
`}
|
|
96
|
+
|
|
97
|
+
img {
|
|
98
|
+
width: 100%;
|
|
99
|
+
}
|
|
41
100
|
`;
|
|
42
101
|
|
|
43
102
|
const ReqoreIcon = memo(
|
|
@@ -50,6 +109,7 @@ const ReqoreIcon = memo(
|
|
|
50
109
|
style = {},
|
|
51
110
|
iconProps,
|
|
52
111
|
intent,
|
|
112
|
+
image,
|
|
53
113
|
...rest
|
|
54
114
|
}: IReqoreIconProps) => {
|
|
55
115
|
const theme = useContext(ReqoreThemeContext);
|
|
@@ -57,6 +117,20 @@ const ReqoreIcon = memo(
|
|
|
57
117
|
const finalColor: string | undefined = intent ? theme.intents[intent] : color;
|
|
58
118
|
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
59
119
|
|
|
120
|
+
if (image) {
|
|
121
|
+
return (
|
|
122
|
+
<StyledIconWrapper
|
|
123
|
+
{...rest}
|
|
124
|
+
size={size}
|
|
125
|
+
margin={margin}
|
|
126
|
+
className={`${className || ''} reqore-icon`}
|
|
127
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
128
|
+
>
|
|
129
|
+
<img src={image} alt='' />
|
|
130
|
+
</StyledIconWrapper>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
60
134
|
if (!Icon) {
|
|
61
135
|
return (
|
|
62
136
|
<StyledIconWrapper
|
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
import { isString } from 'lodash';
|
|
2
|
+
import { rgba } from 'polished';
|
|
2
3
|
import React, { MutableRefObject, useContext, useEffect, useRef, useState } from 'react';
|
|
3
4
|
import { usePopper } from 'react-popper';
|
|
4
5
|
import styled, { css } from 'styled-components';
|
|
6
|
+
import { RADIUS_FROM_SIZE } from '../../constants/sizes';
|
|
5
7
|
import { IReqoreTheme } from '../../constants/theme';
|
|
6
8
|
import { IPopoverData } from '../../containers/PopoverProvider';
|
|
7
9
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
8
10
|
import PopoverContext from '../../context/PopoverContext';
|
|
9
11
|
import { fadeIn } from '../../helpers/animations';
|
|
10
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
changeLightness,
|
|
14
|
+
getColorFromMaybeString,
|
|
15
|
+
getNotificationIntent,
|
|
16
|
+
} from '../../helpers/colors';
|
|
11
17
|
import { StyledBackdrop } from '../Drawer';
|
|
12
|
-
import
|
|
18
|
+
import ReqoreMessage from '../Message';
|
|
19
|
+
|
|
20
|
+
const getPopoverArrowColor = ({ theme, dim, intent, flat, effect, isOpaque }) =>
|
|
21
|
+
rgba(
|
|
22
|
+
effect
|
|
23
|
+
? changeLightness(
|
|
24
|
+
getColorFromMaybeString(
|
|
25
|
+
theme,
|
|
26
|
+
effect.gradient.borderColor || Object.values(effect.gradient.colors)[0]
|
|
27
|
+
),
|
|
28
|
+
0.04
|
|
29
|
+
)
|
|
30
|
+
: intent
|
|
31
|
+
? changeLightness(getNotificationIntent(theme, intent), flat ? 0.1 : 0.2)
|
|
32
|
+
: theme.popover?.main ||
|
|
33
|
+
rgba(
|
|
34
|
+
changeLightness(
|
|
35
|
+
flat ? theme.main : getNotificationIntent(theme, intent),
|
|
36
|
+
flat ? 0.1 : 0.2
|
|
37
|
+
),
|
|
38
|
+
isOpaque ? 1 : 0.3
|
|
39
|
+
),
|
|
40
|
+
dim ? 0.3 : 1
|
|
41
|
+
);
|
|
13
42
|
|
|
14
43
|
const StyledPopoverArrow = styled.div<{ theme: IReqoreTheme }>`
|
|
15
44
|
width: 10px;
|
|
@@ -20,15 +49,10 @@ const StyledPopoverArrow = styled.div<{ theme: IReqoreTheme }>`
|
|
|
20
49
|
&:before {
|
|
21
50
|
content: '';
|
|
22
51
|
display: block;
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
52
|
+
width: 0;
|
|
53
|
+
height: 0;
|
|
25
54
|
position: absolute;
|
|
26
55
|
z-index: -1;
|
|
27
|
-
transform: rotate(45deg);
|
|
28
|
-
${({ theme, opaque }) => css`
|
|
29
|
-
background-color: ${theme.popover?.main || theme.main};
|
|
30
|
-
box-shadow: ${opaque ? undefined : 'rgba(31, 26, 34, 0.6) 0px 0px 4px'};
|
|
31
|
-
`}
|
|
32
56
|
}
|
|
33
57
|
`;
|
|
34
58
|
|
|
@@ -36,40 +60,65 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
36
60
|
animation: 0.2s ${fadeIn} ease-out;
|
|
37
61
|
max-width: ${({ maxWidth = '80vw' }) => maxWidth};
|
|
38
62
|
max-height: ${({ maxHeight = '80vh' }) => maxHeight};
|
|
63
|
+
z-index: 999999;
|
|
64
|
+
border-radius: ${RADIUS_FROM_SIZE.normal}px;
|
|
39
65
|
|
|
40
|
-
${({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
z-index: 999999;
|
|
46
|
-
background-color: transparent;
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return css`
|
|
51
|
-
z-index: 999999;
|
|
52
|
-
background-color: ${defaultColor};
|
|
53
|
-
color: ${getReadableColor(theme, undefined, undefined, false, defaultColor)};
|
|
54
|
-
border-radius: 5.5px;
|
|
55
|
-
box-shadow: rgba(31, 26, 34, 0.6) 0px 0px 4px;
|
|
56
|
-
`;
|
|
57
|
-
}}
|
|
66
|
+
${({ transparent }) =>
|
|
67
|
+
!transparent &&
|
|
68
|
+
css`
|
|
69
|
+
box-shadow: rgba(31, 26, 34, 0.7) 0px 0px 10px;
|
|
70
|
+
`}
|
|
58
71
|
|
|
59
72
|
&[data-popper-placement^='top'] > ${StyledPopoverArrow} {
|
|
60
73
|
bottom: -5px;
|
|
74
|
+
|
|
75
|
+
&:before {
|
|
76
|
+
border-left: 10px solid transparent;
|
|
77
|
+
border-right: 10px solid transparent;
|
|
78
|
+
border-top: 10px solid ${(props) => getPopoverArrowColor(props)};
|
|
79
|
+
|
|
80
|
+
top: 5px;
|
|
81
|
+
left: -5px;
|
|
82
|
+
}
|
|
61
83
|
}
|
|
62
84
|
|
|
63
85
|
&[data-popper-placement^='bottom'] > ${StyledPopoverArrow} {
|
|
64
86
|
top: -5px;
|
|
87
|
+
|
|
88
|
+
&:before {
|
|
89
|
+
border-left: 10px solid transparent;
|
|
90
|
+
border-right: 10px solid transparent;
|
|
91
|
+
border-bottom: 10px solid ${(props) => getPopoverArrowColor(props)};
|
|
92
|
+
|
|
93
|
+
top: -5px;
|
|
94
|
+
left: -5px;
|
|
95
|
+
}
|
|
65
96
|
}
|
|
66
97
|
|
|
67
98
|
&[data-popper-placement^='left'] > ${StyledPopoverArrow} {
|
|
68
99
|
right: -5px;
|
|
100
|
+
|
|
101
|
+
&:before {
|
|
102
|
+
border-top: 10px solid transparent;
|
|
103
|
+
border-bottom: 10px solid transparent;
|
|
104
|
+
border-left: 10px solid ${(props) => getPopoverArrowColor(props)};
|
|
105
|
+
|
|
106
|
+
top: -5px;
|
|
107
|
+
left: 5px;
|
|
108
|
+
}
|
|
69
109
|
}
|
|
70
110
|
|
|
71
111
|
&[data-popper-placement^='right'] > ${StyledPopoverArrow} {
|
|
72
112
|
left: -5px;
|
|
113
|
+
|
|
114
|
+
&:before {
|
|
115
|
+
border-top: 10px solid transparent;
|
|
116
|
+
border-bottom: 10px solid transparent;
|
|
117
|
+
border-right: 10px solid ${(props) => getPopoverArrowColor(props)};
|
|
118
|
+
|
|
119
|
+
top: -5px;
|
|
120
|
+
left: -5px;
|
|
121
|
+
}
|
|
73
122
|
}
|
|
74
123
|
|
|
75
124
|
&[data-popper-reference-hidden='true'] {
|
|
@@ -81,17 +130,9 @@ const StyledPopoverWrapper = styled.div<{ theme: IReqoreTheme }>`
|
|
|
81
130
|
const StyledPopoverContent = styled.div<{ isString?: boolean }>`
|
|
82
131
|
width: 100%;
|
|
83
132
|
height: 100%;
|
|
84
|
-
padding: ${({ isString }) => (isString ? '8px' : '0px')};
|
|
85
133
|
z-index: 20;
|
|
86
134
|
position: relative;
|
|
87
135
|
overflow: hidden;
|
|
88
|
-
background-color: ${({ theme, opaque }) =>
|
|
89
|
-
opaque ? 'transparent' : theme.popover?.main || theme.main};
|
|
90
|
-
border-radius: ${({ opaque }) => (opaque ? undefined : '3.5px')};
|
|
91
|
-
|
|
92
|
-
.reqore-popover-text {
|
|
93
|
-
font-size: 14px;
|
|
94
|
-
}
|
|
95
136
|
`;
|
|
96
137
|
|
|
97
138
|
export interface IReqoreInternalPopoverProps extends IPopoverData {}
|
|
@@ -103,10 +144,16 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
103
144
|
placement,
|
|
104
145
|
noArrow,
|
|
105
146
|
useTargetWidth,
|
|
106
|
-
|
|
147
|
+
transparent,
|
|
107
148
|
maxWidth,
|
|
108
149
|
maxHeight,
|
|
109
150
|
blur,
|
|
151
|
+
intent,
|
|
152
|
+
title,
|
|
153
|
+
icon,
|
|
154
|
+
minimal,
|
|
155
|
+
flat = true,
|
|
156
|
+
effect,
|
|
110
157
|
}) => {
|
|
111
158
|
const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
|
|
112
159
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -165,7 +212,12 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
165
212
|
<StyledPopoverWrapper
|
|
166
213
|
maxWidth={maxWidth}
|
|
167
214
|
maxHeight={maxHeight}
|
|
168
|
-
|
|
215
|
+
transparent={transparent}
|
|
216
|
+
effect={effect}
|
|
217
|
+
isOpaque={!transparent && !minimal}
|
|
218
|
+
intent={intent}
|
|
219
|
+
flat={flat}
|
|
220
|
+
dim={flat && !transparent && !effect && minimal}
|
|
169
221
|
className='reqore-popover-content'
|
|
170
222
|
ref={(el) => {
|
|
171
223
|
setPopperElement(el);
|
|
@@ -178,17 +230,23 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
178
230
|
}}
|
|
179
231
|
{...attributes.popper}
|
|
180
232
|
>
|
|
181
|
-
{!noArrow && (
|
|
182
|
-
<StyledPopoverArrow
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
style={styles.arrow}
|
|
186
|
-
data-popper-arrow
|
|
187
|
-
/>
|
|
188
|
-
)}
|
|
189
|
-
<StyledPopoverContent isString={isString(content)} opaque={opaque}>
|
|
233
|
+
{!noArrow && !transparent ? (
|
|
234
|
+
<StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
|
|
235
|
+
) : null}
|
|
236
|
+
<StyledPopoverContent isString={isString(content)}>
|
|
190
237
|
{isString(content) ? (
|
|
191
|
-
<
|
|
238
|
+
<ReqoreMessage
|
|
239
|
+
opaque={!transparent && !minimal}
|
|
240
|
+
className='reqore-popover-text'
|
|
241
|
+
intent={intent}
|
|
242
|
+
title={title}
|
|
243
|
+
icon={icon}
|
|
244
|
+
minimal={transparent}
|
|
245
|
+
flat={flat || transparent}
|
|
246
|
+
effect={effect}
|
|
247
|
+
>
|
|
248
|
+
{content}
|
|
249
|
+
</ReqoreMessage>
|
|
192
250
|
) : (
|
|
193
251
|
<>
|
|
194
252
|
{React.Children.map(content, (child) =>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
3
|
import { PADDING_FROM_SIZE } from '../../constants/sizes';
|
|
4
4
|
import { getReadableColor } from '../../helpers/colors';
|
|
5
|
+
import { getOneLessSize, isStringSize } from '../../helpers/utils';
|
|
5
6
|
import { IWithReqoreEffect, IWithReqoreSize } from '../../types/global';
|
|
6
7
|
import { IReqoreEffect, StyledTextEffect } from '../Effect';
|
|
7
8
|
|
|
@@ -10,13 +11,29 @@ export interface IReqoreMenuDividerProps
|
|
|
10
11
|
IWithReqoreEffect,
|
|
11
12
|
IWithReqoreSize {
|
|
12
13
|
label?: string;
|
|
14
|
+
margin?: 'left' | 'right' | 'both';
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
const StyledMenuDivider = styled(StyledTextEffect)`
|
|
17
|
+
export const StyledMenuDivider = styled(StyledTextEffect)`
|
|
16
18
|
width: 100%;
|
|
17
19
|
padding: ${({ size }) => `${PADDING_FROM_SIZE[size]}px 0`};
|
|
18
20
|
background-color: transparent;
|
|
19
21
|
|
|
22
|
+
${({ margin, size }) =>
|
|
23
|
+
margin &&
|
|
24
|
+
css`
|
|
25
|
+
margin-left: ${margin === 'left' || margin === 'both'
|
|
26
|
+
? isStringSize(size)
|
|
27
|
+
? `${PADDING_FROM_SIZE[size]}px`
|
|
28
|
+
: '10px'
|
|
29
|
+
: undefined};
|
|
30
|
+
margin-right: ${margin === 'right' || margin === 'both'
|
|
31
|
+
? isStringSize(size)
|
|
32
|
+
? `${PADDING_FROM_SIZE[size]}px`
|
|
33
|
+
: '10px'
|
|
34
|
+
: undefined};
|
|
35
|
+
`}
|
|
36
|
+
|
|
20
37
|
color: ${({ theme }) => getReadableColor(theme, undefined, undefined)};
|
|
21
38
|
`;
|
|
22
39
|
|
|
@@ -33,7 +50,7 @@ const ReqoreMenuDivider = forwardRef<HTMLDivElement, IReqoreMenuDividerProps>(
|
|
|
33
50
|
uppercase: true,
|
|
34
51
|
spaced: 2,
|
|
35
52
|
textAlign: 'center',
|
|
36
|
-
textSize:
|
|
53
|
+
textSize: getOneLessSize(size),
|
|
37
54
|
weight: 'bold',
|
|
38
55
|
...effect,
|
|
39
56
|
} as IReqoreEffect
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
IWithReqoreCustomTheme,
|
|
11
11
|
IWithReqoreEffect,
|
|
12
12
|
IWithReqoreMinimal,
|
|
13
|
+
IWithReqoreOpaque,
|
|
13
14
|
IWithReqoreSize,
|
|
14
15
|
} from '../../types/global';
|
|
15
16
|
import { IReqoreIconName } from '../../types/icons';
|
|
@@ -29,6 +30,7 @@ export interface IReqoreMessageProps
|
|
|
29
30
|
IWithReqoreSize,
|
|
30
31
|
IReqoreIntent,
|
|
31
32
|
IWithReqoreMinimal,
|
|
33
|
+
IWithReqoreOpaque,
|
|
32
34
|
React.HTMLAttributes<HTMLDivElement> {
|
|
33
35
|
title?: string;
|
|
34
36
|
children: any;
|
|
@@ -38,6 +40,7 @@ export interface IReqoreMessageProps
|
|
|
38
40
|
duration?: number;
|
|
39
41
|
onFinish?: () => any;
|
|
40
42
|
flat?: boolean;
|
|
43
|
+
hasShadow?: boolean;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
export interface IReqoreNotificationStyle extends IReqoreMessageProps {
|
|
@@ -15,7 +15,7 @@ import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
|
15
15
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
16
16
|
import { fadeIn } from '../../helpers/animations';
|
|
17
17
|
import { changeLightness, getNotificationIntent, getReadableColor } from '../../helpers/colors';
|
|
18
|
-
import { IWithReqoreEffect, IWithReqoreMinimal } from '../../types/global';
|
|
18
|
+
import { IWithReqoreEffect, IWithReqoreMinimal, IWithReqoreOpaque } from '../../types/global';
|
|
19
19
|
import { IReqoreIconName } from '../../types/icons';
|
|
20
20
|
import { StyledEffect } from '../Effect';
|
|
21
21
|
import { ReqoreHeading } from '../Header';
|
|
@@ -23,7 +23,10 @@ import ReqoreIcon from '../Icon';
|
|
|
23
23
|
|
|
24
24
|
export type IReqoreNotificationType = TReqoreIntent;
|
|
25
25
|
|
|
26
|
-
export interface IReqoreNotificationProps
|
|
26
|
+
export interface IReqoreNotificationProps
|
|
27
|
+
extends IWithReqoreEffect,
|
|
28
|
+
IWithReqoreMinimal,
|
|
29
|
+
IWithReqoreOpaque {
|
|
27
30
|
type?: IReqoreNotificationType;
|
|
28
31
|
intent?: TReqoreIntent;
|
|
29
32
|
title?: string;
|
|
@@ -38,7 +41,7 @@ export interface IReqoreNotificationProps extends IWithReqoreEffect, IWithReqore
|
|
|
38
41
|
size?: TSizes;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
export interface IReqoreNotificationStyle {
|
|
44
|
+
export interface IReqoreNotificationStyle extends IWithReqoreOpaque {
|
|
42
45
|
theme: IReqoreTheme;
|
|
43
46
|
type?: IReqoreNotificationType;
|
|
44
47
|
clickable?: boolean;
|
|
@@ -73,12 +76,14 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
73
76
|
transition: all 0.2s ease-out;
|
|
74
77
|
|
|
75
78
|
// Do not fade in the component if it's a message
|
|
76
|
-
${({ asMessage }) =>
|
|
77
|
-
asMessage
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
${({ asMessage }) => {
|
|
80
|
+
if (asMessage) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return css`
|
|
84
|
+
animation: 0.2s ${fadeIn} ease-in;
|
|
85
|
+
`;
|
|
86
|
+
}}
|
|
82
87
|
|
|
83
88
|
&:not(:first-child) {
|
|
84
89
|
margin-top: ${({ asMessage }) => (asMessage ? undefined : `10px`)};
|
|
@@ -93,12 +98,15 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
93
98
|
hasShadow,
|
|
94
99
|
flat,
|
|
95
100
|
minimal,
|
|
101
|
+
opaque,
|
|
96
102
|
}: IReqoreNotificationStyle) => css`
|
|
97
103
|
background-color: ${minimal
|
|
98
104
|
? 'transparent'
|
|
105
|
+
: opaque
|
|
106
|
+
? changeLightness(theme.main, 0.1)
|
|
99
107
|
: rgba(getNotificationIntent(theme, intent || type), 0.3)};
|
|
100
108
|
border: ${flat ? 0 : '1px solid'};
|
|
101
|
-
border-color: ${getNotificationIntent(theme, intent || type)};
|
|
109
|
+
border-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.2)};
|
|
102
110
|
|
|
103
111
|
${hasShadow &&
|
|
104
112
|
css`
|
|
@@ -113,13 +121,13 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
113
121
|
display: block;
|
|
114
122
|
top: 0;
|
|
115
123
|
height: 3px;
|
|
116
|
-
background-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.
|
|
124
|
+
background-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.2)};
|
|
117
125
|
animation-name: ${timeoutAnimation};
|
|
118
126
|
animation-duration: ${timeout}ms;
|
|
119
127
|
}
|
|
120
128
|
`}
|
|
121
129
|
|
|
122
|
-
color: ${getReadableColor(theme, null, null, true, theme.originalMain)};
|
|
130
|
+
color: ${getReadableColor(theme, null, null, true, !opaque ? theme.originalMain : undefined)};
|
|
123
131
|
|
|
124
132
|
${clickable &&
|
|
125
133
|
css`
|
|
@@ -129,7 +137,7 @@ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotification
|
|
|
129
137
|
getNotificationIntent(theme, intent || type),
|
|
130
138
|
minimal ? 0.2 : 0.5
|
|
131
139
|
)};
|
|
132
|
-
border-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.
|
|
140
|
+
border-color: ${changeLightness(getNotificationIntent(theme, intent || type), 0.25)};
|
|
133
141
|
}
|
|
134
142
|
`}
|
|
135
143
|
`}
|
|
@@ -218,6 +226,7 @@ const ReqoreNotification = forwardRef<HTMLDivElement, IReqoreNotificationProps>(
|
|
|
218
226
|
onFinish,
|
|
219
227
|
flat,
|
|
220
228
|
minimal,
|
|
229
|
+
opaque,
|
|
221
230
|
size = 'normal',
|
|
222
231
|
},
|
|
223
232
|
ref: any
|
|
@@ -273,6 +282,7 @@ const ReqoreNotification = forwardRef<HTMLDivElement, IReqoreNotificationProps>(
|
|
|
273
282
|
ref={ref}
|
|
274
283
|
style={styles}
|
|
275
284
|
size={size}
|
|
285
|
+
opaque={opaque}
|
|
276
286
|
>
|
|
277
287
|
{type || intent || icon ? (
|
|
278
288
|
<StyledIconWrapper type={type || intent} size={size}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { size } from 'lodash';
|
|
2
2
|
import { darken, rgba } from 'polished';
|
|
3
|
-
import {
|
|
3
|
+
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 {
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
PADDING_FROM_SIZE,
|
|
9
9
|
RADIUS_FROM_SIZE,
|
|
10
10
|
TEXT_FROM_SIZE,
|
|
11
|
-
TSizes
|
|
11
|
+
TSizes
|
|
12
12
|
} from '../../constants/sizes';
|
|
13
13
|
import { IReqoreTheme } from '../../constants/theme';
|
|
14
14
|
import {
|
|
15
15
|
changeDarkness,
|
|
16
16
|
changeLightness,
|
|
17
17
|
getMainBackgroundColor,
|
|
18
|
-
getReadableColor
|
|
18
|
+
getReadableColor
|
|
19
19
|
} from '../../helpers/colors';
|
|
20
20
|
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
21
21
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
IWithReqoreCustomTheme,
|
|
27
27
|
IWithReqoreFlat,
|
|
28
28
|
IWithReqoreSize,
|
|
29
|
-
IWithReqoreTooltip
|
|
29
|
+
IWithReqoreTooltip
|
|
30
30
|
} from '../../types/global';
|
|
31
31
|
import { IReqoreIconName } from '../../types/icons';
|
|
32
32
|
import ReqoreButton, { ButtonBadge, IReqoreButtonProps, TReqoreBadge } from '../Button';
|
|
@@ -86,6 +86,7 @@ export interface IReqorePanelProps
|
|
|
86
86
|
contentSize?: TSizes;
|
|
87
87
|
contentEffect?: IReqoreEffect;
|
|
88
88
|
headerEffect?: IReqoreEffect;
|
|
89
|
+
transparent?: boolean;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
export interface IStyledPanel extends IReqorePanelProps {
|
|
@@ -133,7 +134,7 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
|
|
|
133
134
|
: `${rgba(
|
|
134
135
|
changeLightness(
|
|
135
136
|
intent ? theme.intents[intent] : getMainBackgroundColor(theme),
|
|
136
|
-
0.
|
|
137
|
+
0.25
|
|
137
138
|
),
|
|
138
139
|
opacity
|
|
139
140
|
)}`};
|
|
@@ -417,6 +418,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
417
418
|
return newContentEffect;
|
|
418
419
|
}, [intent, theme, contentEffect, interactive]);
|
|
419
420
|
|
|
421
|
+
const opacity = rest.transparent ? 0 : rest.opacity;
|
|
422
|
+
|
|
420
423
|
return (
|
|
421
424
|
<StyledPanel
|
|
422
425
|
{...rest}
|
|
@@ -430,6 +433,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
430
433
|
interactive={interactive}
|
|
431
434
|
theme={theme}
|
|
432
435
|
effect={transformedContentEffect}
|
|
436
|
+
opacity={opacity}
|
|
433
437
|
>
|
|
434
438
|
{hasTitleBar && (
|
|
435
439
|
<StyledPanelTitle
|
|
@@ -440,8 +444,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
440
444
|
onClick={handleCollapseClick}
|
|
441
445
|
theme={theme}
|
|
442
446
|
contentSize={contentSize}
|
|
443
|
-
opacity={
|
|
444
|
-
noHorizontalPadding={
|
|
447
|
+
opacity={opacity ?? (minimal ? 0 : 1)}
|
|
448
|
+
noHorizontalPadding={opacity === 0}
|
|
445
449
|
>
|
|
446
450
|
<StyledPanelTitleHeader>
|
|
447
451
|
{icon && (
|
|
@@ -509,7 +513,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
509
513
|
padded={padded}
|
|
510
514
|
minimal={minimal}
|
|
511
515
|
contentSize={contentSize}
|
|
512
|
-
noHorizontalPadding={
|
|
516
|
+
noHorizontalPadding={opacity === 0}
|
|
513
517
|
>
|
|
514
518
|
{children}
|
|
515
519
|
</StyledPanelContent>
|
|
@@ -519,8 +523,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
519
523
|
flat={flat}
|
|
520
524
|
className='reqore-panel-bottom-actions'
|
|
521
525
|
theme={theme}
|
|
522
|
-
opacity={
|
|
523
|
-
noHorizontalPadding={
|
|
526
|
+
opacity={opacity ?? (minimal ? 0 : 1)}
|
|
527
|
+
noHorizontalPadding={opacity === 0}
|
|
524
528
|
>
|
|
525
529
|
<ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
|
|
526
530
|
<ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
|