@qoretechnologies/reqore 0.28.5 → 0.29.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/.vscode/settings.json +2 -1
- package/__tests__/multiselect.test.tsx +361 -0
- package/__tests__/popover.test.tsx +35 -8
- 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/Collection/item.js +2 -2
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +4 -4
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +13 -15
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +2 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +3 -3
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +6 -3
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +19 -1
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Effect/index.d.ts +3 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +24 -19
- package/dist/components/Effect/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/Input/index.js +3 -3
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InputClearButton/index.d.ts.map +1 -1
- package/dist/components/InputClearButton/index.js +1 -1
- package/dist/components/InputClearButton/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +31 -37
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts +5 -2
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +41 -8
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.js +4 -3
- package/dist/components/Menu/index.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/MultiSelect/index.d.ts +32 -0
- package/dist/components/MultiSelect/index.d.ts.map +1 -0
- package/dist/components/MultiSelect/index.js +177 -0
- package/dist/components/MultiSelect/index.js.map +1 -0
- 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 +7 -7
- 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 +5 -2
- package/dist/components/Popover/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/Table/row.js +2 -2
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/item.js +1 -1
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +5 -4
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +4 -3
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +12 -5
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.js +5 -5
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tree/index.js +1 -1
- 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/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +28 -3
- package/dist/containers/PopoverProvider.js.map +1 -1
- 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 +1 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/PopoverContext.d.ts +1 -0
- package/dist/context/PopoverContext.d.ts.map +1 -1
- package/dist/context/PopoverContext.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +1 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js +2 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +3 -0
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +28 -5
- package/dist/helpers/colors.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +14 -3
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +12 -7
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/hooks/useReqore.d.ts +3 -0
- package/dist/hooks/useReqore.d.ts.map +1 -0
- package/dist/hooks/useReqore.js +17 -0
- package/dist/hooks/useReqore.js.map +1 -0
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useTheme.js +3 -0
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.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/Collection/item.tsx +2 -2
- package/src/components/ControlGroup/index.tsx +54 -37
- package/src/components/Dropdown/index.tsx +7 -2
- package/src/components/Dropdown/list.tsx +29 -15
- package/src/components/Effect/index.tsx +58 -51
- package/src/components/Icon/index.tsx +75 -1
- package/src/components/Input/index.tsx +3 -3
- package/src/components/InputClearButton/index.tsx +1 -0
- package/src/components/InternalPopover/index.tsx +108 -50
- package/src/components/Menu/divider.tsx +35 -7
- package/src/components/Menu/index.tsx +3 -3
- package/src/components/Message/index.tsx +3 -0
- package/src/components/MultiSelect/index.tsx +283 -0
- package/src/components/Notifications/notification.tsx +23 -13
- package/src/components/Panel/index.tsx +14 -8
- package/src/components/Popover/index.tsx +8 -3
- package/src/components/RadioGroup/index.tsx +36 -27
- package/src/components/Table/row.tsx +2 -2
- package/src/components/Tabs/item.tsx +1 -1
- package/src/components/Tabs/list.tsx +11 -11
- package/src/components/Tag/group.tsx +15 -4
- package/src/components/Tag/index.tsx +7 -7
- package/src/components/Tree/index.tsx +3 -3
- package/src/constants/sizes.ts +8 -0
- package/src/containers/PopoverProvider.tsx +35 -3
- package/src/containers/ReqoreProvider.tsx +6 -4
- package/src/containers/UIProvider.tsx +1 -0
- package/src/context/PopoverContext.tsx +1 -0
- package/src/context/ReqoreContext.tsx +2 -0
- package/src/helpers/colors.ts +53 -7
- package/src/hooks/usePopover.tsx +39 -12
- package/src/hooks/useReqore.ts +12 -0
- package/src/hooks/useTheme.ts +6 -1
- package/src/index.tsx +3 -0
- package/src/mock/multiSelect.ts +61 -0
- package/src/stories/Button/Button.stories.tsx +20 -8
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +13 -2
- package/src/stories/Dropdown/Dropdown.stories.tsx +6 -1
- package/src/stories/Icon/Icon.stories.tsx +99 -22
- package/src/stories/Input/Input.stories.tsx +25 -0
- package/src/stories/Menu/Menu.stories.tsx +3 -2
- package/src/stories/Message/Message.stories.tsx +7 -1
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +99 -0
- 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/Tabs/Tabs.stories.tsx +23 -3
- package/src/stories/Tag/Tag.stories.tsx +12 -3
- package/src/stories/utils/args.ts +13 -0
- package/tests.json +1 -1
|
@@ -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
|
|
@@ -90,9 +90,9 @@ export const StyledInput = styled(StyledEffect)<IReqoreInputStyle>`
|
|
|
90
90
|
border-radius: ${({ minimal, rounded, _size }) =>
|
|
91
91
|
minimal || !rounded ? 0 : RADIUS_FROM_SIZE[_size]}px;
|
|
92
92
|
border: ${({ minimal, theme, flat }) =>
|
|
93
|
-
!minimal && !flat ? `1px solid ${changeLightness(theme.main, 0.
|
|
93
|
+
!minimal && !flat ? `1px solid ${changeLightness(theme.main, 0.2)}` : 0};
|
|
94
94
|
border-bottom: ${({ minimal, theme, flat }) =>
|
|
95
|
-
minimal && !flat ? `0.5px solid ${changeLightness(theme.main, 0.
|
|
95
|
+
minimal && !flat ? `0.5px solid ${changeLightness(theme.main, 0.2)}` : undefined};
|
|
96
96
|
|
|
97
97
|
${({ disabled, readOnly }) =>
|
|
98
98
|
!disabled && !readOnly
|
|
@@ -101,7 +101,7 @@ export const StyledInput = styled(StyledEffect)<IReqoreInputStyle>`
|
|
|
101
101
|
&:focus,
|
|
102
102
|
&:hover {
|
|
103
103
|
outline: none;
|
|
104
|
-
border-color: ${({ theme }) => changeLightness(theme.main, 0.
|
|
104
|
+
border-color: ${({ theme }) => changeLightness(theme.main, 0.25)};
|
|
105
105
|
}
|
|
106
106
|
`
|
|
107
107
|
: undefined}
|
|
@@ -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);
|
|
@@ -118,7 +165,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
118
165
|
{
|
|
119
166
|
name: 'offset',
|
|
120
167
|
options: {
|
|
121
|
-
offset: [0, noArrow ?
|
|
168
|
+
offset: [0, noArrow ? 5 : 10],
|
|
122
169
|
},
|
|
123
170
|
},
|
|
124
171
|
{
|
|
@@ -141,10 +188,10 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = ({
|
|
|
141
188
|
}, [popperRef]);
|
|
142
189
|
|
|
143
190
|
useEffect(() => {
|
|
144
|
-
if (attributes
|
|
191
|
+
if (attributes.popper?.['data-popper-reference-hidden']) {
|
|
145
192
|
removePopover?.(id);
|
|
146
193
|
}
|
|
147
|
-
}, [attributes
|
|
194
|
+
}, [attributes.popper]);
|
|
148
195
|
|
|
149
196
|
/* Getting the x and y values from the transform property of the popper element. */
|
|
150
197
|
const translateValues = styles.popper.transform
|
|
@@ -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,27 +1,55 @@
|
|
|
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
|
|
|
8
9
|
export interface IReqoreMenuDividerProps
|
|
9
|
-
extends React.HTMLAttributes<HTMLDivElement>,
|
|
10
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,
|
|
10
11
|
IWithReqoreEffect,
|
|
11
12
|
IWithReqoreSize {
|
|
12
|
-
label?: string;
|
|
13
|
+
label?: string | number;
|
|
14
|
+
margin?: 'left' | 'right' | 'both';
|
|
15
|
+
align?: 'left' | 'center' | 'right';
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
const StyledMenuDivider = styled(StyledTextEffect)`
|
|
18
|
+
export const StyledMenuDivider = styled(StyledTextEffect)`
|
|
16
19
|
width: 100%;
|
|
17
20
|
padding: ${({ size }) => `${PADDING_FROM_SIZE[size]}px 0`};
|
|
18
21
|
background-color: transparent;
|
|
19
22
|
|
|
23
|
+
${({ margin, size }) =>
|
|
24
|
+
margin &&
|
|
25
|
+
css`
|
|
26
|
+
margin-left: ${margin === 'left' || margin === 'both'
|
|
27
|
+
? isStringSize(size)
|
|
28
|
+
? `${PADDING_FROM_SIZE[size]}px`
|
|
29
|
+
: '10px'
|
|
30
|
+
: undefined};
|
|
31
|
+
margin-right: ${margin === 'right' || margin === 'both'
|
|
32
|
+
? isStringSize(size)
|
|
33
|
+
? `${PADDING_FROM_SIZE[size]}px`
|
|
34
|
+
: '10px'
|
|
35
|
+
: undefined};
|
|
36
|
+
`}
|
|
37
|
+
|
|
20
38
|
color: ${({ theme }) => getReadableColor(theme, undefined, undefined)};
|
|
21
39
|
`;
|
|
22
40
|
|
|
23
41
|
const ReqoreMenuDivider = forwardRef<HTMLDivElement, IReqoreMenuDividerProps>(
|
|
24
|
-
(
|
|
42
|
+
(
|
|
43
|
+
{
|
|
44
|
+
label,
|
|
45
|
+
className,
|
|
46
|
+
effect,
|
|
47
|
+
size = 'normal',
|
|
48
|
+
align = 'center',
|
|
49
|
+
...rest
|
|
50
|
+
}: IReqoreMenuDividerProps,
|
|
51
|
+
ref: any
|
|
52
|
+
) => (
|
|
25
53
|
<StyledMenuDivider
|
|
26
54
|
as='div'
|
|
27
55
|
{...rest}
|
|
@@ -32,8 +60,8 @@ const ReqoreMenuDivider = forwardRef<HTMLDivElement, IReqoreMenuDividerProps>(
|
|
|
32
60
|
{
|
|
33
61
|
uppercase: true,
|
|
34
62
|
spaced: 2,
|
|
35
|
-
textAlign:
|
|
36
|
-
textSize:
|
|
63
|
+
textAlign: align,
|
|
64
|
+
textSize: getOneLessSize(size),
|
|
37
65
|
weight: 'bold',
|
|
38
66
|
...effect,
|
|
39
67
|
} as IReqoreEffect
|
|
@@ -81,10 +81,10 @@ const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
|
|
|
81
81
|
React.cloneElement(child, {
|
|
82
82
|
_insidePopover,
|
|
83
83
|
_popoverId,
|
|
84
|
-
customTheme: child?.
|
|
84
|
+
customTheme: child.props?.customTheme || theme,
|
|
85
85
|
wrap: wrapText,
|
|
86
|
-
flat: 'flat' in child
|
|
87
|
-
minimal: 'minimal' in child
|
|
86
|
+
flat: 'flat' in (child.props || {}) ? child.props.flat : flat,
|
|
87
|
+
minimal: 'minimal' in (child.props || {}) ? child.props.minimal : minimal,
|
|
88
88
|
})
|
|
89
89
|
: null;
|
|
90
90
|
})}
|
|
@@ -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 {
|