@qoretechnologies/reqore 0.37.0 → 0.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +2 -2
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Drawer/backdrop.d.ts +10 -0
- package/dist/components/Drawer/backdrop.d.ts.map +1 -0
- package/dist/components/Drawer/backdrop.js +59 -0
- package/dist/components/Drawer/backdrop.js.map +1 -0
- package/dist/components/Drawer/index.d.ts +0 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +4 -20
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Navbar/index.d.ts.map +1 -1
- package/dist/components/Navbar/index.js +1 -1
- package/dist/components/Navbar/index.js.map +1 -1
- package/dist/components/Sidebar/index.d.ts.map +1 -1
- package/dist/components/Sidebar/index.js +2 -2
- package/dist/components/Sidebar/index.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +50 -48
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +1 -2
- package/dist/containers/UIProvider.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Collection/item.tsx +4 -5
- package/src/components/Drawer/backdrop.tsx +43 -0
- package/src/components/Drawer/index.tsx +4 -23
- package/src/components/Navbar/index.tsx +1 -0
- package/src/components/Sidebar/index.tsx +3 -4
- package/src/containers/ReqoreProvider.tsx +94 -87
- package/src/containers/UIProvider.tsx +1 -6
- package/src/stories/Drawer/Drawer.stories.tsx +5 -1
- package/src/stories/Modal/Manager.stories.tsx +26 -1
- package/tests.json +1 -1
|
@@ -51,7 +51,6 @@ var Layout_1 = __importDefault(require("../components/Layout"));
|
|
|
51
51
|
var theme_1 = require("../constants/theme");
|
|
52
52
|
var ThemeContext_1 = __importDefault(require("../context/ThemeContext"));
|
|
53
53
|
var colors_1 = require("../helpers/colors");
|
|
54
|
-
var PopoverProvider_1 = __importDefault(require("./PopoverProvider"));
|
|
55
54
|
var ReqoreProvider_1 = __importDefault(require("./ReqoreProvider"));
|
|
56
55
|
var ThemeProvider_1 = __importDefault(require("./ThemeProvider"));
|
|
57
56
|
var GlobalStyle = (0, styled_components_1.createGlobalStyle)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .reqore-blur-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 999998;\n cursor: pointer;\n background-color: ", ";\n backdrop-filter: blur(3px);\n }\n\n .reqore-blur-z-index {\n z-index: 999999;\n }\n"], ["\n .reqore-blur-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 999998;\n cursor: pointer;\n background-color: ", ";\n backdrop-filter: blur(3px);\n }\n\n .reqore-blur-z-index {\n z-index: 999999;\n }\n"])), function (_a) {
|
|
@@ -71,7 +70,7 @@ var ReqoreUIProvider = function (_a) {
|
|
|
71
70
|
var _theme = (0, lodash_1.cloneDeep)(theme || {});
|
|
72
71
|
var _defaultTheme = (0, lodash_1.cloneDeep)(theme_1.DEFAULT_THEME);
|
|
73
72
|
var rebuiltTheme = (0, colors_1.buildTheme)((0, merge_1["default"])(_defaultTheme, _theme));
|
|
74
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(ThemeContext_1["default"].Provider, __assign({ value: __assign({}, rebuiltTheme) }, { children: [(0, jsx_runtime_1.jsx)(ThemeProvider_1["default"], { children: (0, jsx_runtime_1.jsx)(GlobalStyle, {}) }), (0, jsx_runtime_1.jsx)(Layout_1["default"], __assign({ withSidebar: options === null || options === void 0 ? void 0 : options.withSidebar }, { children: modalPortal ? (
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(ThemeContext_1["default"].Provider, __assign({ value: __assign({}, rebuiltTheme) }, { children: [(0, jsx_runtime_1.jsx)(ThemeProvider_1["default"], { children: (0, jsx_runtime_1.jsx)(GlobalStyle, {}) }), (0, jsx_runtime_1.jsx)(Layout_1["default"], __assign({ withSidebar: options === null || options === void 0 ? void 0 : options.withSidebar }, { children: modalPortal ? (0, jsx_runtime_1.jsx)(ReqoreProvider_1["default"], __assign({ options: options }, { children: children })) : null })), (0, jsx_runtime_1.jsx)(ReqorePortal, { ref: setModalPortal })] })) }));
|
|
75
74
|
};
|
|
76
75
|
exports["default"] = ReqoreUIProvider;
|
|
77
76
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIProvider.js","sourceRoot":"","sources":["../../src/containers/UIProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,uDAAiC;AACjC,qCAAgC;AAChC,+BAAoD;AACpD,qEAAmE;AACnE,gEAAuD;AAEvD,4CAAiE;AACjE,yEAAmD;AACnD,4CAAyF;AACzF,
|
|
1
|
+
{"version":3,"file":"UIProvider.js","sourceRoot":"","sources":["../../src/containers/UIProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,uDAAiC;AACjC,qCAAgC;AAChC,+BAAoD;AACpD,qEAAmE;AACnE,gEAAuD;AAEvD,4CAAiE;AACjE,yEAAmD;AACnD,4CAAyF;AACzF,oEAA8C;AAC9C,kEAAkD;AA0BlD,IAAM,WAAW,OAAG,qCAAiB,wVAAA,gLASb,EAAuD,kGAO9E,KAPuB,UAAC,EAAS;QAAP,KAAK,WAAA;IAAO,OAAA,IAAA,eAAI,EAAC,IAAA,+BAAsB,EAAC,KAAK,CAAC,EAAE,GAAG,CAAC;AAAxC,CAAwC,CAO9E,CAAC;AAEF,IAAM,YAAY,GAAG,8BAAM,CAAC,GAAG,8IAAA,qEAO3B,EAED,IACF,KAHG,UAAC,EAAS;QAAP,KAAK,WAAA;IAAO,WAAA,uBAAG,4FAAA,eACT,EAAmD,OAC7D,KADU,IAAA,yBAAgB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC;AAD7C,CAEhB,CACF,CAAC;AAEF,IAAM,YAAY,GAAG,IAAA,kBAAU,EAAyB,UAAC,MAAM,EAAE,GAAG;IAClE,OAAO,CACL,uBAAC,0BAAmB,cAClB,uBAAC,YAAY,IAAC,EAAE,EAAC,eAAe,EAAC,GAAG,EAAE,GAAG,GAAI,GACzB,CACvB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAM,gBAAgB,GAAqC,UAAC,EAA4B;QAA1B,QAAQ,cAAA,EAAE,KAAK,WAAA,EAAE,OAAO,aAAA;IAC9E,IAAA,KAAgC,IAAA,gBAAQ,EAAM,KAAK,CAAC,EAAnD,WAAW,QAAA,EAAE,cAAc,QAAwB,CAAC;IAE3D,IAAM,MAAM,GAA0B,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7D,IAAM,aAAa,GAAiB,IAAA,kBAAS,EAAC,qBAAa,CAAC,CAAC;IAC7D,IAAM,YAAY,GAAiB,IAAA,mBAAU,EAAC,IAAA,kBAAK,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAE5E,OAAO,CACL,2DACE,wBAAC,yBAAY,CAAC,QAAQ,aAAC,KAAK,eAAO,YAAY,kBAC7C,uBAAC,0BAAmB,cAClB,uBAAC,WAAW,KAAG,GACK,EACtB,uBAAC,mBAAmB,aAAC,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,gBACnD,WAAW,CAAC,CAAC,CAAC,uBAAC,2BAAc,aAAC,OAAO,EAAE,OAAO,gBAAG,QAAQ,IAAkB,CAAC,CAAC,CAAC,IAAI,IAC/D,EACtB,uBAAC,YAAY,IAAC,GAAG,EAAE,cAAc,GAAI,KACf,GACvB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,qBAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import styled, { css } from 'styled-components';
|
|
|
6
6
|
import { changeDarkness, getMainBackgroundColor } from '../../helpers/colors';
|
|
7
7
|
import { useReqoreProperty } from '../../hooks/useReqoreContext';
|
|
8
8
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
9
|
-
import {
|
|
9
|
+
import { ReqoreBackdrop } from '../Drawer/backdrop';
|
|
10
10
|
import {
|
|
11
11
|
IReqorePanelAction,
|
|
12
12
|
IReqorePanelBottomAction,
|
|
@@ -150,7 +150,7 @@ export const ReqoreCollectionItem = ({
|
|
|
150
150
|
);
|
|
151
151
|
|
|
152
152
|
const renderContent = () => {
|
|
153
|
-
const handleItemClick = (event) => {
|
|
153
|
+
const handleItemClick = (event?: any) => {
|
|
154
154
|
if (expandable) {
|
|
155
155
|
if (isSelected) {
|
|
156
156
|
setDimensions(originalDimensions.current);
|
|
@@ -194,11 +194,10 @@ export const ReqoreCollectionItem = ({
|
|
|
194
194
|
{position && (
|
|
195
195
|
<>
|
|
196
196
|
<div style={{ ...originalDimensions.current }} />
|
|
197
|
-
<
|
|
197
|
+
<ReqoreBackdrop
|
|
198
198
|
zIndex={getAndIncreaseZIndex()}
|
|
199
199
|
blur={5}
|
|
200
|
-
|
|
201
|
-
onClick={handleItemClick}
|
|
200
|
+
onClose={() => handleItemClick()}
|
|
202
201
|
/>
|
|
203
202
|
</>
|
|
204
203
|
)}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { animated } from '@react-spring/web';
|
|
2
|
+
import { rgba } from 'polished';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { IReqoreDrawerStyle } from '.';
|
|
6
|
+
import { getMainBackgroundColor } from '../../helpers/colors';
|
|
7
|
+
|
|
8
|
+
export interface IReqoreBackdropProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
zIndex?: number;
|
|
10
|
+
blur?: number;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
opacity?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const StyledBackdrop = styled(animated.div)<
|
|
16
|
+
IReqoreDrawerStyle & { closable: boolean; zIndex?: number }
|
|
17
|
+
>`
|
|
18
|
+
position: fixed;
|
|
19
|
+
top: 0;
|
|
20
|
+
bottom: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
backdrop-filter: ${({ blur }) => (blur ? `blur(${blur}px)` : undefined)};
|
|
24
|
+
z-index: ${({ zIndex }) => zIndex};
|
|
25
|
+
background-color: ${({ theme }) => rgba(getMainBackgroundColor(theme), 0.3)};
|
|
26
|
+
cursor: ${({ closable }) => (closable ? 'pointer' : 'initial')};
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const ReqoreBackdrop = memo(
|
|
30
|
+
({ onClose, zIndex, blur, opacity, ...rest }: IReqoreBackdropProps) => (
|
|
31
|
+
<StyledBackdrop
|
|
32
|
+
{...rest}
|
|
33
|
+
className={`${rest.className || ''} reqore-drawer-backdrop`}
|
|
34
|
+
onClick={() => onClose?.()}
|
|
35
|
+
closable={!!onClose}
|
|
36
|
+
zIndex={zIndex}
|
|
37
|
+
blur={blur}
|
|
38
|
+
style={{
|
|
39
|
+
opacity,
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { animated, useTransition } from '@react-spring/web';
|
|
2
|
-
import { rgba } from 'polished';
|
|
3
2
|
import { Resizable } from 're-resizable';
|
|
4
3
|
import { useEffect, useMemo, useState } from 'react';
|
|
5
4
|
import { createPortal } from 'react-dom';
|
|
@@ -8,12 +7,12 @@ import { useReqoreProperty } from '../..';
|
|
|
8
7
|
import { SPRING_CONFIG, SPRING_CONFIG_NO_ANIMATIONS } from '../../constants/animations';
|
|
9
8
|
import { IReqoreTheme } from '../../constants/theme';
|
|
10
9
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
11
|
-
import { getMainBackgroundColor } from '../../helpers/colors';
|
|
12
10
|
import useLatestZIndex from '../../hooks/useLatestZIndex';
|
|
13
11
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
14
12
|
import { IReqoreIconName } from '../../types/icons';
|
|
15
13
|
import ReqoreButton from '../Button';
|
|
16
14
|
import { IReqorePanelAction, IReqorePanelProps, ReqorePanel } from '../Panel';
|
|
15
|
+
import { ReqoreBackdrop } from './backdrop';
|
|
17
16
|
|
|
18
17
|
export type TPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
19
18
|
|
|
@@ -97,20 +96,6 @@ export const StyledCloseWrapper = styled.div<IReqoreDrawerStyle>`
|
|
|
97
96
|
|
|
98
97
|
export const StyledDrawerResizable = styled(animated.div)``;
|
|
99
98
|
|
|
100
|
-
export const StyledBackdrop = styled(animated.div)<
|
|
101
|
-
IReqoreDrawerStyle & { closable: boolean; zIndex?: number }
|
|
102
|
-
>`
|
|
103
|
-
position: fixed;
|
|
104
|
-
top: 0;
|
|
105
|
-
bottom: 0;
|
|
106
|
-
right: 0;
|
|
107
|
-
left: 0;
|
|
108
|
-
backdrop-filter: ${({ blur }) => (blur ? `blur(${blur}px)` : undefined)};
|
|
109
|
-
z-index: ${({ zIndex }) => zIndex};
|
|
110
|
-
background-color: ${({ theme }) => rgba(getMainBackgroundColor(theme), 0.3)};
|
|
111
|
-
cursor: ${({ closable }) => (closable ? 'pointer' : 'initial')};
|
|
112
|
-
`;
|
|
113
|
-
|
|
114
99
|
/**
|
|
115
100
|
* It returns an icon name based on the position and whether the panel is hidden or not
|
|
116
101
|
* @param {'top' | 'bottom' | 'left' | 'right'} position - The position of the panel.
|
|
@@ -245,15 +230,11 @@ export const ReqoreDrawer: React.FC<IReqoreDrawerProps> = ({
|
|
|
245
230
|
item ? (
|
|
246
231
|
<ReqoreThemeProvider theme={theme}>
|
|
247
232
|
{hasBackdrop && !_isHidden ? (
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
onClick={() => onClose && onClose()}
|
|
251
|
-
closable={!!onClose}
|
|
233
|
+
<ReqoreBackdrop
|
|
234
|
+
onClose={onClose}
|
|
252
235
|
zIndex={zIndex}
|
|
253
236
|
blur={blur}
|
|
254
|
-
|
|
255
|
-
opacity: styles.opacity,
|
|
256
|
-
}}
|
|
237
|
+
opacity={styles.opacity}
|
|
257
238
|
/>
|
|
258
239
|
) : null}
|
|
259
240
|
<Resizable
|
|
@@ -20,6 +20,7 @@ export interface IReqoreNavbarStyle extends IReqoreNavbarProps {
|
|
|
20
20
|
export const StyledNavbar = styled.div<IReqoreNavbarStyle>`
|
|
21
21
|
${({ theme, type }: IReqoreNavbarStyle) => css`
|
|
22
22
|
height: 50px;
|
|
23
|
+
flex-shrink: 0;
|
|
23
24
|
width: 100%;
|
|
24
25
|
padding: 0 10px;
|
|
25
26
|
color: ${theme[type]?.color ||
|
|
@@ -13,7 +13,7 @@ import useLatestZIndex from '../../hooks/useLatestZIndex';
|
|
|
13
13
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
14
14
|
import { ActiveIconScale, InactiveIconScale, ScaleIconOnHover } from '../../styles';
|
|
15
15
|
import { IReqoreIconName } from '../../types/icons';
|
|
16
|
-
import {
|
|
16
|
+
import { ReqoreBackdrop } from '../Drawer/backdrop';
|
|
17
17
|
import ReqoreIcon from '../Icon';
|
|
18
18
|
import SidebarItem from './item';
|
|
19
19
|
|
|
@@ -423,10 +423,9 @@ const ReqoreSidebar: React.FC<IQorusSidebarProps> = ({
|
|
|
423
423
|
return (
|
|
424
424
|
<>
|
|
425
425
|
{floating && hasFloatingBackdrop && isOpen ? (
|
|
426
|
-
<
|
|
426
|
+
<ReqoreBackdrop
|
|
427
427
|
className='reqore-sidebar-backdrop'
|
|
428
|
-
|
|
429
|
-
closable
|
|
428
|
+
onClose={() => onCloseClick?.()}
|
|
430
429
|
zIndex={zIndex}
|
|
431
430
|
/>
|
|
432
431
|
) : null}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { map, size } from 'lodash';
|
|
2
2
|
import React, { useCallback, useRef, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
3
4
|
import { useMedia } from 'react-use';
|
|
4
5
|
import shortid from 'shortid';
|
|
5
6
|
import { useContext } from 'use-context-selector';
|
|
@@ -13,6 +14,7 @@ import { IReqoreTheme, TReqoreIntent } from '../constants/theme';
|
|
|
13
14
|
import ReqoreContext from '../context/ReqoreContext';
|
|
14
15
|
import ThemeContext from '../context/ThemeContext';
|
|
15
16
|
import { IReqoreIconName } from '../types/icons';
|
|
17
|
+
import PopoverProvider from './PopoverProvider';
|
|
16
18
|
import { IReqoreOptions } from './UIProvider';
|
|
17
19
|
|
|
18
20
|
export interface IReqoreNotificationData extends IReqoreNotificationProps {
|
|
@@ -159,99 +161,104 @@ const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, options = {}
|
|
|
159
161
|
'closePopoversOnEscPress' in options ? options.closePopoversOnEscPress : true,
|
|
160
162
|
}}
|
|
161
163
|
>
|
|
162
|
-
{
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
onClose={() => {
|
|
174
|
-
if (notification.onClose) {
|
|
175
|
-
notification.onClose(notification.id);
|
|
164
|
+
<PopoverProvider uiScale={options?.uiScale}>
|
|
165
|
+
{size(notifications) > 0 ? (
|
|
166
|
+
<ReqoreNotificationsWrapper position={options.notificationsPosition}>
|
|
167
|
+
{notifications.map((notification) => (
|
|
168
|
+
<ReqoreNotification
|
|
169
|
+
{...notification}
|
|
170
|
+
key={notification.id}
|
|
171
|
+
onClick={
|
|
172
|
+
notification.onClick
|
|
173
|
+
? () => void notification.onClick(notification.id)
|
|
174
|
+
: undefined
|
|
176
175
|
}
|
|
176
|
+
onClose={() => {
|
|
177
|
+
if (notification.onClose) {
|
|
178
|
+
notification.onClose(notification.id);
|
|
179
|
+
}
|
|
177
180
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
removeNotification(notification.id);
|
|
182
|
+
}}
|
|
183
|
+
onFinish={() => {
|
|
184
|
+
if (notification.onFinish) {
|
|
185
|
+
notification.onFinish(notification.id);
|
|
186
|
+
}
|
|
184
187
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
188
|
+
removeNotification(notification.id);
|
|
189
|
+
}}
|
|
190
|
+
/>
|
|
191
|
+
))}
|
|
192
|
+
</ReqoreNotificationsWrapper>
|
|
193
|
+
) : null}
|
|
194
|
+
{children}
|
|
195
|
+
{confirmationModal.isOpen && (
|
|
196
|
+
<ReqoreModal
|
|
197
|
+
isOpen
|
|
198
|
+
flat
|
|
199
|
+
opacity={0.9}
|
|
200
|
+
blur={2}
|
|
201
|
+
width='500px'
|
|
202
|
+
intent={confirmationModal.intent}
|
|
203
|
+
label={confirmationModal.title || 'Confirm your action'}
|
|
204
|
+
icon='ErrorWarningFill'
|
|
205
|
+
className='reqore-confirmation-modal'
|
|
206
|
+
bottomActions={[
|
|
207
|
+
{
|
|
208
|
+
label: confirmationModal.cancelLabel || 'Cancel',
|
|
209
|
+
icon: 'CloseLine',
|
|
210
|
+
onClick: () => {
|
|
211
|
+
confirmationModal?.onCancel?.();
|
|
212
|
+
closeConfirmationModal();
|
|
213
|
+
},
|
|
214
|
+
position: 'left',
|
|
210
215
|
},
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
{
|
|
217
|
+
label: confirmationModal.confirmLabel || 'Confirm',
|
|
218
|
+
intent: confirmationModal.confirmButtonIntent || 'success',
|
|
219
|
+
icon: confirmationModal.confirmIcon || 'CheckLine',
|
|
220
|
+
onClick: () => {
|
|
221
|
+
confirmationModal?.onConfirm?.();
|
|
222
|
+
closeConfirmationModal();
|
|
223
|
+
},
|
|
224
|
+
position: 'right',
|
|
220
225
|
},
|
|
221
|
-
|
|
222
|
-
},
|
|
223
|
-
]}
|
|
224
|
-
>
|
|
225
|
-
<ReqoreTextEffect
|
|
226
|
-
as='p'
|
|
227
|
-
effect={{ textAlign: 'center', weight: 'bold', textSize: 'big' }}
|
|
226
|
+
]}
|
|
228
227
|
>
|
|
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
|
-
|
|
228
|
+
<ReqoreTextEffect
|
|
229
|
+
as='p'
|
|
230
|
+
effect={{ textAlign: 'center', weight: 'bold', textSize: 'big' }}
|
|
231
|
+
>
|
|
232
|
+
{confirmationModal.description || 'Are you sure you want to proceed?'}
|
|
233
|
+
</ReqoreTextEffect>
|
|
234
|
+
</ReqoreModal>
|
|
235
|
+
)}
|
|
236
|
+
{map(modals, (modal, key) =>
|
|
237
|
+
React.isValidElement(modal) ? (
|
|
238
|
+
createPortal(
|
|
239
|
+
React.cloneElement(modal, {
|
|
240
|
+
key,
|
|
241
|
+
isOpen: true,
|
|
242
|
+
onClose: () => {
|
|
243
|
+
removeModal(key);
|
|
244
|
+
modal.props.onClose?.();
|
|
245
|
+
},
|
|
246
|
+
}),
|
|
247
|
+
document.querySelector('#reqore-portal')!
|
|
248
|
+
)
|
|
249
|
+
) : (
|
|
250
|
+
<ReqoreModal
|
|
251
|
+
{...modal}
|
|
252
|
+
key={key}
|
|
253
|
+
isOpen
|
|
254
|
+
onClose={() => {
|
|
255
|
+
removeModal(key);
|
|
256
|
+
modal.onClose?.();
|
|
257
|
+
}}
|
|
258
|
+
/>
|
|
259
|
+
)
|
|
260
|
+
)}
|
|
261
|
+
</PopoverProvider>
|
|
255
262
|
</ReqoreContext.Provider>
|
|
256
263
|
</>
|
|
257
264
|
);
|
|
@@ -8,7 +8,6 @@ import { IReqoreNotificationsPosition } from '../components/Notifications';
|
|
|
8
8
|
import { DEFAULT_THEME, IReqoreTheme } from '../constants/theme';
|
|
9
9
|
import ThemeContext from '../context/ThemeContext';
|
|
10
10
|
import { buildTheme, getMainBackgroundColor, getReadableColor } from '../helpers/colors';
|
|
11
|
-
import PopoverProvider from './PopoverProvider';
|
|
12
11
|
import ReqoreProvider from './ReqoreProvider';
|
|
13
12
|
import ReqoreThemeProvider from './ThemeProvider';
|
|
14
13
|
|
|
@@ -88,11 +87,7 @@ const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = ({ children, theme, o
|
|
|
88
87
|
<GlobalStyle />
|
|
89
88
|
</ReqoreThemeProvider>
|
|
90
89
|
<ReqoreLayoutWrapper withSidebar={options?.withSidebar}>
|
|
91
|
-
{modalPortal ?
|
|
92
|
-
<ReqoreProvider options={options}>
|
|
93
|
-
<PopoverProvider uiScale={options?.uiScale}>{children}</PopoverProvider>
|
|
94
|
-
</ReqoreProvider>
|
|
95
|
-
) : null}
|
|
90
|
+
{modalPortal ? <ReqoreProvider options={options}>{children}</ReqoreProvider> : null}
|
|
96
91
|
</ReqoreLayoutWrapper>
|
|
97
92
|
<ReqorePortal ref={setModalPortal} />
|
|
98
93
|
</ThemeContext.Provider>
|
|
@@ -4,6 +4,7 @@ import { IReqoreDrawerProps, ReqoreDrawer } from '../../components/Drawer';
|
|
|
4
4
|
import { IReqoreInputProps } from '../../components/Input';
|
|
5
5
|
import {
|
|
6
6
|
ReqoreButton,
|
|
7
|
+
ReqoreCollection,
|
|
7
8
|
ReqoreInput,
|
|
8
9
|
ReqorePanel,
|
|
9
10
|
ReqoreTabs,
|
|
@@ -246,7 +247,10 @@ const Template: StoryFn<typeof ReqoreDrawer> = (args) => {
|
|
|
246
247
|
Hello I am a super long button that opens a modal on click
|
|
247
248
|
</ReqoreButton>
|
|
248
249
|
</ReqoreTabsContent>
|
|
249
|
-
<ReqoreTabsContent tabId='tab2'>
|
|
250
|
+
<ReqoreTabsContent tabId='tab2'>
|
|
251
|
+
Tab 2 here
|
|
252
|
+
<ReqoreCollection items={[{ label: 'Item 1' }, { label: 'Item 2' }]} />
|
|
253
|
+
</ReqoreTabsContent>
|
|
250
254
|
</ReqoreTabs>
|
|
251
255
|
</ReqoreDrawer>
|
|
252
256
|
</>
|
|
@@ -3,8 +3,10 @@ import { StoryObj } from '@storybook/react';
|
|
|
3
3
|
import { fireEvent, waitFor, within } from '@storybook/testing-library';
|
|
4
4
|
import { noop } from 'lodash';
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
|
+
import { ReqoreBackdrop } from '../../components/Drawer/backdrop';
|
|
6
7
|
import {
|
|
7
8
|
ReqoreButton,
|
|
9
|
+
ReqoreCollection,
|
|
8
10
|
ReqoreControlGroup,
|
|
9
11
|
ReqoreInput,
|
|
10
12
|
ReqoreModal,
|
|
@@ -86,11 +88,15 @@ const ModalWithState = (props) => {
|
|
|
86
88
|
intent={props.intent}
|
|
87
89
|
onChange={(e: any) => setText(e.target.value)}
|
|
88
90
|
/>
|
|
89
|
-
<ReqoreButton
|
|
91
|
+
<ReqoreButton
|
|
92
|
+
onClick={() => addModal(<ModalWithState label='Another modal' />)}
|
|
93
|
+
tooltip='Open sesame'
|
|
94
|
+
>
|
|
90
95
|
Open another modal
|
|
91
96
|
</ReqoreButton>
|
|
92
97
|
<ReqoreButton onClick={() => removeModal('modal')}>Remove modal</ReqoreButton>
|
|
93
98
|
</ReqoreControlGroup>
|
|
99
|
+
<ReqoreCollection items={[{ label: 'Item 1' }, { label: 'Item 2' }]} />
|
|
94
100
|
</ReqoreModal>
|
|
95
101
|
);
|
|
96
102
|
};
|
|
@@ -104,6 +110,25 @@ export const FromElement: Story = {
|
|
|
104
110
|
},
|
|
105
111
|
};
|
|
106
112
|
|
|
113
|
+
export const FromCustomElement: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
data: (
|
|
116
|
+
<>
|
|
117
|
+
<ReqoreBackdrop />
|
|
118
|
+
<div
|
|
119
|
+
className='custom-modal reqore-modal'
|
|
120
|
+
style={{ position: 'absolute', left: '50%', top: '50%' }}
|
|
121
|
+
>
|
|
122
|
+
This is a custom modal
|
|
123
|
+
</div>
|
|
124
|
+
</>
|
|
125
|
+
),
|
|
126
|
+
},
|
|
127
|
+
play: async ({ canvasElement, ...rest }) => {
|
|
128
|
+
await FromObject.play({ canvasElement, ...rest });
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
107
132
|
export const CanBeClosed: Story = {
|
|
108
133
|
...FromObject,
|
|
109
134
|
play: async ({ canvasElement, ...rest }) => {
|