@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.
Files changed (34) hide show
  1. package/dist/components/Collection/item.d.ts.map +1 -1
  2. package/dist/components/Collection/item.js +2 -2
  3. package/dist/components/Collection/item.js.map +1 -1
  4. package/dist/components/Drawer/backdrop.d.ts +10 -0
  5. package/dist/components/Drawer/backdrop.d.ts.map +1 -0
  6. package/dist/components/Drawer/backdrop.js +59 -0
  7. package/dist/components/Drawer/backdrop.js.map +1 -0
  8. package/dist/components/Drawer/index.d.ts +0 -1
  9. package/dist/components/Drawer/index.d.ts.map +1 -1
  10. package/dist/components/Drawer/index.js +4 -20
  11. package/dist/components/Drawer/index.js.map +1 -1
  12. package/dist/components/Navbar/index.d.ts.map +1 -1
  13. package/dist/components/Navbar/index.js +1 -1
  14. package/dist/components/Navbar/index.js.map +1 -1
  15. package/dist/components/Sidebar/index.d.ts.map +1 -1
  16. package/dist/components/Sidebar/index.js +2 -2
  17. package/dist/components/Sidebar/index.js.map +1 -1
  18. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  19. package/dist/containers/ReqoreProvider.js +50 -48
  20. package/dist/containers/ReqoreProvider.js.map +1 -1
  21. package/dist/containers/UIProvider.d.ts.map +1 -1
  22. package/dist/containers/UIProvider.js +1 -2
  23. package/dist/containers/UIProvider.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/components/Collection/item.tsx +4 -5
  26. package/src/components/Drawer/backdrop.tsx +43 -0
  27. package/src/components/Drawer/index.tsx +4 -23
  28. package/src/components/Navbar/index.tsx +1 -0
  29. package/src/components/Sidebar/index.tsx +3 -4
  30. package/src/containers/ReqoreProvider.tsx +94 -87
  31. package/src/containers/UIProvider.tsx +1 -6
  32. package/src/stories/Drawer/Drawer.stories.tsx +5 -1
  33. package/src/stories/Modal/Manager.stories.tsx +26 -1
  34. 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 ? ((0, jsx_runtime_1.jsx)(ReqoreProvider_1["default"], __assign({ options: options }, { children: (0, jsx_runtime_1.jsx)(PopoverProvider_1["default"], __assign({ uiScale: options === null || options === void 0 ? void 0 : options.uiScale }, { children: children })) }))) : null })), (0, jsx_runtime_1.jsx)(ReqorePortal, { ref: setModalPortal })] })) }));
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,sEAAgD;AAChD,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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AAM,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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoretechnologies/reqore",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "ReQore is a highly theme-able and modular UI library for React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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 { StyledBackdrop } from '../Drawer';
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
- <StyledBackdrop
197
+ <ReqoreBackdrop
198
198
  zIndex={getAndIncreaseZIndex()}
199
199
  blur={5}
200
- closable
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
- <StyledBackdrop
249
- className='reqore-drawer-backdrop'
250
- onClick={() => onClose && onClose()}
251
- closable={!!onClose}
233
+ <ReqoreBackdrop
234
+ onClose={onClose}
252
235
  zIndex={zIndex}
253
236
  blur={blur}
254
- style={{
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 { StyledBackdrop } from '../Drawer';
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
- <StyledBackdrop
426
+ <ReqoreBackdrop
427
427
  className='reqore-sidebar-backdrop'
428
- onClick={() => onCloseClick?.()}
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
- {size(notifications) > 0 ? (
163
- <ReqoreNotificationsWrapper position={options.notificationsPosition}>
164
- {notifications.map((notification) => (
165
- <ReqoreNotification
166
- {...notification}
167
- key={notification.id}
168
- onClick={
169
- notification.onClick
170
- ? () => void notification.onClick(notification.id)
171
- : undefined
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
- removeNotification(notification.id);
179
- }}
180
- onFinish={() => {
181
- if (notification.onFinish) {
182
- notification.onFinish(notification.id);
183
- }
181
+ removeNotification(notification.id);
182
+ }}
183
+ onFinish={() => {
184
+ if (notification.onFinish) {
185
+ notification.onFinish(notification.id);
186
+ }
184
187
 
185
- removeNotification(notification.id);
186
- }}
187
- />
188
- ))}
189
- </ReqoreNotificationsWrapper>
190
- ) : null}
191
- {children}
192
- {confirmationModal.isOpen && (
193
- <ReqoreModal
194
- isOpen
195
- flat
196
- opacity={0.9}
197
- blur={2}
198
- width='500px'
199
- intent={confirmationModal.intent}
200
- label={confirmationModal.title || 'Confirm your action'}
201
- icon='ErrorWarningFill'
202
- className='reqore-confirmation-modal'
203
- bottomActions={[
204
- {
205
- label: confirmationModal.cancelLabel || 'Cancel',
206
- icon: 'CloseLine',
207
- onClick: () => {
208
- confirmationModal?.onCancel?.();
209
- closeConfirmationModal();
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
- position: 'left',
212
- },
213
- {
214
- label: confirmationModal.confirmLabel || 'Confirm',
215
- intent: confirmationModal.confirmButtonIntent || 'success',
216
- icon: confirmationModal.confirmIcon || 'CheckLine',
217
- onClick: () => {
218
- confirmationModal?.onConfirm?.();
219
- closeConfirmationModal();
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
- position: 'right',
222
- },
223
- ]}
224
- >
225
- <ReqoreTextEffect
226
- as='p'
227
- effect={{ textAlign: 'center', weight: 'bold', textSize: 'big' }}
226
+ ]}
228
227
  >
229
- {confirmationModal.description || 'Are you sure you want to proceed?'}
230
- </ReqoreTextEffect>
231
- </ReqoreModal>
232
- )}
233
- {map(modals, (modal, key) =>
234
- React.isValidElement(modal) ? (
235
- React.cloneElement(modal, {
236
- key,
237
- isOpen: true,
238
- onClose: () => {
239
- removeModal(key);
240
- modal.props.onClose?.();
241
- },
242
- })
243
- ) : (
244
- <ReqoreModal
245
- {...modal}
246
- key={key}
247
- isOpen
248
- onClose={() => {
249
- removeModal(key);
250
- modal.onClose?.();
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'>Tab 2 here</ReqoreTabsContent>
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 onClick={() => addModal(<ModalWithState label='Another modal' />)}>
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 }) => {