@qoretechnologies/reqore 0.29.8 → 0.30.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__/collection.test.tsx +1 -1
- package/__tests__/{control_group.text.tsx → control_group.test.tsx} +4 -2
- package/__tests__/panel.test.tsx +22 -24
- package/__tests__/popover.test.tsx +24 -2
- package/__tests__/tabs.test.tsx +32 -0
- package/dist/components/Button/index.js +6 -6
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +3 -2
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +19 -44
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +2 -3
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +8 -4
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/column.d.ts.map +1 -1
- package/dist/components/Columns/column.js +1 -1
- package/dist/components/Columns/column.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +7 -4
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +118 -22
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +6 -4
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +1 -1
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +3 -5
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +10 -6
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.js +2 -2
- 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 +5 -3
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +10 -10
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +6 -3
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +64 -32
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Spacer/index.d.ts +2 -0
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +29 -7
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +3 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +8 -3
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +12 -4
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +1 -0
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +7 -7
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +3 -2
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/index.d.ts +3 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +10 -2
- 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/animations.js +1 -1
- package/dist/constants/sizes.js +7 -7
- package/dist/containers/PopoverProvider.js +3 -3
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +1 -0
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +7 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.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.map +1 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +4 -2
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/types/global.d.ts +13 -0
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +2 -2
- package/src/components/Collection/index.tsx +29 -39
- package/src/components/Collection/item.tsx +14 -6
- package/src/components/Columns/column.tsx +1 -0
- package/src/components/ControlGroup/index.tsx +390 -227
- package/src/components/Drawer/index.tsx +6 -4
- package/src/components/Effect/index.tsx +1 -0
- package/src/components/Icon/index.tsx +78 -62
- package/src/components/Input/index.tsx +1 -1
- package/src/components/InternalPopover/index.tsx +127 -123
- package/src/components/MultiSelect/index.tsx +180 -188
- package/src/components/Panel/index.tsx +171 -77
- package/src/components/Spacer/index.tsx +63 -14
- package/src/components/Tabs/content.tsx +11 -3
- package/src/components/Tabs/index.tsx +14 -3
- package/src/components/Tabs/item.tsx +24 -1
- package/src/components/Tabs/list.tsx +3 -0
- package/src/components/Tag/index.tsx +30 -23
- package/src/components/Tree/index.tsx +1 -1
- package/src/constants/animations.ts +1 -1
- package/src/constants/sizes.ts +7 -7
- package/src/containers/PopoverProvider.tsx +3 -3
- package/src/containers/ReqoreProvider.tsx +1 -0
- package/src/containers/UIProvider.tsx +7 -0
- package/src/context/ReqoreContext.tsx +1 -0
- package/src/hooks/usePopover.tsx +4 -2
- package/src/mock/collectionData.tsx +21 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +68 -6
- package/src/stories/Icon/Icon.stories.tsx +1 -0
- package/src/stories/Input/Input.stories.tsx +2 -1
- package/src/stories/Panel/Panel.stories.tsx +83 -2
- package/src/stories/Popover/Popover.stories.tsx +5 -5
- package/src/stories/Tabs/Tabs.stories.tsx +30 -14
- package/src/stories/Tag/Tag.stories.tsx +12 -2
- package/src/types/global.ts +14 -0
- package/tests.json +1 -1
|
@@ -205,6 +205,7 @@ export const ReqoreDrawer = ({
|
|
|
205
205
|
/* Adding a hide/show button to the drawer. */
|
|
206
206
|
if (hidable) {
|
|
207
207
|
actions.push({
|
|
208
|
+
responsive: false,
|
|
208
209
|
icon: getHideShowIcon(position, _isHidden),
|
|
209
210
|
onClick: () => {
|
|
210
211
|
setIsHidden(!_isHidden);
|
|
@@ -219,6 +220,7 @@ export const ReqoreDrawer = ({
|
|
|
219
220
|
/* Adding a close button to the drawer. */
|
|
220
221
|
if (onClose) {
|
|
221
222
|
actions.push({
|
|
223
|
+
responsive: false,
|
|
222
224
|
icon: 'CloseLine',
|
|
223
225
|
onClick: onClose,
|
|
224
226
|
className: 'reqore-drawer-close-button',
|
|
@@ -269,21 +271,21 @@ export const ReqoreDrawer = ({
|
|
|
269
271
|
}
|
|
270
272
|
minHeight={
|
|
271
273
|
layout === 'center'
|
|
272
|
-
? '
|
|
274
|
+
? '40px'
|
|
273
275
|
: layout === 'horizontal'
|
|
274
276
|
? _isHidden
|
|
275
277
|
? 0
|
|
276
|
-
: minSize || '
|
|
278
|
+
: minSize || '40px'
|
|
277
279
|
: undefined
|
|
278
280
|
}
|
|
279
281
|
maxWidth={layout === 'vertical' || layout === 'center' ? maxSize || '90vw' : undefined}
|
|
280
282
|
minWidth={
|
|
281
283
|
layout === 'center'
|
|
282
|
-
? '
|
|
284
|
+
? '40px'
|
|
283
285
|
: layout === 'vertical'
|
|
284
286
|
? _isHidden
|
|
285
287
|
? 0
|
|
286
|
-
: minSize || '
|
|
288
|
+
: minSize || '40px'
|
|
287
289
|
: undefined
|
|
288
290
|
}
|
|
289
291
|
as={StyledDrawerResizable}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import React, { memo, useContext } from 'react';
|
|
1
|
+
import React, { forwardRef, memo, useContext } from 'react';
|
|
2
2
|
import { IconContext } from 'react-icons';
|
|
3
3
|
import { IconBaseProps, IconType } from 'react-icons/lib';
|
|
4
4
|
import * as RemixIcons from 'react-icons/ri';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import { ReqoreThemeContext } from '../..';
|
|
7
7
|
import { ICON_FROM_SIZE, PADDING_FROM_SIZE, TSizes } from '../../constants/sizes';
|
|
8
|
-
import { TReqoreIntent } from '../../constants/theme';
|
|
9
8
|
import { getColorFromMaybeString } from '../../helpers/colors';
|
|
10
9
|
import { isStringSize } from '../../helpers/utils';
|
|
11
|
-
import {
|
|
10
|
+
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
11
|
+
import { useTooltip } from '../../hooks/useTooltip';
|
|
12
|
+
import { IReqoreIntent, IWithReqoreEffect, IWithReqoreTooltip } from '../../types/global';
|
|
12
13
|
import { IReqoreIconName } from '../../types/icons';
|
|
13
14
|
import { StyledEffect, TReqoreEffectColor } from '../Effect';
|
|
14
15
|
|
|
15
|
-
export interface IReqoreIconProps
|
|
16
|
+
export interface IReqoreIconProps
|
|
17
|
+
extends React.HTMLAttributes<HTMLSpanElement>,
|
|
18
|
+
IWithReqoreEffect,
|
|
19
|
+
IWithReqoreTooltip,
|
|
20
|
+
IReqoreIntent {
|
|
16
21
|
icon?: IReqoreIconName;
|
|
17
22
|
color?: TReqoreEffectColor;
|
|
18
23
|
size?: TSizes | string;
|
|
19
24
|
iconProps?: IconBaseProps;
|
|
20
|
-
intent?: TReqoreIntent;
|
|
21
25
|
margin?: 'right' | 'left' | 'both';
|
|
22
26
|
image?: string;
|
|
23
27
|
rounded?: boolean;
|
|
@@ -53,73 +57,85 @@ export const StyledIconWrapper = styled(StyledEffect)<{ margin: 'right' | 'left'
|
|
|
53
57
|
`;
|
|
54
58
|
|
|
55
59
|
const ReqoreIcon = memo(
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
forwardRef<HTMLSpanElement, IReqoreIconProps>(
|
|
61
|
+
(
|
|
62
|
+
{
|
|
63
|
+
icon,
|
|
64
|
+
size = 'normal',
|
|
65
|
+
className,
|
|
66
|
+
color,
|
|
67
|
+
margin,
|
|
68
|
+
style = {},
|
|
69
|
+
iconProps,
|
|
70
|
+
intent,
|
|
71
|
+
image,
|
|
72
|
+
tooltip,
|
|
73
|
+
...rest
|
|
74
|
+
}: IReqoreIconProps,
|
|
75
|
+
ref
|
|
76
|
+
) => {
|
|
77
|
+
const { targetRef } = useCombinedRefs(ref);
|
|
78
|
+
const theme = useContext(ReqoreThemeContext);
|
|
79
|
+
const Icon: IconType = RemixIcons[`Ri${icon}`];
|
|
80
|
+
const finalColor: string | undefined = intent
|
|
81
|
+
? theme.intents[intent]
|
|
82
|
+
: getColorFromMaybeString(theme, color);
|
|
83
|
+
const finalSize: string = isStringSize(size) ? ICON_FROM_SIZE[size] : size;
|
|
84
|
+
|
|
85
|
+
useTooltip(targetRef.current, tooltip);
|
|
86
|
+
|
|
87
|
+
if (image) {
|
|
88
|
+
return (
|
|
89
|
+
<StyledIconWrapper
|
|
90
|
+
{...rest}
|
|
91
|
+
ref={targetRef}
|
|
92
|
+
size={size}
|
|
93
|
+
margin={margin}
|
|
94
|
+
className={`${className || ''} reqore-icon`}
|
|
95
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
96
|
+
>
|
|
97
|
+
<img src={image} alt='' />
|
|
98
|
+
</StyledIconWrapper>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!Icon) {
|
|
103
|
+
return (
|
|
104
|
+
<StyledIconWrapper
|
|
105
|
+
{...rest}
|
|
106
|
+
ref={targetRef}
|
|
107
|
+
size={size}
|
|
108
|
+
margin={margin}
|
|
109
|
+
className={`${className || ''} reqore-icon`}
|
|
110
|
+
style={{ ...style, width: finalSize, height: finalSize }}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
74
114
|
|
|
75
|
-
if (image) {
|
|
76
115
|
return (
|
|
77
116
|
<StyledIconWrapper
|
|
78
117
|
{...rest}
|
|
79
|
-
|
|
118
|
+
ref={targetRef}
|
|
80
119
|
margin={margin}
|
|
81
|
-
|
|
120
|
+
size={size}
|
|
82
121
|
style={{ ...style, width: finalSize, height: finalSize }}
|
|
122
|
+
className={`${className || ''} reqore-icon`}
|
|
83
123
|
>
|
|
84
|
-
<
|
|
124
|
+
<IconContext.Provider
|
|
125
|
+
value={{
|
|
126
|
+
color: finalColor || 'inherit',
|
|
127
|
+
size: finalSize,
|
|
128
|
+
style: {
|
|
129
|
+
verticalAlign: 'super',
|
|
130
|
+
},
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
<Icon {...iconProps} />
|
|
134
|
+
</IconContext.Provider>
|
|
85
135
|
</StyledIconWrapper>
|
|
86
136
|
);
|
|
87
137
|
}
|
|
88
|
-
|
|
89
|
-
if (!Icon) {
|
|
90
|
-
return (
|
|
91
|
-
<StyledIconWrapper
|
|
92
|
-
{...rest}
|
|
93
|
-
size={size}
|
|
94
|
-
margin={margin}
|
|
95
|
-
className={`${className || ''} reqore-icon`}
|
|
96
|
-
style={{ ...style, width: finalSize, height: finalSize }}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<StyledIconWrapper
|
|
103
|
-
{...rest}
|
|
104
|
-
margin={margin}
|
|
105
|
-
size={size}
|
|
106
|
-
style={{ ...style, width: finalSize, height: finalSize }}
|
|
107
|
-
className={`${className || ''} reqore-icon`}
|
|
108
|
-
>
|
|
109
|
-
<IconContext.Provider
|
|
110
|
-
value={{
|
|
111
|
-
color: finalColor || 'inherit',
|
|
112
|
-
size: finalSize,
|
|
113
|
-
style: {
|
|
114
|
-
verticalAlign: 'super',
|
|
115
|
-
},
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
<Icon {...iconProps} />
|
|
119
|
-
</IconContext.Provider>
|
|
120
|
-
</StyledIconWrapper>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
138
|
+
)
|
|
123
139
|
);
|
|
124
140
|
|
|
125
141
|
export default ReqoreIcon;
|
|
@@ -60,7 +60,7 @@ export interface IReqoreInputStyle extends IReqoreInputProps {
|
|
|
60
60
|
|
|
61
61
|
export const StyledInputWrapper = styled.div<IReqoreInputStyle>`
|
|
62
62
|
height: ${({ _size }) => SIZE_TO_PX[_size]}px;
|
|
63
|
-
width: ${({ width }) => (width ? `${width}px` : 'auto')};
|
|
63
|
+
width: ${({ width, fluid, fixed }) => (width ? `${width}px` : fluid && !fixed ? '100%' : 'auto')};
|
|
64
64
|
max-width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
65
65
|
min-width: 60px;
|
|
66
66
|
flex: ${({ fluid, fixed }) => (fixed ? '0 auto' : fluid ? '1 auto' : '0 1 auto')};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isString } from 'lodash';
|
|
2
2
|
import { rgba } from 'polished';
|
|
3
|
-
import React, { MutableRefObject, useContext, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import React, { MutableRefObject, memo, useContext, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { usePopper } from 'react-popper';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import { RADIUS_FROM_SIZE } from '../../constants/sizes';
|
|
@@ -139,134 +139,138 @@ const StyledPopoverContent = styled.div`
|
|
|
139
139
|
|
|
140
140
|
export interface IReqoreInternalPopoverProps extends IPopoverData {}
|
|
141
141
|
|
|
142
|
-
const InternalPopover: React.FC<IReqoreInternalPopoverProps> = (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
noArrow,
|
|
148
|
-
noWrapper,
|
|
149
|
-
useTargetWidth,
|
|
150
|
-
transparent,
|
|
151
|
-
maxWidth,
|
|
152
|
-
maxHeight,
|
|
153
|
-
blur,
|
|
154
|
-
intent,
|
|
155
|
-
title,
|
|
156
|
-
icon,
|
|
157
|
-
minimal,
|
|
158
|
-
flat = true,
|
|
159
|
-
effect,
|
|
160
|
-
}) => {
|
|
161
|
-
const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
|
|
162
|
-
const [popperElement, setPopperElement] = useState(null);
|
|
163
|
-
const [arrowElement, setArrowElement] = useState(null);
|
|
164
|
-
const popperRef: MutableRefObject<any> = useRef(null);
|
|
165
|
-
const { styles, attributes } = usePopper(targetElement, popperElement, {
|
|
142
|
+
const InternalPopover: React.FC<IReqoreInternalPopoverProps> = memo(
|
|
143
|
+
({
|
|
144
|
+
targetElement,
|
|
145
|
+
content,
|
|
146
|
+
id,
|
|
166
147
|
placement,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
148
|
+
noArrow,
|
|
149
|
+
noWrapper,
|
|
150
|
+
useTargetWidth,
|
|
151
|
+
transparent,
|
|
152
|
+
maxWidth,
|
|
153
|
+
maxHeight,
|
|
154
|
+
blur,
|
|
155
|
+
intent,
|
|
156
|
+
title,
|
|
157
|
+
icon,
|
|
158
|
+
minimal,
|
|
159
|
+
flat = true,
|
|
160
|
+
effect,
|
|
161
|
+
}) => {
|
|
162
|
+
const { removePopover, updatePopover, uiScale } = useContext(PopoverContext);
|
|
163
|
+
const [popperElement, setPopperElement] = useState(null);
|
|
164
|
+
const [arrowElement, setArrowElement] = useState(null);
|
|
165
|
+
const popperRef: MutableRefObject<any> = useRef(null);
|
|
166
|
+
const { styles, attributes } = usePopper(targetElement, popperElement, {
|
|
167
|
+
placement,
|
|
168
|
+
modifiers: [
|
|
169
|
+
{
|
|
170
|
+
name: 'offset',
|
|
171
|
+
options: {
|
|
172
|
+
offset: [0, noArrow ? 5 : 10],
|
|
173
|
+
},
|
|
172
174
|
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
{
|
|
176
|
+
name: 'arrow',
|
|
177
|
+
options: {
|
|
178
|
+
element: arrowElement,
|
|
179
|
+
},
|
|
178
180
|
},
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
if (popperRef.current) {
|
|
189
|
-
updatePopover?.(id, { popperRef });
|
|
190
|
-
}
|
|
191
|
-
}, [popperRef]);
|
|
181
|
+
{
|
|
182
|
+
name: 'hide',
|
|
183
|
+
enabled: true,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
});
|
|
192
187
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
if (popperRef.current) {
|
|
190
|
+
updatePopover?.(id, { popperRef });
|
|
191
|
+
}
|
|
192
|
+
}, [popperRef]);
|
|
198
193
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
.replace('translate(', '')
|
|
203
|
-
.replace(')', '')
|
|
204
|
-
.split(',')
|
|
205
|
-
.map((axis) => {
|
|
206
|
-
if (uiScale || uiScale === 0) {
|
|
207
|
-
return parseInt(axis, 10) < 0 ? parseInt(axis, 10) * uiScale : parseInt(axis, 10) / uiScale;
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
if (attributes.popper?.['data-popper-reference-hidden']) {
|
|
196
|
+
removePopover?.(id);
|
|
208
197
|
}
|
|
209
|
-
|
|
210
|
-
});
|
|
198
|
+
}, [attributes.popper]);
|
|
211
199
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
{
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
) :
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
200
|
+
/* Getting the x and y values from the transform property of the popper element. */
|
|
201
|
+
const translateValues = styles.popper.transform
|
|
202
|
+
?.replace('translate3d(', '')
|
|
203
|
+
.replace('translate(', '')
|
|
204
|
+
.replace(')', '')
|
|
205
|
+
.split(',')
|
|
206
|
+
.map((axis) => {
|
|
207
|
+
if (uiScale || uiScale === 0) {
|
|
208
|
+
return parseInt(axis, 10) < 0
|
|
209
|
+
? parseInt(axis, 10) * uiScale
|
|
210
|
+
: parseInt(axis, 10) / uiScale;
|
|
211
|
+
}
|
|
212
|
+
return parseInt(axis, 10);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<ReqoreThemeProvider>
|
|
217
|
+
{blur > 0 ? <StyledBackdrop zIndex={999998} blur={blur} closable /> : null}
|
|
218
|
+
<StyledPopoverWrapper
|
|
219
|
+
maxWidth={maxWidth}
|
|
220
|
+
maxHeight={maxHeight}
|
|
221
|
+
transparent={transparent}
|
|
222
|
+
effect={effect}
|
|
223
|
+
isOpaque={!transparent && !minimal}
|
|
224
|
+
intent={intent}
|
|
225
|
+
flat={flat}
|
|
226
|
+
noWrapper={noWrapper}
|
|
227
|
+
dim={flat && !transparent && !effect && minimal}
|
|
228
|
+
className='reqore-popover-content'
|
|
229
|
+
ref={(el) => {
|
|
230
|
+
setPopperElement(el);
|
|
231
|
+
popperRef.current = el;
|
|
232
|
+
}}
|
|
233
|
+
style={{
|
|
234
|
+
...styles.popper,
|
|
235
|
+
transform: `translate(${translateValues?.[0] || 0}px, ${translateValues?.[1] || 0}px)`,
|
|
236
|
+
width: useTargetWidth && (targetElement?.getBoundingClientRect()?.width || undefined),
|
|
237
|
+
}}
|
|
238
|
+
{...attributes.popper}
|
|
239
|
+
>
|
|
240
|
+
{!noArrow && !transparent ? (
|
|
241
|
+
<StyledPopoverArrow ref={setArrowElement} style={styles.arrow} data-popper-arrow />
|
|
242
|
+
) : null}
|
|
243
|
+
<StyledPopoverContent>
|
|
244
|
+
{!noWrapper || isString(content) ? (
|
|
245
|
+
<ReqoreMessage
|
|
246
|
+
opaque={!transparent && !minimal}
|
|
247
|
+
className='reqore-popover-text'
|
|
248
|
+
intent={intent}
|
|
249
|
+
title={title}
|
|
250
|
+
icon={icon}
|
|
251
|
+
minimal={transparent}
|
|
252
|
+
flat={flat || transparent}
|
|
253
|
+
effect={effect}
|
|
254
|
+
>
|
|
255
|
+
{content}
|
|
256
|
+
</ReqoreMessage>
|
|
257
|
+
) : (
|
|
258
|
+
<>
|
|
259
|
+
{React.Children.map(content, (child) =>
|
|
260
|
+
child
|
|
261
|
+
? React.cloneElement(child, {
|
|
262
|
+
_insidePopover: true,
|
|
263
|
+
_popoverId: id,
|
|
264
|
+
})
|
|
265
|
+
: null
|
|
266
|
+
)}
|
|
267
|
+
</>
|
|
268
|
+
)}
|
|
269
|
+
</StyledPopoverContent>
|
|
270
|
+
</StyledPopoverWrapper>
|
|
271
|
+
</ReqoreThemeProvider>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
);
|
|
271
275
|
|
|
272
276
|
export default InternalPopover;
|