@qoretechnologies/reqore 0.30.7 → 0.30.9
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/CODE_OF_CONDUCT.md +105 -0
- package/CONTRIBUTING.MD +78 -0
- package/README.md +44 -2
- package/SECURITY.md +5 -0
- package/__tests__/dropdown.test.tsx +40 -1
- package/__tests__/popover.test.tsx +23 -0
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +4 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ControlGroup/index.js +1 -1
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +3 -3
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Effect/index.d.ts +9 -9
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +13 -13
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +3 -3
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +8 -4
- package/dist/components/Message/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/Notifications/index.d.ts +1 -1
- package/dist/components/Notifications/index.d.ts.map +1 -1
- package/dist/components/Notifications/notification.d.ts +1 -1
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Panel/index.d.ts +3 -2
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +7 -5
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Table/index.d.ts +3 -3
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Tabs/content.d.ts +1 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +1 -1
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tag/index.js +2 -2
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/constants/sizes.d.ts +2 -2
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/theme.d.ts +1 -1
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +6 -3
- package/dist/containers/PopoverProvider.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 +33 -4
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/helpers/utils.js +1 -1
- package/dist/hooks/usePopover.d.ts +1 -1
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +9 -3
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/types/global.d.ts +1 -1
- package/dist/types/global.d.ts.map +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
- package/src/components/Button/index.tsx +4 -1
- package/src/components/ControlGroup/index.tsx +1 -1
- package/src/components/Dropdown/index.tsx +1 -1
- package/src/components/InternalPopover/index.tsx +5 -6
- package/src/components/Message/index.tsx +127 -117
- package/src/components/Panel/index.tsx +55 -40
- package/src/components/Tabs/item.tsx +1 -1
- package/src/components/Tag/index.tsx +1 -1
- package/src/containers/PopoverProvider.tsx +5 -3
- package/src/containers/UIProvider.tsx +26 -2
- package/src/hooks/usePopover.tsx +13 -4
- package/src/stories/Columns/Columns.stories.tsx +83 -10
- package/src/stories/Dropdown/Dropdown.stories.tsx +1 -0
- package/src/stories/Panel/Panel.stories.tsx +16 -1
- package/src/stories/Popover/Popover.stories.tsx +138 -5
- package/src/stories/Tag/Tag.stories.tsx +35 -1
- package/tests.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { animated } from '@react-spring/web';
|
|
2
|
-
import React, { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import React, { forwardRef, memo, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { useMount, useUnmount } from 'react-use';
|
|
4
4
|
import { IReqoreTheme } from '../../constants/theme';
|
|
5
5
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
6
6
|
import { getColorFromMaybeString } from '../../helpers/colors';
|
|
7
|
+
import { useCombinedRefs } from '../../hooks/useCombinedRefs';
|
|
7
8
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
9
|
+
import { useTooltip } from '../../hooks/useTooltip';
|
|
8
10
|
import {
|
|
9
11
|
IReqoreIntent,
|
|
10
12
|
IWithReqoreCustomTheme,
|
|
@@ -12,6 +14,7 @@ import {
|
|
|
12
14
|
IWithReqoreMinimal,
|
|
13
15
|
IWithReqoreOpaque,
|
|
14
16
|
IWithReqoreSize,
|
|
17
|
+
IWithReqoreTooltip,
|
|
15
18
|
} from '../../types/global';
|
|
16
19
|
import { IReqoreIconName } from '../../types/icons';
|
|
17
20
|
import { TReqoreEffectColor } from '../Effect';
|
|
@@ -32,6 +35,7 @@ export interface IReqoreMessageProps
|
|
|
32
35
|
IReqoreIntent,
|
|
33
36
|
IWithReqoreMinimal,
|
|
34
37
|
IWithReqoreOpaque,
|
|
38
|
+
IWithReqoreTooltip,
|
|
35
39
|
React.HTMLAttributes<HTMLDivElement> {
|
|
36
40
|
title?: string;
|
|
37
41
|
children: any;
|
|
@@ -51,130 +55,136 @@ export interface IReqoreNotificationStyle extends IReqoreMessageProps {
|
|
|
51
55
|
timeout?: number;
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
const ReqoreMessage =
|
|
55
|
-
(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
const ReqoreMessage = memo(
|
|
59
|
+
forwardRef<HTMLDivElement, IReqoreMessageProps>(
|
|
60
|
+
(
|
|
61
|
+
{
|
|
62
|
+
intent,
|
|
63
|
+
icon,
|
|
64
|
+
title,
|
|
65
|
+
children,
|
|
66
|
+
onClose,
|
|
67
|
+
onClick,
|
|
68
|
+
duration,
|
|
69
|
+
onFinish,
|
|
70
|
+
flat,
|
|
71
|
+
minimal,
|
|
72
|
+
size = 'normal',
|
|
73
|
+
customTheme,
|
|
74
|
+
iconColor,
|
|
75
|
+
tooltip,
|
|
76
|
+
...rest
|
|
77
|
+
},
|
|
78
|
+
ref
|
|
79
|
+
) => {
|
|
80
|
+
const [internalTimeout, setInternalTimeout] = useState<NodeJS.Timeout | null>(null);
|
|
81
|
+
const theme = useReqoreTheme('main', customTheme, intent);
|
|
82
|
+
const { targetRef } = useCombinedRefs(ref);
|
|
76
83
|
|
|
77
|
-
|
|
78
|
-
if (duration) {
|
|
79
|
-
setInternalTimeout(
|
|
80
|
-
setTimeout(() => {
|
|
81
|
-
onFinish && onFinish();
|
|
82
|
-
}, duration)
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
84
|
+
useTooltip(targetRef.current, tooltip);
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}, [duration, intent, children, title]);
|
|
86
|
+
useMount(() => {
|
|
87
|
+
if (duration) {
|
|
88
|
+
setInternalTimeout(
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
onFinish && onFinish();
|
|
91
|
+
}, duration)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
97
95
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (internalTimeout) {
|
|
98
|
+
clearTimeout(internalTimeout);
|
|
99
|
+
setInternalTimeout(
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
onFinish && onFinish();
|
|
102
|
+
}, duration)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}, [duration, intent, children, title]);
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
useUnmount(() => {
|
|
108
|
+
if (internalTimeout) {
|
|
109
|
+
clearTimeout(internalTimeout);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
113
|
+
const leftIcon: IReqoreIconName | undefined = useMemo(
|
|
114
|
+
() => icon || (intent ? typeToIcon[intent] : undefined),
|
|
115
|
+
[icon, intent]
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<ReqoreThemeProvider>
|
|
120
|
+
<StyledReqoreNotification
|
|
121
|
+
{...rest}
|
|
122
|
+
effect={{
|
|
123
|
+
interactive: !!onClick,
|
|
124
|
+
...rest?.effect,
|
|
125
|
+
}}
|
|
126
|
+
as={animated.div}
|
|
127
|
+
key={`${duration}${intent}${title}${children}`}
|
|
128
|
+
intent={intent}
|
|
129
|
+
timeout={duration}
|
|
130
|
+
clickable={!!onClick}
|
|
131
|
+
onClick={onClick}
|
|
132
|
+
flat={flat}
|
|
133
|
+
minimal={minimal}
|
|
134
|
+
asMessage
|
|
135
|
+
fluid
|
|
136
|
+
className={`${rest?.className || ''} reqore-message`}
|
|
137
|
+
ref={targetRef}
|
|
138
|
+
size={size}
|
|
139
|
+
theme={theme}
|
|
140
|
+
>
|
|
141
|
+
{leftIcon ? (
|
|
142
|
+
<StyledIconWrapper intent={intent} size={size} theme={theme}>
|
|
143
|
+
<ReqoreIcon
|
|
144
|
+
icon={leftIcon}
|
|
145
|
+
margin={flat && minimal ? 'right' : 'both'}
|
|
146
|
+
size={size}
|
|
147
|
+
color={iconColor}
|
|
148
|
+
/>
|
|
149
|
+
</StyledIconWrapper>
|
|
150
|
+
) : null}
|
|
151
|
+
<StyledNotificationContentWrapper size={size} theme={theme}>
|
|
152
|
+
{title && (
|
|
153
|
+
<ReqoreHeading
|
|
154
|
+
size={size}
|
|
155
|
+
customTheme={
|
|
156
|
+
rest.effect?.color
|
|
157
|
+
? { text: { color: getColorFromMaybeString(theme, rest.effect.color) } }
|
|
158
|
+
: undefined
|
|
159
|
+
}
|
|
160
|
+
>
|
|
161
|
+
{title}
|
|
162
|
+
</ReqoreHeading>
|
|
163
|
+
)}
|
|
164
|
+
<StyledNotificationContent theme={theme} hasTitle={!!title} size={size}>
|
|
165
|
+
{children}
|
|
166
|
+
</StyledNotificationContent>
|
|
167
|
+
</StyledNotificationContentWrapper>
|
|
168
|
+
{onClose && (
|
|
169
|
+
<StyledIconWrapper
|
|
170
|
+
theme={theme}
|
|
145
171
|
size={size}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
intent={intent}
|
|
173
|
+
clickable
|
|
174
|
+
className='reqore-message-close'
|
|
175
|
+
onClick={(event) => {
|
|
176
|
+
event.stopPropagation();
|
|
177
|
+
onClose && onClose();
|
|
178
|
+
}}
|
|
151
179
|
>
|
|
152
|
-
{
|
|
153
|
-
</
|
|
180
|
+
<ReqoreIcon icon='CloseFill' margin='both' size={size} />
|
|
181
|
+
</StyledIconWrapper>
|
|
154
182
|
)}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<StyledIconWrapper
|
|
161
|
-
theme={theme}
|
|
162
|
-
size={size}
|
|
163
|
-
intent={intent}
|
|
164
|
-
clickable
|
|
165
|
-
className='reqore-message-close'
|
|
166
|
-
onClick={(event) => {
|
|
167
|
-
event.stopPropagation();
|
|
168
|
-
onClose && onClose();
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
<ReqoreIcon icon='CloseFill' margin='both' size={size} />
|
|
172
|
-
</StyledIconWrapper>
|
|
173
|
-
)}
|
|
174
|
-
</StyledReqoreNotification>
|
|
175
|
-
</ReqoreThemeProvider>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
183
|
+
</StyledReqoreNotification>
|
|
184
|
+
</ReqoreThemeProvider>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
)
|
|
178
188
|
);
|
|
179
189
|
|
|
180
190
|
export default ReqoreMessage;
|
|
@@ -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 {
|
|
@@ -98,6 +98,7 @@ export interface IReqorePanelProps
|
|
|
98
98
|
headerEffect?: IReqoreEffect;
|
|
99
99
|
transparent?: boolean;
|
|
100
100
|
iconColor?: TReqoreEffectColor;
|
|
101
|
+
responsiveActions?: boolean;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
export interface IStyledPanel extends IReqorePanelProps {
|
|
@@ -286,6 +287,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
286
287
|
badge,
|
|
287
288
|
iconColor,
|
|
288
289
|
fluid,
|
|
290
|
+
responsiveActions = true,
|
|
289
291
|
size: panelSize = 'normal',
|
|
290
292
|
...rest
|
|
291
293
|
}: IReqorePanelProps,
|
|
@@ -316,7 +318,13 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
316
318
|
!!size(actions.filter(isActionShown)) ||
|
|
317
319
|
!!badge ||
|
|
318
320
|
!!icon,
|
|
319
|
-
[label, collapsible, onClose, actions, badge]
|
|
321
|
+
[label, collapsible, onClose, actions, badge, icon]
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
// Return true if the card has a title bar, otherwise return false.
|
|
325
|
+
const hasTitleHeader: boolean = useMemo(
|
|
326
|
+
() => !!label || !!badge || !!icon,
|
|
327
|
+
[label, icon, badge]
|
|
320
328
|
);
|
|
321
329
|
|
|
322
330
|
// If collapsible is true, toggle the isCollapsed state
|
|
@@ -524,45 +532,47 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
524
532
|
opacity={opacity ?? (minimal ? 0 : 1)}
|
|
525
533
|
noHorizontalPadding={noHorizontalPadding}
|
|
526
534
|
>
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
)}
|
|
538
|
-
{typeof label === 'string' ? (
|
|
539
|
-
<ReqoreHeading
|
|
540
|
-
size={headerSize || panelSize}
|
|
541
|
-
customTheme={theme}
|
|
542
|
-
effect={{
|
|
543
|
-
noWrap: true,
|
|
544
|
-
...headerEffect,
|
|
545
|
-
}}
|
|
546
|
-
>
|
|
547
|
-
{label}
|
|
548
|
-
</ReqoreHeading>
|
|
549
|
-
) : (
|
|
550
|
-
label
|
|
551
|
-
)}
|
|
552
|
-
{badge || badge === 0 ? (
|
|
553
|
-
<>
|
|
554
|
-
<ButtonBadge
|
|
555
|
-
color={changeLightness(theme.main, 0.18)}
|
|
556
|
-
size={panelSize}
|
|
557
|
-
content={badge}
|
|
535
|
+
{hasTitleHeader && (
|
|
536
|
+
<StyledPanelTitleHeader>
|
|
537
|
+
{icon && (
|
|
538
|
+
<ReqoreIcon
|
|
539
|
+
size={`${
|
|
540
|
+
ICON_FROM_HEADER_SIZE[headerSize || HEADER_SIZE_TO_NUMBER[panelSize]]
|
|
541
|
+
}px`}
|
|
542
|
+
icon={icon}
|
|
543
|
+
margin='right'
|
|
544
|
+
color={iconColor}
|
|
558
545
|
/>
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
546
|
+
)}
|
|
547
|
+
{typeof label === 'string' ? (
|
|
548
|
+
<ReqoreHeading
|
|
549
|
+
size={headerSize || panelSize}
|
|
550
|
+
customTheme={theme}
|
|
551
|
+
effect={{
|
|
552
|
+
noWrap: true,
|
|
553
|
+
...headerEffect,
|
|
554
|
+
}}
|
|
555
|
+
>
|
|
556
|
+
{label}
|
|
557
|
+
</ReqoreHeading>
|
|
558
|
+
) : (
|
|
559
|
+
label
|
|
560
|
+
)}
|
|
561
|
+
{badge || badge === 0 ? (
|
|
562
|
+
<>
|
|
563
|
+
<ButtonBadge
|
|
564
|
+
color={changeLightness(theme.main, 0.18)}
|
|
565
|
+
size={panelSize}
|
|
566
|
+
content={badge}
|
|
567
|
+
/>
|
|
568
|
+
<ReqoreSpacer width={PADDING_FROM_SIZE.normal} />
|
|
569
|
+
</>
|
|
570
|
+
) : null}
|
|
571
|
+
</StyledPanelTitleHeader>
|
|
572
|
+
)}
|
|
563
573
|
{hasResponsiveActions(actions) && (
|
|
564
574
|
<ReqoreControlGroup
|
|
565
|
-
responsive
|
|
575
|
+
responsive={responsiveActions}
|
|
566
576
|
fluid
|
|
567
577
|
horizontalAlign='flex-end'
|
|
568
578
|
customTheme={theme}
|
|
@@ -634,7 +644,12 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
634
644
|
</>
|
|
635
645
|
) : null}
|
|
636
646
|
{hasResponsiveActions(leftBottomActions) && (
|
|
637
|
-
<ReqoreControlGroup
|
|
647
|
+
<ReqoreControlGroup
|
|
648
|
+
fluid
|
|
649
|
+
responsive={responsiveActions}
|
|
650
|
+
customTheme={theme}
|
|
651
|
+
size={panelSize}
|
|
652
|
+
>
|
|
638
653
|
{leftBottomActions.map(renderResponsiveActions)}
|
|
639
654
|
</ReqoreControlGroup>
|
|
640
655
|
)}
|
|
@@ -642,7 +657,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
|
|
|
642
657
|
<ReqoreControlGroup
|
|
643
658
|
fluid
|
|
644
659
|
horizontalAlign='flex-end'
|
|
645
|
-
responsive
|
|
660
|
+
responsive={responsiveActions}
|
|
646
661
|
customTheme={theme}
|
|
647
662
|
size={panelSize}
|
|
648
663
|
>
|
|
@@ -86,7 +86,7 @@ export const StyledTag = styled(StyledEffect)<IReqoreTagStyle>`
|
|
|
86
86
|
font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
|
|
87
87
|
|
|
88
88
|
min-width: ${({ size }) => SIZE_TO_PX[size]}px;
|
|
89
|
-
max-width: ${({
|
|
89
|
+
max-width: ${({ fixed }) => (!fixed ? '100%' : undefined)};
|
|
90
90
|
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
91
91
|
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
92
92
|
border-radius: ${({ asBadge, size }) => (asBadge ? 18 : RADIUS_FROM_SIZE[size])}px;
|
|
@@ -59,9 +59,11 @@ const PopoverProvider: React.FC<IReqorePopoverProviderProps> = ({ children, uiSc
|
|
|
59
59
|
|
|
60
60
|
if (popover) {
|
|
61
61
|
// Remove the blur
|
|
62
|
-
if (popover.blur
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
if (popover.blur) {
|
|
63
|
+
// Remove the blur
|
|
64
|
+
document.getElementById(`reqore-blur-${id}`)?.remove();
|
|
65
|
+
// Remove the z index class
|
|
66
|
+
popover.targetElement.classList.remove('reqore-blur-z-index');
|
|
65
67
|
}
|
|
66
68
|
// Remove the popover
|
|
67
69
|
setPopovers((cur: IPopoverData[]) => [...cur].filter((p) => p.id !== id));
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash';
|
|
2
2
|
import merge from 'lodash/merge';
|
|
3
|
+
import { rgba } from 'polished';
|
|
3
4
|
import React, { useState } from 'react';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
+
import styled, { createGlobalStyle } from 'styled-components';
|
|
5
6
|
import ReqoreLayoutWrapper from '../components/Layout';
|
|
6
7
|
import { IReqoreNotificationsPosition } from '../components/Notifications';
|
|
7
8
|
import { DEFAULT_THEME, IReqoreTheme } from '../constants/theme';
|
|
8
9
|
import ThemeContext from '../context/ThemeContext';
|
|
9
|
-
import { buildTheme } from '../helpers/colors';
|
|
10
|
+
import { buildTheme, getMainBackgroundColor } from '../helpers/colors';
|
|
10
11
|
import PopoverProvider from './PopoverProvider';
|
|
11
12
|
import ReqoreProvider from './ReqoreProvider';
|
|
13
|
+
import ReqoreThemeProvider from './ThemeProvider';
|
|
12
14
|
|
|
13
15
|
export interface IReqoreOptions {
|
|
14
16
|
withSidebar?: boolean;
|
|
@@ -22,6 +24,7 @@ export interface IReqoreOptions {
|
|
|
22
24
|
/**
|
|
23
25
|
* Delay in ms before showing the tooltip
|
|
24
26
|
* @default 0
|
|
27
|
+
* Works only for `hover` handler
|
|
25
28
|
* */
|
|
26
29
|
delay?: number;
|
|
27
30
|
};
|
|
@@ -33,6 +36,24 @@ export interface IReqoreUIProviderProps {
|
|
|
33
36
|
options?: IReqoreOptions;
|
|
34
37
|
}
|
|
35
38
|
|
|
39
|
+
const GlobalStyle = createGlobalStyle`
|
|
40
|
+
.reqore-blur-wrapper {
|
|
41
|
+
position: fixed;
|
|
42
|
+
top: 0;
|
|
43
|
+
left: 0;
|
|
44
|
+
right: 0;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
z-index: 999998;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
background-color: ${({ theme }) => rgba(getMainBackgroundColor(theme), 0.3)};
|
|
49
|
+
backdrop-filter: blur(3px);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.reqore-blur-z-index {
|
|
53
|
+
z-index: 999999;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
36
57
|
const StyledPortal = styled.div`
|
|
37
58
|
z-index: 9999;
|
|
38
59
|
* {
|
|
@@ -50,6 +71,9 @@ const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = ({ children, theme, o
|
|
|
50
71
|
return (
|
|
51
72
|
<>
|
|
52
73
|
<ThemeContext.Provider value={{ ...rebuiltTheme }}>
|
|
74
|
+
<ReqoreThemeProvider>
|
|
75
|
+
<GlobalStyle />
|
|
76
|
+
</ReqoreThemeProvider>
|
|
53
77
|
<ReqoreLayoutWrapper withSidebar={options?.withSidebar}>
|
|
54
78
|
{modalPortal ? (
|
|
55
79
|
<ReqoreProvider options={options}>
|
package/src/hooks/usePopover.tsx
CHANGED
|
@@ -50,7 +50,7 @@ export interface IPopover
|
|
|
50
50
|
closeOnOutsideClick?: boolean;
|
|
51
51
|
closeOnAnyClick?: boolean;
|
|
52
52
|
delay?: number;
|
|
53
|
-
blur?:
|
|
53
|
+
blur?: boolean;
|
|
54
54
|
transparent?: boolean;
|
|
55
55
|
maxWidth?: string;
|
|
56
56
|
maxHeight?: string;
|
|
@@ -102,9 +102,18 @@ const usePopover = ({
|
|
|
102
102
|
...rest,
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
if (rest.blur
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
if (rest.blur) {
|
|
106
|
+
// Create a div and prepend before the targetElement
|
|
107
|
+
const blurDiv = document.createElement('div');
|
|
108
|
+
|
|
109
|
+
blurDiv.id = `reqore-blur-${current}`;
|
|
110
|
+
blurDiv.classList.add('reqore-blur-wrapper');
|
|
111
|
+
|
|
112
|
+
// Add the blur div before the target element
|
|
113
|
+
targetElement.before(blurDiv);
|
|
114
|
+
|
|
115
|
+
// Add the highest z-index to the target element
|
|
116
|
+
targetElement.classList.add('reqore-blur-z-index');
|
|
108
117
|
}
|
|
109
118
|
};
|
|
110
119
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react';
|
|
2
2
|
import { IReqoreColumnsProps } from '../../components/Columns';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ReqoreButton,
|
|
5
|
+
ReqoreColumn,
|
|
6
|
+
ReqoreColumns,
|
|
7
|
+
ReqoreControlGroup,
|
|
8
|
+
ReqoreH2,
|
|
9
|
+
ReqoreInput,
|
|
10
|
+
ReqoreVerticalSpacer,
|
|
11
|
+
} from '../../index';
|
|
4
12
|
import { argManager } from '../utils/args';
|
|
5
13
|
|
|
6
14
|
export interface IColumnsStoryArgs extends IReqoreColumnsProps {
|
|
@@ -43,20 +51,74 @@ export default {
|
|
|
43
51
|
|
|
44
52
|
const Template: Story<IColumnsStoryArgs> = (args) => {
|
|
45
53
|
return (
|
|
46
|
-
<ReqoreColumns {...args}>
|
|
47
|
-
<ReqoreColumn
|
|
48
|
-
|
|
54
|
+
<ReqoreColumns {...args} columnsGap='10px'>
|
|
55
|
+
<ReqoreColumn
|
|
56
|
+
{...args}
|
|
57
|
+
style={{ border: '1px solid white', padding: '10px' }}
|
|
58
|
+
flexFlow='column'
|
|
59
|
+
>
|
|
60
|
+
<ReqoreH2>Left Column</ReqoreH2>
|
|
61
|
+
<ReqoreVerticalSpacer height={20} lineSize='tiny' />
|
|
62
|
+
<ReqoreControlGroup fluid>
|
|
63
|
+
<ReqoreInput placeholder='Filter' />
|
|
64
|
+
</ReqoreControlGroup>
|
|
65
|
+
<ReqoreVerticalSpacer height={10} />
|
|
66
|
+
<ReqoreControlGroup vertical fluid>
|
|
67
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
68
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
69
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
70
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
71
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
72
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
73
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
74
|
+
</ReqoreControlGroup>
|
|
49
75
|
</ReqoreColumn>
|
|
50
|
-
<ReqoreColumn
|
|
51
|
-
|
|
76
|
+
<ReqoreColumn
|
|
77
|
+
{...args}
|
|
78
|
+
style={{ border: '1px solid white', padding: '10px' }}
|
|
79
|
+
flexFlow='column'
|
|
80
|
+
>
|
|
81
|
+
<ReqoreH2>Right Column</ReqoreH2>
|
|
82
|
+
<ReqoreVerticalSpacer height={20} lineSize='tiny' />
|
|
83
|
+
<ReqoreControlGroup fluid>
|
|
84
|
+
<ReqoreInput placeholder='Filter' />
|
|
85
|
+
</ReqoreControlGroup>
|
|
86
|
+
<ReqoreVerticalSpacer height={10} />
|
|
87
|
+
<ReqoreControlGroup vertical fluid>
|
|
88
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
89
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
90
|
+
</ReqoreControlGroup>
|
|
52
91
|
</ReqoreColumn>
|
|
53
92
|
{args.multipleColumns && (
|
|
54
93
|
<>
|
|
55
|
-
<ReqoreColumn
|
|
56
|
-
|
|
94
|
+
<ReqoreColumn
|
|
95
|
+
{...args}
|
|
96
|
+
style={{ border: '1px solid white', padding: '10px' }}
|
|
97
|
+
flexFlow='column'
|
|
98
|
+
>
|
|
99
|
+
<ReqoreH2>3rd Column</ReqoreH2>
|
|
100
|
+
<ReqoreVerticalSpacer height={20} lineSize='tiny' />
|
|
101
|
+
<ReqoreControlGroup fluid>
|
|
102
|
+
<ReqoreInput placeholder='Filter' />
|
|
103
|
+
</ReqoreControlGroup>
|
|
104
|
+
<ReqoreVerticalSpacer height={10} />
|
|
105
|
+
<ReqoreControlGroup vertical fluid>
|
|
106
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
107
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
108
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
109
|
+
<ReqoreButton description='This is a button'>Button</ReqoreButton>
|
|
110
|
+
</ReqoreControlGroup>
|
|
57
111
|
</ReqoreColumn>
|
|
58
|
-
<ReqoreColumn
|
|
59
|
-
|
|
112
|
+
<ReqoreColumn
|
|
113
|
+
{...args}
|
|
114
|
+
style={{ border: '1px solid white', padding: '10px' }}
|
|
115
|
+
flexFlow='column'
|
|
116
|
+
>
|
|
117
|
+
<ReqoreH2>4th Column</ReqoreH2>
|
|
118
|
+
<ReqoreVerticalSpacer height={20} lineSize='tiny' />
|
|
119
|
+
<ReqoreControlGroup fluid>
|
|
120
|
+
<ReqoreInput placeholder='Filter' />
|
|
121
|
+
</ReqoreControlGroup>
|
|
60
122
|
</ReqoreColumn>
|
|
61
123
|
</>
|
|
62
124
|
)}
|
|
@@ -69,3 +131,14 @@ export const MultipleColumns = Template.bind({});
|
|
|
69
131
|
MultipleColumns.args = {
|
|
70
132
|
multipleColumns: true,
|
|
71
133
|
};
|
|
134
|
+
export const CustomAlignment = Template.bind({});
|
|
135
|
+
CustomAlignment.args = {
|
|
136
|
+
multipleColumns: true,
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const WithMinimumWidth = Template.bind({});
|
|
141
|
+
WithMinimumWidth.args = {
|
|
142
|
+
multipleColumns: true,
|
|
143
|
+
minColumnWidth: '500px',
|
|
144
|
+
};
|