@qoretechnologies/reqore 0.25.9 → 0.26.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.
Files changed (151) hide show
  1. package/__tests__/dropdown.test.tsx +133 -12
  2. package/__tests__/effect.test.tsx +70 -0
  3. package/dist/components/Button/index.d.ts +3 -2
  4. package/dist/components/Button/index.d.ts.map +1 -1
  5. package/dist/components/Button/index.js +15 -14
  6. package/dist/components/Button/index.js.map +1 -1
  7. package/dist/components/Collection/item.d.ts +2 -2
  8. package/dist/components/Collection/item.d.ts.map +1 -1
  9. package/dist/components/Collection/item.js +6 -3
  10. package/dist/components/Collection/item.js.map +1 -1
  11. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  12. package/dist/components/ControlGroup/index.js +4 -1
  13. package/dist/components/ControlGroup/index.js.map +1 -1
  14. package/dist/components/Dropdown/index.d.ts +8 -7
  15. package/dist/components/Dropdown/index.d.ts.map +1 -1
  16. package/dist/components/Dropdown/index.js +12 -5
  17. package/dist/components/Dropdown/index.js.map +1 -1
  18. package/dist/components/Dropdown/item.d.ts +2 -2
  19. package/dist/components/Dropdown/item.d.ts.map +1 -1
  20. package/dist/components/Dropdown/item.js.map +1 -1
  21. package/dist/components/Dropdown/list.d.ts +9 -2
  22. package/dist/components/Dropdown/list.d.ts.map +1 -1
  23. package/dist/components/Dropdown/list.js +13 -5
  24. package/dist/components/Dropdown/list.js.map +1 -1
  25. package/dist/components/Effect/index.d.ts +29 -0
  26. package/dist/components/Effect/index.d.ts.map +1 -0
  27. package/dist/components/Effect/index.js +117 -0
  28. package/dist/components/Effect/index.js.map +1 -0
  29. package/dist/components/Header/index.d.ts +14 -8
  30. package/dist/components/Header/index.d.ts.map +1 -1
  31. package/dist/components/Header/index.js +52 -33
  32. package/dist/components/Header/index.js.map +1 -1
  33. package/dist/components/Input/index.d.ts +3 -2
  34. package/dist/components/Input/index.d.ts.map +1 -1
  35. package/dist/components/Input/index.js +8 -7
  36. package/dist/components/Input/index.js.map +1 -1
  37. package/dist/components/InternalPopover/index.d.ts.map +1 -1
  38. package/dist/components/InternalPopover/index.js +0 -1
  39. package/dist/components/InternalPopover/index.js.map +1 -1
  40. package/dist/components/Menu/index.js +1 -1
  41. package/dist/components/Menu/index.js.map +1 -1
  42. package/dist/components/Menu/item.d.ts +5 -11
  43. package/dist/components/Menu/item.d.ts.map +1 -1
  44. package/dist/components/Menu/item.js +4 -4
  45. package/dist/components/Menu/item.js.map +1 -1
  46. package/dist/components/Message/index.d.ts +3 -6
  47. package/dist/components/Message/index.d.ts.map +1 -1
  48. package/dist/components/Message/index.js +2 -1
  49. package/dist/components/Message/index.js.map +1 -1
  50. package/dist/components/Notifications/notification.d.ts +3 -2
  51. package/dist/components/Notifications/notification.d.ts.map +1 -1
  52. package/dist/components/Notifications/notification.js +3 -2
  53. package/dist/components/Notifications/notification.js.map +1 -1
  54. package/dist/components/Panel/index.d.ts +5 -3
  55. package/dist/components/Panel/index.d.ts.map +1 -1
  56. package/dist/components/Panel/index.js +17 -27
  57. package/dist/components/Panel/index.js.map +1 -1
  58. package/dist/components/Popover/index.d.ts +1 -1
  59. package/dist/components/Popover/index.d.ts.map +1 -1
  60. package/dist/components/Popover/index.js +2 -2
  61. package/dist/components/Popover/index.js.map +1 -1
  62. package/dist/components/Tabs/item.d.ts +1 -1
  63. package/dist/components/Tabs/item.d.ts.map +1 -1
  64. package/dist/components/Tabs/item.js +6 -5
  65. package/dist/components/Tabs/item.js.map +1 -1
  66. package/dist/components/Tag/index.d.ts +2 -2
  67. package/dist/components/Tag/index.d.ts.map +1 -1
  68. package/dist/components/Tag/index.js +6 -4
  69. package/dist/components/Tag/index.js.map +1 -1
  70. package/dist/components/Textarea/index.d.ts +2 -2
  71. package/dist/components/Textarea/index.d.ts.map +1 -1
  72. package/dist/components/Textarea/index.js +8 -7
  73. package/dist/components/Textarea/index.js.map +1 -1
  74. package/dist/constants/sizes.d.ts +7 -0
  75. package/dist/constants/sizes.d.ts.map +1 -1
  76. package/dist/constants/sizes.js +8 -1
  77. package/dist/constants/sizes.js.map +1 -1
  78. package/dist/constants/theme.d.ts +1 -0
  79. package/dist/constants/theme.d.ts.map +1 -1
  80. package/dist/constants/theme.js.map +1 -1
  81. package/dist/containers/ReqoreProvider.d.ts +2 -2
  82. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  83. package/dist/containers/ReqoreProvider.js +7 -5
  84. package/dist/containers/ReqoreProvider.js.map +1 -1
  85. package/dist/containers/UIProvider.d.ts +9 -3
  86. package/dist/containers/UIProvider.d.ts.map +1 -1
  87. package/dist/containers/UIProvider.js +3 -2
  88. package/dist/containers/UIProvider.js.map +1 -1
  89. package/dist/context/ReqoreContext.d.ts +2 -0
  90. package/dist/context/ReqoreContext.d.ts.map +1 -1
  91. package/dist/context/ReqoreContext.js +4 -1
  92. package/dist/context/ReqoreContext.js.map +1 -1
  93. package/dist/helpers/colors.js +1 -1
  94. package/dist/helpers/colors.js.map +1 -1
  95. package/dist/hooks/usePopover.d.ts.map +1 -1
  96. package/dist/hooks/usePopover.js +23 -9
  97. package/dist/hooks/usePopover.js.map +1 -1
  98. package/dist/hooks/useWhyDidYouUpdate.d.ts +2 -0
  99. package/dist/hooks/useWhyDidYouUpdate.d.ts.map +1 -0
  100. package/dist/hooks/useWhyDidYouUpdate.js +47 -0
  101. package/dist/hooks/useWhyDidYouUpdate.js.map +1 -0
  102. package/dist/index.d.ts +2 -1
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +6 -2
  105. package/dist/index.js.map +1 -1
  106. package/dist/types/global.d.ts +13 -0
  107. package/dist/types/global.d.ts.map +1 -1
  108. package/package.json +2 -1
  109. package/src/components/Button/index.tsx +34 -23
  110. package/src/components/Collection/item.tsx +6 -3
  111. package/src/components/ControlGroup/index.tsx +1 -0
  112. package/src/components/Dropdown/index.tsx +62 -36
  113. package/src/components/Dropdown/item.tsx +3 -6
  114. package/src/components/Dropdown/list.tsx +82 -56
  115. package/src/components/Effect/index.tsx +134 -0
  116. package/src/components/Header/index.tsx +33 -28
  117. package/src/components/Input/index.tsx +15 -7
  118. package/src/components/InternalPopover/index.tsx +0 -2
  119. package/src/components/Menu/index.tsx +1 -1
  120. package/src/components/Menu/item.tsx +8 -17
  121. package/src/components/Message/index.tsx +13 -5
  122. package/src/components/Notifications/notification.tsx +6 -3
  123. package/src/components/Panel/index.tsx +83 -79
  124. package/src/components/Popover/index.tsx +40 -38
  125. package/src/components/Tabs/item.tsx +92 -79
  126. package/src/components/Tag/index.tsx +16 -7
  127. package/src/components/Textarea/index.tsx +14 -7
  128. package/src/constants/sizes.ts +8 -0
  129. package/src/constants/theme.ts +1 -0
  130. package/src/containers/ReqoreProvider.tsx +16 -8
  131. package/src/containers/UIProvider.tsx +15 -13
  132. package/src/context/ReqoreContext.tsx +5 -0
  133. package/src/helpers/colors.ts +1 -1
  134. package/src/hooks/usePopover.tsx +34 -20
  135. package/src/hooks/useWhyDidYouUpdate.ts +32 -0
  136. package/src/index.tsx +10 -1
  137. package/src/mock/collectionData.tsx +55 -2
  138. package/src/stories/Button/Button.stories.tsx +15 -2
  139. package/src/stories/Collection/Collection.stories.tsx +1 -1
  140. package/src/stories/Dropdown/Dropdown.stories.tsx +62 -34
  141. package/src/stories/Header/Header.stories.tsx +71 -0
  142. package/src/stories/Input/Input.stories.tsx +12 -0
  143. package/src/stories/Menu/Menu.stories.tsx +14 -0
  144. package/src/stories/Message/Message.stories.tsx +13 -0
  145. package/src/stories/Notifications/Notification.stories.tsx +7 -2
  146. package/src/stories/Panel/Panel.stories.tsx +41 -5
  147. package/src/stories/Tabs/Tabs.stories.tsx +23 -23
  148. package/src/stories/Tag/Tag.stories.tsx +16 -0
  149. package/src/stories/TextArea/TextArea.stories.tsx +18 -0
  150. package/src/types/global.ts +14 -0
  151. package/tests.json +1 -1
@@ -4,26 +4,20 @@ import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
4
4
  import PopoverContext from '../../context/PopoverContext';
5
5
  import { useCombinedRefs } from '../../hooks/useCombinedRefs';
6
6
  import { useTooltip } from '../../hooks/useTooltip';
7
- import { IReqoreComponent, IWithReqoreCustomTheme, TReqoreTooltipProp } from '../../types/global';
8
- import { IReqoreIconName } from '../../types/icons';
7
+ import { IReqoreComponent } from '../../types/global';
8
+ import { IReqoreButtonProps } from '../Button';
9
9
 
10
10
  // @ts-ignore
11
11
  export interface IReqoreMenuItemProps
12
12
  extends IReqoreComponent,
13
13
  React.HTMLAttributes<HTMLElement>,
14
- IWithReqoreCustomTheme {
15
- children?: string;
14
+ IReqoreButtonProps {
16
15
  label?: string | number;
17
- icon?: IReqoreIconName;
18
- rightIcon?: IReqoreIconName;
19
16
  as?: JSX.Element | React.ElementType | never;
20
17
  selected?: boolean;
21
- disabled?: boolean;
22
- onClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
18
+ itemId?: string;
23
19
  onRightIconClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
24
- tooltip?: TReqoreTooltipProp;
25
- intent?: TReqoreIntent;
26
- wrapText?: boolean;
20
+ onClick?: (itemId?: string, event?: React.MouseEvent<HTMLElement>) => void;
27
21
  }
28
22
 
29
23
  export interface IReqoreMenuItemStyle {
@@ -51,12 +45,11 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
51
45
  onClick,
52
46
  onRightIconClick,
53
47
  disabled,
54
- id,
48
+ itemId,
55
49
  _insidePopover,
56
50
  _popoverId,
57
51
  tooltip,
58
52
  intent,
59
- wrapText,
60
53
  ...rest
61
54
  },
62
55
  ref: any
@@ -67,7 +60,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
67
60
  const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
68
61
  event.persist();
69
62
 
70
- onClick?.(id, event);
63
+ onClick?.(itemId, event);
71
64
 
72
65
  if (_insidePopover && _popoverId) {
73
66
  removePopover!(_popoverId);
@@ -79,7 +72,7 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
79
72
  event.stopPropagation();
80
73
 
81
74
  if (onRightIconClick) {
82
- onRightIconClick(id, event);
75
+ onRightIconClick(itemId, event);
83
76
 
84
77
  if (_insidePopover && _popoverId) {
85
78
  removePopover!(_popoverId);
@@ -104,7 +97,6 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
104
97
  disabled={disabled}
105
98
  intent={intent}
106
99
  icon={icon}
107
- wrap={wrapText}
108
100
  >
109
101
  {label || children}
110
102
  </ReqoreButton>
@@ -120,7 +112,6 @@ const ReqoreMenuItem: React.FC<IReqoreMenuItemProps> = forwardRef(
120
112
  readOnly={!onRightIconClick}
121
113
  intent={intent}
122
114
  active={selected && !!onRightIconClick}
123
- wrap={wrapText}
124
115
  />
125
116
  )}
126
117
  </ReqoreControlGroup>
@@ -1,10 +1,16 @@
1
+ import { animated } from '@react-spring/web';
1
2
  import React, { forwardRef, useEffect, useMemo, useState } from 'react';
2
3
  import { useMount, useUnmount } from 'react-use';
3
- import { TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
4
- import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
4
+ import { TEXT_FROM_SIZE } from '../../constants/sizes';
5
+ import { IReqoreTheme } from '../../constants/theme';
5
6
  import ReqoreThemeProvider from '../../containers/ThemeProvider';
6
7
  import { useReqoreTheme } from '../../hooks/useTheme';
7
- import { IWithReqoreCustomTheme } from '../../types/global';
8
+ import {
9
+ IReqoreIntent,
10
+ IWithReqoreCustomTheme,
11
+ IWithReqoreEffect,
12
+ IWithReqoreSize,
13
+ } from '../../types/global';
8
14
  import { IReqoreIconName } from '../../types/icons';
9
15
  import ReqoreIcon from '../Icon';
10
16
  import {
@@ -18,8 +24,10 @@ import {
18
24
 
19
25
  export interface IReqoreMessageProps
20
26
  extends IWithReqoreCustomTheme,
27
+ IWithReqoreEffect,
28
+ IWithReqoreSize,
29
+ IReqoreIntent,
21
30
  React.HTMLAttributes<HTMLDivElement> {
22
- intent?: TReqoreIntent;
23
31
  title?: string;
24
32
  children: any;
25
33
  icon?: IReqoreIconName;
@@ -29,7 +37,6 @@ export interface IReqoreMessageProps
29
37
  onFinish?: () => any;
30
38
  flat?: boolean;
31
39
  inverted?: boolean;
32
- size?: TSizes;
33
40
  }
34
41
 
35
42
  export interface IReqoreNotificationStyle extends IReqoreMessageProps {
@@ -96,6 +103,7 @@ const ReqoreMessage: React.FC<IReqoreMessageProps> = forwardRef(
96
103
  <ReqoreThemeProvider>
97
104
  <StyledReqoreNotification
98
105
  {...rest}
106
+ as={animated.div}
99
107
  key={`${duration}${intent}${title}${children}`}
100
108
  intent={intent}
101
109
  timeout={duration}
@@ -14,16 +14,18 @@ import {
14
14
  getNotificationIntent,
15
15
  getReadableColorFrom,
16
16
  } from '../../helpers/colors';
17
+ import { IWithReqoreEffect } from '../../types/global';
17
18
  import { IReqoreIconName } from '../../types/icons';
19
+ import { StyledEffect } from '../Effect';
18
20
  import ReqoreIcon from '../Icon';
19
21
 
20
22
  export type IReqoreNotificationType = TReqoreIntent;
21
23
 
22
- export interface IReqoreNotificationProps {
24
+ export interface IReqoreNotificationProps extends IWithReqoreEffect {
23
25
  type?: IReqoreNotificationType;
24
26
  intent?: TReqoreIntent;
25
27
  title?: string;
26
- content: string;
28
+ content: string | React.ReactNode;
27
29
  icon?: IReqoreIconName;
28
30
  onClose?: () => any;
29
31
  onClick?: () => any;
@@ -58,7 +60,7 @@ const timeoutAnimation = keyframes`
58
60
  }
59
61
  `;
60
62
 
61
- export const StyledReqoreNotification = styled(animated.div)<IReqoreNotificationStyle>`
63
+ export const StyledReqoreNotification = styled(StyledEffect)<IReqoreNotificationStyle>`
62
64
  min-width: ${({ fluid }) => (!fluid ? '200px' : undefined)};
63
65
  max-width: ${({ fluid }) => (!fluid ? '450px' : undefined)};
64
66
  border-radius: 5px;
@@ -249,6 +251,7 @@ const ReqoreNotification: React.FC<IReqoreNotificationProps> = forwardRef(
249
251
  item ? (
250
252
  <ReqoreThemeProvider>
251
253
  <StyledReqoreNotification
254
+ as={animated.div}
252
255
  key={`${duration}${type || intent}${title}${content}`}
253
256
  type={type || intent}
254
257
  hasShadow
@@ -31,13 +31,15 @@ import ReqoreButton, { IReqoreButtonProps } from '../Button';
31
31
  import { StyledCollectionItemContent } from '../Collection/item';
32
32
  import ReqoreControlGroup from '../ControlGroup';
33
33
  import ReqoreDropdown from '../Dropdown';
34
- import { IReqoreDropdownItemProps } from '../Dropdown/item';
34
+ import { IReqoreDropdownItem } from '../Dropdown/list';
35
+ import { IReqoreEffect, StyledEffect } from '../Effect';
36
+ import { ReqoreHeading } from '../Header';
35
37
  import ReqoreIcon from '../Icon';
36
38
 
37
39
  export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreTooltip, IReqoreIntent {
38
40
  label?: string | number;
39
41
  onClick?: () => void;
40
- actions?: IReqoreDropdownItemProps[];
42
+ actions?: IReqoreDropdownItem[];
41
43
  customContent?: () => string | React.ReactNode;
42
44
  }
43
45
 
@@ -58,6 +60,7 @@ export interface IReqorePanelProps
58
60
  children?: any;
59
61
  icon?: IReqoreIconName;
60
62
  label?: string | ReactElement<any>;
63
+
61
64
  collapsible?: boolean;
62
65
  isCollapsed?: boolean;
63
66
  onClose?: () => void;
@@ -74,6 +77,8 @@ export interface IReqorePanelProps
74
77
  minimal?: boolean;
75
78
  headerSize?: 1 | 2 | 3 | 4 | 5 | 6;
76
79
  contentSize?: TSizes;
80
+ contentEffect?: IReqoreEffect;
81
+ headerEffect?: IReqoreEffect;
77
82
  }
78
83
 
79
84
  export interface IStyledPanel extends IReqorePanelProps {
@@ -81,7 +86,7 @@ export interface IStyledPanel extends IReqorePanelProps {
81
86
  noHorizontalPadding?: boolean;
82
87
  }
83
88
 
84
- export const StyledPanel = styled.div<IStyledPanel>`
89
+ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
85
90
  background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
86
91
  rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)};
87
92
  border-radius: ${({ rounded }) => (rounded ? RADIUS_FROM_SIZE.normal : 0)}px;
@@ -136,8 +141,8 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
136
141
  justify-content: space-between;
137
142
  height: 40px;
138
143
  align-items: center;
139
- padding: ${({ noHorizontalPadding }: IStyledPanel) =>
140
- `0 5px 0 ${noHorizontalPadding ? 0 : '15px'}`};
144
+ padding: ${({ noHorizontalPadding, contentSize }: IStyledPanel) =>
145
+ `0 5px 0 ${noHorizontalPadding ? 0 : `${TEXT_FROM_SIZE[contentSize]}px`}`};
141
146
  border-bottom: ${({ theme, isCollapsed, flat, opacity = 1 }) =>
142
147
  !isCollapsed && !flat
143
148
  ? `1px solid ${rgba(changeLightness(getMainBackgroundColor(theme), 0.2), opacity)}`
@@ -159,6 +164,7 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
159
164
 
160
165
  export const StyledPanelBottomActions = styled(StyledPanelTitle)`
161
166
  padding-left: 5px;
167
+ padding-right: 5px;
162
168
  border-bottom: 0;
163
169
  border-top: ${({ theme, flat, opacity = 1 }) =>
164
170
  !flat
@@ -183,23 +189,12 @@ export const StyledPanelContent = styled.div<IStyledPanel>`
183
189
  font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
184
190
  `;
185
191
 
186
- export const StyledPanelTitleLabel = styled.span`
187
- white-space: nowrap;
188
- text-overflow: ellipsis;
189
- overflow: hidden;
190
- margin: 0;
191
- `;
192
-
193
192
  export const StyledPanelTitleHeader = styled.div`
194
193
  display: flex;
195
194
  justify-content: center;
196
195
  align-items: center;
197
196
  overflow: hidden;
198
197
  padding-right: 5px;
199
-
200
- ${StyledPanelTitleLabel} {
201
- font-weight: 600;
202
- }
203
198
  `;
204
199
 
205
200
  export const ReqorePanel = forwardRef(
@@ -222,6 +217,8 @@ export const ReqorePanel = forwardRef(
222
217
  onCollapseChange,
223
218
  padded = true,
224
219
  contentStyle,
220
+ contentEffect,
221
+ headerEffect = {},
225
222
  headerSize = 4,
226
223
  contentSize = 'normal',
227
224
  minimal,
@@ -267,70 +264,66 @@ export const ReqorePanel = forwardRef(
267
264
  [leftBottomActions, rightBottomActions]
268
265
  );
269
266
 
270
- const renderActions = (
271
- actionOrActions: IReqorePanelAction | IReqorePanelAction[],
272
- index: number
273
- ) => {
274
- if (Array.isArray(actionOrActions)) {
275
- return (
276
- <ReqoreControlGroup stack minimal>
277
- {actionOrActions.map(renderActions)}
278
- </ReqoreControlGroup>
279
- );
280
- }
281
-
282
- const { id, actions, label, intent, className, customContent, ...rest }: IReqorePanelAction =
283
- actionOrActions;
267
+ const renderActions = useCallback(
268
+ (actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
269
+ if (Array.isArray(actionOrActions)) {
270
+ return (
271
+ <ReqoreControlGroup stack>{actionOrActions.map(renderActions)}</ReqoreControlGroup>
272
+ );
273
+ }
274
+
275
+ const {
276
+ id,
277
+ actions,
278
+ label,
279
+ intent,
280
+ className,
281
+ customContent,
282
+ ...rest
283
+ }: IReqorePanelAction = actionOrActions;
284
+
285
+ if (size(actions)) {
286
+ return (
287
+ <ReqoreDropdown<IReqoreButtonProps>
288
+ {...rest}
289
+ key={index}
290
+ label={label}
291
+ items={actions}
292
+ intent={intent}
293
+ className={className}
294
+ onClick={(e: React.MouseEvent<HTMLButtonElement>) => e.stopPropagation()}
295
+ id={id}
296
+ />
297
+ );
298
+ }
299
+
300
+ if (customContent) {
301
+ return customContent();
302
+ }
284
303
 
285
- if (size(actions)) {
286
304
  return (
287
- <ReqoreDropdown
305
+ <ReqoreButton
288
306
  {...rest}
307
+ id={id}
289
308
  key={index}
290
- label={label}
291
- componentProps={{
292
- intent,
293
- id,
294
- minimal: true,
295
- className,
296
- onClick: (e: React.MouseEvent<HTMLButtonElement>) => {
297
- e.stopPropagation();
298
- },
299
- }}
300
- items={actions}
301
- />
309
+ className={className}
310
+ customTheme={theme}
311
+ intent={intent}
312
+ onClick={
313
+ rest.onClick
314
+ ? (e: React.MouseEvent<HTMLButtonElement>) => {
315
+ e.stopPropagation();
316
+ rest.onClick?.();
317
+ }
318
+ : undefined
319
+ }
320
+ >
321
+ {label}
322
+ </ReqoreButton>
302
323
  );
303
- }
304
-
305
- if (customContent) {
306
- return customContent();
307
- }
308
-
309
- return (
310
- <ReqoreButton
311
- {...rest}
312
- id={id}
313
- key={index}
314
- className={className}
315
- customTheme={theme}
316
- intent={intent}
317
- onClick={
318
- rest.onClick
319
- ? (e: React.MouseEvent<HTMLButtonElement>) => {
320
- e.stopPropagation();
321
- rest.onClick?.();
322
- }
323
- : undefined
324
- }
325
- >
326
- {label}
327
- </ReqoreButton>
328
- );
329
- };
330
-
331
- const HTMLheaderElement = useMemo(() => {
332
- return `h${headerSize}` as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
333
- }, [headerSize]);
324
+ },
325
+ [actions, theme]
326
+ );
334
327
 
335
328
  const interactive: boolean = !!(
336
329
  rest.onClick ||
@@ -351,6 +344,7 @@ export const ReqorePanel = forwardRef(
351
344
  className={`${className || ''} reqore-panel`}
352
345
  interactive={interactive}
353
346
  theme={theme}
347
+ effect={contentEffect}
354
348
  >
355
349
  {hasTitleBar && (
356
350
  <StyledPanelTitle
@@ -360,6 +354,7 @@ export const ReqorePanel = forwardRef(
360
354
  className='reqore-panel-title'
361
355
  onClick={handleCollapseClick}
362
356
  theme={theme}
357
+ contentSize={contentSize}
363
358
  opacity={rest.opacity ?? (minimal ? 0 : 1)}
364
359
  noHorizontalPadding={rest.opacity === 0}
365
360
  >
@@ -372,12 +367,20 @@ export const ReqorePanel = forwardRef(
372
367
  />
373
368
  )}
374
369
  {typeof label === 'string' ? (
375
- <StyledPanelTitleLabel as={HTMLheaderElement}>{label}</StyledPanelTitleLabel>
370
+ <ReqoreHeading
371
+ size={headerSize}
372
+ effect={{
373
+ noWrap: true,
374
+ ...headerEffect,
375
+ }}
376
+ >
377
+ {label}
378
+ </ReqoreHeading>
376
379
  ) : (
377
380
  label
378
381
  )}
379
382
  </StyledPanelTitleHeader>
380
- <ReqoreControlGroup minimal>
383
+ <ReqoreControlGroup>
381
384
  {actions.map(renderActions)}
382
385
  {collapsible && (
383
386
  <ReqoreButton
@@ -402,6 +405,7 @@ export const ReqorePanel = forwardRef(
402
405
  )}
403
406
  {!_isCollapsed || (_isCollapsed && !unMountContentOnCollapse) ? (
404
407
  <StyledPanelContent
408
+ as={'div'}
405
409
  className='reqore-panel-content'
406
410
  hasLabel={!!label}
407
411
  isCollapsed={_isCollapsed}
@@ -422,8 +426,8 @@ export const ReqorePanel = forwardRef(
422
426
  opacity={rest.opacity ?? (minimal ? 0 : 1)}
423
427
  noHorizontalPadding={rest.opacity === 0}
424
428
  >
425
- <ReqoreControlGroup minimal>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
426
- <ReqoreControlGroup minimal>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
429
+ <ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
430
+ <ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
427
431
  </StyledPanelBottomActions>
428
432
  ) : null}
429
433
  </StyledPanel>
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { memo, useState } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import usePopover, { IPopoverOptions } from '../../hooks/usePopover';
4
4
  import { IReqoreComponent } from '../../types/global';
@@ -17,49 +17,51 @@ export const StyledPopover = styled.span`
17
17
  overflow: hidden;
18
18
  `;
19
19
 
20
- const Popover = ({
21
- component: Component,
22
- componentProps,
23
- children,
24
- isReqoreComponent,
25
- noWrapper,
26
- wrapperTag = 'span',
27
- wrapperStyle = {},
28
- _insidePopover,
29
- _popoverId,
30
- ...rest
31
- }: IReqorePopoverProps) => {
32
- const [ref, setRef] = useState(undefined);
20
+ const Popover = memo(
21
+ ({
22
+ component: Component,
23
+ componentProps,
24
+ children,
25
+ isReqoreComponent,
26
+ noWrapper,
27
+ wrapperTag = 'span',
28
+ wrapperStyle = {},
29
+ _insidePopover,
30
+ _popoverId,
31
+ ...rest
32
+ }: IReqorePopoverProps) => {
33
+ const [ref, setRef] = useState(undefined);
33
34
 
34
- usePopover({ targetElement: ref, ...rest });
35
+ usePopover({ targetElement: ref, ...rest });
36
+
37
+ if (isReqoreComponent || noWrapper) {
38
+ return (
39
+ <Component
40
+ {...componentProps}
41
+ _insidePopover={_insidePopover}
42
+ _popoverId={_popoverId}
43
+ ref={setRef}
44
+ >
45
+ {children}
46
+ </Component>
47
+ );
48
+ }
35
49
 
36
- if (isReqoreComponent || noWrapper) {
37
50
  return (
38
- <Component
39
- {...componentProps}
40
- _insidePopover={_insidePopover}
41
- _popoverId={_popoverId}
51
+ // @ts-ignore
52
+ <StyledPopover
53
+ // @ts-ignore
54
+ as={wrapperTag}
55
+ className='reqore-popover-wrapper'
42
56
  ref={setRef}
57
+ style={wrapperStyle}
43
58
  >
44
- {children}
45
- </Component>
59
+ <Component {...componentProps} _insidePopover={_insidePopover} _popoverId={_popoverId}>
60
+ {children}
61
+ </Component>
62
+ </StyledPopover>
46
63
  );
47
64
  }
48
-
49
- return (
50
- // @ts-ignore
51
- <StyledPopover
52
- // @ts-ignore
53
- as={wrapperTag}
54
- className='reqore-popover-wrapper'
55
- ref={setRef}
56
- style={wrapperStyle}
57
- >
58
- <Component {...componentProps} _insidePopover={_insidePopover} _popoverId={_popoverId}>
59
- {children}
60
- </Component>
61
- </StyledPopover>
62
- );
63
- };
65
+ );
64
66
 
65
67
  export default Popover;