@qoretechnologies/reqore 0.37.6 → 0.37.8

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 (43) hide show
  1. package/dist/components/Button/index.d.ts +3 -0
  2. package/dist/components/Button/index.d.ts.map +1 -1
  3. package/dist/components/Button/index.js +4 -4
  4. package/dist/components/Button/index.js.map +1 -1
  5. package/dist/components/Drawer/backdrop.d.ts.map +1 -1
  6. package/dist/components/Drawer/backdrop.js +3 -1
  7. package/dist/components/Drawer/backdrop.js.map +1 -1
  8. package/dist/components/Effect/index.d.ts +1 -0
  9. package/dist/components/Effect/index.d.ts.map +1 -1
  10. package/dist/components/Effect/index.js +2 -1
  11. package/dist/components/Effect/index.js.map +1 -1
  12. package/dist/components/Icon/index.d.ts +1 -0
  13. package/dist/components/Icon/index.d.ts.map +1 -1
  14. package/dist/components/Icon/index.js +5 -2
  15. package/dist/components/Icon/index.js.map +1 -1
  16. package/dist/components/Message/index.d.ts +2 -0
  17. package/dist/components/Message/index.d.ts.map +1 -1
  18. package/dist/components/Message/index.js +2 -2
  19. package/dist/components/Message/index.js.map +1 -1
  20. package/dist/components/Spinner/index.d.ts +3 -1
  21. package/dist/components/Spinner/index.d.ts.map +1 -1
  22. package/dist/components/Spinner/index.js +2 -2
  23. package/dist/components/Spinner/index.js.map +1 -1
  24. package/dist/components/Tag/index.d.ts +3 -0
  25. package/dist/components/Tag/index.d.ts.map +1 -1
  26. package/dist/components/Tag/index.js +2 -2
  27. package/dist/components/Tag/index.js.map +1 -1
  28. package/dist/containers/UIProvider.d.ts.map +1 -1
  29. package/dist/containers/UIProvider.js +8 -8
  30. package/dist/containers/UIProvider.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/components/Button/index.tsx +8 -2
  33. package/src/components/Drawer/backdrop.tsx +23 -18
  34. package/src/components/Effect/index.tsx +7 -3
  35. package/src/components/Icon/index.tsx +4 -2
  36. package/src/components/Message/index.tsx +5 -1
  37. package/src/components/Spinner/index.tsx +4 -0
  38. package/src/components/Tag/index.tsx +7 -1
  39. package/src/containers/UIProvider.tsx +18 -16
  40. package/src/stories/Button/Button.stories.tsx +2 -0
  41. package/src/stories/Icon/Icon.stories.tsx +13 -0
  42. package/src/stories/Modal/Manager.stories.tsx +13 -1
  43. package/tests.json +1 -1
@@ -57,21 +57,21 @@ var GlobalStyle = (0, styled_components_1.createGlobalStyle)(templateObject_1 ||
57
57
  var theme = _a.theme;
58
58
  return (0, polished_1.rgba)((0, colors_1.getMainBackgroundColor)(theme), 0.3);
59
59
  });
60
- var StyledPortal = styled_components_1["default"].div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n z-index: 9999;\n position: relative;\n\n * {\n box-sizing: border-box;\n }\n\n ", "\n"], ["\n z-index: 9999;\n position: relative;\n\n * {\n box-sizing: border-box;\n }\n\n ", "\n"])), function (_a) {
60
+ var StyledPortal = styled_components_1["default"].div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n * {\n box-sizing: border-box;\n }\n\n ", "\n"], ["\n * {\n box-sizing: border-box;\n }\n\n ", "\n"])), function (_a) {
61
61
  var theme = _a.theme;
62
62
  return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), (0, colors_1.getReadableColor)(theme, undefined, undefined, true));
63
63
  });
64
- var ReqorePortal = (0, react_1.forwardRef)(function (_props, ref) {
64
+ var ReqorePortal = (0, react_1.memo)((0, react_1.forwardRef)(function (_props, ref) {
65
65
  return ((0, jsx_runtime_1.jsx)(ThemeProvider_1["default"], { children: (0, jsx_runtime_1.jsx)(StyledPortal, { id: 'reqore-portal', ref: ref }) }));
66
- });
67
- var ReqoreUIProvider = function (_a) {
66
+ }));
67
+ var ReqoreUIProvider = (0, react_1.memo)(function (_a) {
68
68
  var children = _a.children, theme = _a.theme, options = _a.options;
69
69
  var _b = (0, react_1.useState)(false), modalPortal = _b[0], setModalPortal = _b[1];
70
- var _theme = (0, lodash_1.cloneDeep)(theme || {});
71
- var _defaultTheme = (0, lodash_1.cloneDeep)(theme_1.DEFAULT_THEME);
72
- var rebuiltTheme = (0, colors_1.buildTheme)((0, merge_1["default"])(_defaultTheme, _theme));
70
+ var _theme = (0, react_1.useMemo)(function () { return (0, lodash_1.cloneDeep)(theme || {}); }, [theme]);
71
+ var _defaultTheme = (0, react_1.useMemo)(function () { return (0, lodash_1.cloneDeep)(theme_1.DEFAULT_THEME); }, [theme_1.DEFAULT_THEME]);
72
+ var rebuiltTheme = (0, react_1.useMemo)(function () { return (0, colors_1.buildTheme)((0, merge_1["default"])(_defaultTheme, _theme)); }, [_defaultTheme, _theme]);
73
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 })] })) }));
74
- };
74
+ });
75
75
  exports["default"] = ReqoreUIProvider;
76
76
  var templateObject_1, templateObject_2, templateObject_3;
77
77
  //# sourceMappingURL=UIProvider.js.map
@@ -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,oEAA8C;AAC9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qBAAe,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoretechnologies/reqore",
3
- "version": "0.37.6",
3
+ "version": "0.37.8",
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",
@@ -43,7 +43,7 @@ import {
43
43
  TReqoreEffectColor,
44
44
  TReqoreHexColor,
45
45
  } from '../Effect';
46
- import ReqoreIcon from '../Icon';
46
+ import ReqoreIcon, { IReqoreIconProps } from '../Icon';
47
47
  import { ReqoreHorizontalSpacer, ReqoreSpacer } from '../Spacer';
48
48
  import ReqoreTag, { IReqoreTagProps } from '../Tag';
49
49
  import ReqoreTagGroup from '../Tag/group';
@@ -75,6 +75,8 @@ export interface IReqoreButtonProps
75
75
  iconColor?: TReqoreEffectColor;
76
76
  leftIconColor?: TReqoreEffectColor;
77
77
  rightIconColor?: TReqoreEffectColor;
78
+ leftIconProps?: IReqoreIconProps;
79
+ rightIconProps?: IReqoreIconProps;
78
80
  labelEffect?: IReqoreEffect;
79
81
  descriptionEffect?: IReqoreEffect;
80
82
  label?: React.HTMLAttributes<HTMLButtonElement>['children'];
@@ -356,6 +358,8 @@ const ReqoreButton = memo(
356
358
  rightIconColor,
357
359
  iconColor,
358
360
  iconsAlign,
361
+ leftIconProps,
362
+ rightIconProps,
359
363
  label,
360
364
  as,
361
365
  ...rest
@@ -421,6 +425,7 @@ const ReqoreButton = memo(
421
425
  icon={icon}
422
426
  size={size}
423
427
  color={leftIconColor || iconColor}
428
+ {...leftIconProps}
424
429
  style={
425
430
  textAlign !== 'left' || iconsAlign === 'center'
426
431
  ? {
@@ -478,6 +483,8 @@ const ReqoreButton = memo(
478
483
  <ReqoreIcon
479
484
  icon={rightIcon}
480
485
  size={size}
486
+ color={rightIconColor || iconColor}
487
+ {...rightIconProps}
481
488
  style={
482
489
  textAlign !== 'right' || iconsAlign === 'center'
483
490
  ? {
@@ -489,7 +496,6 @@ const ReqoreButton = memo(
489
496
  }
490
497
  : undefined
491
498
  }
492
- color={rightIconColor || iconColor}
493
499
  />
494
500
  </>
495
501
  )}
@@ -3,6 +3,7 @@ import { rgba } from 'polished';
3
3
  import { memo } from 'react';
4
4
  import styled from 'styled-components';
5
5
  import { IReqoreDrawerStyle } from '.';
6
+ import { useReqoreProperty } from '../..';
6
7
  import { getMainBackgroundColor } from '../../helpers/colors';
7
8
 
8
9
  export interface IReqoreBackdropProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -27,22 +28,26 @@ export const StyledBackdrop = styled(animated.div)<
27
28
  `;
28
29
 
29
30
  export const ReqoreBackdrop = memo(
30
- ({ onClose, zIndex, blur, opacity, ...rest }: IReqoreBackdropProps) => (
31
- <StyledBackdrop
32
- {...rest}
33
- className={`${rest.className || ''} reqore-drawer-backdrop`}
34
- onClick={(event) => {
35
- // Only close if the click is on the backdrop itself
36
- if (event.target === event.currentTarget) {
37
- onClose?.();
38
- }
39
- }}
40
- closable={!!onClose}
41
- zIndex={zIndex}
42
- blur={blur}
43
- style={{
44
- opacity,
45
- }}
46
- />
47
- )
31
+ ({ onClose, zIndex, blur, opacity, ...rest }: IReqoreBackdropProps) => {
32
+ const getAndIncreaseZIndex = useReqoreProperty('getAndIncreaseZIndex');
33
+
34
+ return (
35
+ <StyledBackdrop
36
+ {...rest}
37
+ className={`${rest.className || ''} reqore-drawer-backdrop`}
38
+ onClick={(event) => {
39
+ // Only close if the click is on the backdrop itself
40
+ if (event.target === event.currentTarget) {
41
+ onClose?.();
42
+ }
43
+ }}
44
+ closable={!!onClose}
45
+ zIndex={zIndex || getAndIncreaseZIndex()}
46
+ blur={blur}
47
+ style={{
48
+ opacity,
49
+ }}
50
+ />
51
+ );
52
+ }
48
53
  );
@@ -74,6 +74,7 @@ export interface IReqoreEffect extends IReqoreEffectFilters {
74
74
  color: TReqoreEffectColor;
75
75
  inset?: boolean;
76
76
  blur?: number;
77
+ opacity?: number;
77
78
  };
78
79
  interactive?: boolean;
79
80
  }
@@ -233,12 +234,15 @@ export const StyledEffect = styled.span`
233
234
  effect.glow.color === 'main' ? 'main:lighten:2' : effect.glow.color
234
235
  );
235
236
  const blur = effect.glow.blur || 0;
237
+ const opacity = effect.glow.opacity || 1;
236
238
 
237
239
  return css`
238
240
  color: ${Colors.LIGHT};
239
- text-shadow: 0 0 ${blur}px ${color}, 0 0 ${blur + 5}px ${color}, 0 0 ${blur + 10}px ${color},
240
- 0 0 1px ${getReadableColorFrom(color)}, 0 0 2px ${getReadableColorFrom(color)},
241
- 0 0 3px ${getReadableColorFrom(color)};
241
+ text-shadow: 0 0 ${blur}px ${rgba(color, opacity)}, 0 0 ${blur + 5}px ${rgba(color, opacity)},
242
+ 0 0 ${blur + 10}px ${rgba(color, opacity)},
243
+ 0 0 1px ${rgba(getReadableColorFrom(color), opacity)},
244
+ 0 0 2px ${rgba(getReadableColorFrom(color), opacity)},
245
+ 0 0 3px ${rgba(getReadableColorFrom(color), opacity)};
242
246
  `;
243
247
  }}
244
248
 
@@ -27,15 +27,16 @@ export interface IReqoreIconProps
27
27
  margin?: 'right' | 'left' | 'both';
28
28
  image?: string;
29
29
  rounded?: boolean;
30
+ rotation?: number;
30
31
  animation?: 'spin' | 'heartbeat';
31
32
  }
32
33
 
33
34
  const SpinKeyframes = keyframes`
34
35
  0% {
35
- transform: rotate(0deg);
36
+ rotate: 0deg;
36
37
  }
37
38
  100% {
38
- transform: rotate(360deg);
39
+ rotate: 360deg;
39
40
  }
40
41
  `;
41
42
 
@@ -49,6 +50,7 @@ export const StyledIconWrapper = styled(StyledEffect)<{ margin: 'right' | 'left'
49
50
  overflow: hidden;
50
51
 
51
52
  border-radius: ${({ rounded }) => (rounded ? '50%' : undefined)};
53
+ rotate: ${({ rotation }) => (rotation ? `${rotation}deg` : undefined)};
52
54
 
53
55
  ${({ margin, size }) =>
54
56
  margin &&
@@ -21,7 +21,7 @@ import {
21
21
  import { IReqoreIconName } from '../../types/icons';
22
22
  import { TReqoreEffectColor } from '../Effect';
23
23
  import { ReqoreHeading } from '../Header';
24
- import ReqoreIcon from '../Icon';
24
+ import ReqoreIcon, { IReqoreIconProps } from '../Icon';
25
25
  import {
26
26
  StyledIconWrapper,
27
27
  StyledNotificationContent,
@@ -46,6 +46,7 @@ export interface IReqoreMessageProps
46
46
  children: any;
47
47
  icon?: IReqoreIconName;
48
48
  iconColor?: TReqoreEffectColor;
49
+ iconProps?: IReqoreIconProps;
49
50
  onClose?: () => any;
50
51
  onClick?: () => any;
51
52
  duration?: number;
@@ -81,6 +82,7 @@ const ReqoreMessage = memo(
81
82
  tooltip,
82
83
  fixed,
83
84
  fluid,
85
+ iconProps,
84
86
  ...rest
85
87
  },
86
88
  ref
@@ -159,6 +161,7 @@ const ReqoreMessage = memo(
159
161
  iconColor={iconColor}
160
162
  type={5}
161
163
  iconMargin={flat && minimal ? 'right' : 'both'}
164
+ iconProps={iconProps}
162
165
  />
163
166
  ) : (
164
167
  <ReqoreIcon
@@ -166,6 +169,7 @@ const ReqoreMessage = memo(
166
169
  margin={flat && minimal ? 'right' : 'both'}
167
170
  size={size}
168
171
  color={iconColor}
172
+ {...iconProps}
169
173
  />
170
174
  )}
171
175
  </StyledIconWrapper>
@@ -5,6 +5,7 @@ import { TReqoreIntent } from '../../constants/theme';
5
5
  import { IWithReqoreEffect } from '../../types/global';
6
6
  import ReqoreControlGroup, { IReqoreControlGroupProps } from '../ControlGroup';
7
7
  import { IReqoreEffect, TReqoreEffectColor } from '../Effect';
8
+ import { IReqoreIconProps } from '../Icon';
8
9
 
9
10
  export interface IReqoreSpinnerProps
10
11
  extends Omit<IReqoreControlGroupProps, 'children' | 'size'>,
@@ -17,6 +18,7 @@ export interface IReqoreSpinnerProps
17
18
  labelEffect?: IReqoreEffect;
18
19
  iconMargin?: 'right' | 'left' | 'both';
19
20
  centered?: boolean;
21
+ iconProps?: IReqoreIconProps;
20
22
  }
21
23
 
22
24
  export const ReqoreSpinner = ({
@@ -29,6 +31,7 @@ export const ReqoreSpinner = ({
29
31
  effect,
30
32
  iconMargin,
31
33
  centered,
34
+ iconProps,
32
35
  ...rest
33
36
  }: IReqoreSpinnerProps) => {
34
37
  const renderContent = useCallback(() => {
@@ -41,6 +44,7 @@ export const ReqoreSpinner = ({
41
44
  animation='spin'
42
45
  className='reqore-spinner'
43
46
  margin={iconMargin || (children ? 'right' : undefined)}
47
+ {...iconProps}
44
48
  />
45
49
  );
46
50
  }, [size, intent, type, children, iconColor]);
@@ -38,7 +38,7 @@ import {
38
38
  TReqoreEffectColor,
39
39
  TReqoreHexColor,
40
40
  } from '../Effect';
41
- import ReqoreIcon from '../Icon';
41
+ import ReqoreIcon, { IReqoreIconProps } from '../Icon';
42
42
 
43
43
  export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
44
44
  icon: IReqoreIconName;
@@ -61,10 +61,12 @@ export interface IReqoreTagProps
61
61
  onRemoveClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
62
62
  onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
63
63
  icon?: IReqoreIconName;
64
+ leftIconProps?: IReqoreIconProps;
64
65
  rightIcon?: IReqoreIconName;
65
66
  iconColor?: TReqoreEffectColor;
66
67
  leftIconColor?: TReqoreEffectColor;
67
68
  rightIconColor?: TReqoreEffectColor;
69
+ rightIconProps?: IReqoreIconProps;
68
70
  color?: TReqoreEffectColor;
69
71
  actions?: IReqoreTagAction[];
70
72
  width?: string;
@@ -261,6 +263,8 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
261
263
  iconColor,
262
264
  labelEffect,
263
265
  labelKeyEffect,
266
+ leftIconProps,
267
+ rightIconProps,
264
268
  ...rest
265
269
  }: IReqoreTagProps,
266
270
  ref
@@ -323,6 +327,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
323
327
  size={size}
324
328
  margin={label || labelKey ? 'left' : 'both'}
325
329
  color={leftIconColor || iconColor}
330
+ {...leftIconProps}
326
331
  />
327
332
  )}
328
333
  {labelKey && (
@@ -370,6 +375,7 @@ const ReqoreTag = forwardRef<HTMLSpanElement, IReqoreTagProps>(
370
375
  size={size}
371
376
  margin={label || (icon && !labelKey) ? 'right' : 'both'}
372
377
  color={rightIconColor || iconColor}
378
+ {...rightIconProps}
373
379
  />
374
380
  )}
375
381
  </StyledTagContentWrapper>
@@ -1,7 +1,7 @@
1
1
  import { cloneDeep } from 'lodash';
2
2
  import merge from 'lodash/merge';
3
3
  import { rgba } from 'polished';
4
- import React, { forwardRef, useState } from 'react';
4
+ import React, { forwardRef, memo, useMemo, useState } from 'react';
5
5
  import styled, { createGlobalStyle, css } from 'styled-components';
6
6
  import ReqoreLayoutWrapper from '../components/Layout';
7
7
  import { IReqoreNotificationsPosition } from '../components/Notifications';
@@ -54,9 +54,6 @@ const GlobalStyle = createGlobalStyle`
54
54
  `;
55
55
 
56
56
  const StyledPortal = styled.div`
57
- z-index: 9999;
58
- position: relative;
59
-
60
57
  * {
61
58
  box-sizing: border-box;
62
59
  }
@@ -66,20 +63,25 @@ const StyledPortal = styled.div`
66
63
  `}
67
64
  `;
68
65
 
69
- const ReqorePortal = forwardRef<HTMLDivElement, object>((_props, ref) => {
70
- return (
71
- <ReqoreThemeProvider>
72
- <StyledPortal id='reqore-portal' ref={ref} />
73
- </ReqoreThemeProvider>
74
- );
75
- });
66
+ const ReqorePortal = memo(
67
+ forwardRef<HTMLDivElement, object>((_props, ref) => {
68
+ return (
69
+ <ReqoreThemeProvider>
70
+ <StyledPortal id='reqore-portal' ref={ref} />
71
+ </ReqoreThemeProvider>
72
+ );
73
+ })
74
+ );
76
75
 
77
- const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = ({ children, theme, options }) => {
76
+ const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = memo(({ children, theme, options }) => {
78
77
  const [modalPortal, setModalPortal] = useState<any>(false);
79
78
 
80
- const _theme: Partial<IReqoreTheme> = cloneDeep(theme || {});
81
- const _defaultTheme: IReqoreTheme = cloneDeep(DEFAULT_THEME);
82
- const rebuiltTheme: IReqoreTheme = buildTheme(merge(_defaultTheme, _theme));
79
+ const _theme: Partial<IReqoreTheme> = useMemo(() => cloneDeep(theme || {}), [theme]);
80
+ const _defaultTheme: IReqoreTheme = useMemo(() => cloneDeep(DEFAULT_THEME), [DEFAULT_THEME]);
81
+ const rebuiltTheme: IReqoreTheme = useMemo(
82
+ () => buildTheme(merge(_defaultTheme, _theme)),
83
+ [_defaultTheme, _theme]
84
+ );
83
85
 
84
86
  return (
85
87
  <>
@@ -94,6 +96,6 @@ const ReqoreUIProvider: React.FC<IReqoreUIProviderProps> = ({ children, theme, o
94
96
  </ThemeContext.Provider>
95
97
  </>
96
98
  );
97
- };
99
+ });
98
100
 
99
101
  export default ReqoreUIProvider;
@@ -139,6 +139,8 @@ const Template: StoryFn<typeof ReqoreButton> = (buttonProps) => {
139
139
  <ReqoreControlGroup wrap>
140
140
  <ReqoreButton
141
141
  {...buttonProps}
142
+ leftIconProps={{ rotation: 180 }}
143
+ rightIconProps={{ rotation: 270 }}
142
144
  description='This is a very interesting description for a button, I like it very much'
143
145
  iconColor='#38fdb2'
144
146
  >
@@ -63,6 +63,13 @@ export const Basic: Story = {
63
63
  effect={{ opacity: 0.5 }}
64
64
  margin='both'
65
65
  />
66
+ <ReqoreIcon
67
+ icon='SignalTowerFill'
68
+ size='20px'
69
+ color='#8d2a5c'
70
+ rotation={90}
71
+ margin='both'
72
+ />
66
73
  </ReqorePanel>
67
74
  <br />
68
75
  <ReqorePanel label='Image' flat minimal>
@@ -119,6 +126,12 @@ export const Basic: Story = {
119
126
  effect={{ saturate: 150 }}
120
127
  margin='both'
121
128
  />
129
+ <ReqoreIcon
130
+ image='https://avatars.githubusercontent.com/u/44835090?s=400&u=371120ce0755102d2e432f11ad9aa0378c871b45&v=4'
131
+ size='40px'
132
+ rotation={180}
133
+ margin='both'
134
+ />
122
135
  </ReqorePanel>
123
136
  <br />
124
137
  <ReqorePanel label='Margined' flat minimal>
@@ -117,7 +117,19 @@ export const FromCustomElement: Story = {
117
117
  <ReqoreBackdrop />
118
118
  <div
119
119
  className='custom-modal reqore-modal'
120
- style={{ position: 'fixed', left: '50%', top: '50%' }}
120
+ style={{
121
+ position: 'fixed',
122
+ left: '50%',
123
+ top: '50%',
124
+ transform: 'translate(-50%, -50%)',
125
+ width: 500,
126
+ height: 300,
127
+ display: 'flex',
128
+ justifyContent: 'center',
129
+ alignItems: 'center',
130
+ border: '1px solid red',
131
+ zIndex: 10000,
132
+ }}
121
133
  >
122
134
  This is a custom modal
123
135
  </div>