@qoretechnologies/reqore 0.30.4 → 0.30.6

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 (214) hide show
  1. package/CODE_OF_CONDUCT.md +105 -0
  2. package/CONTRIBUTING.MD +78 -0
  3. package/LICENSE +1 -1
  4. package/README.md +44 -2
  5. package/SECURITY.md +5 -0
  6. package/__tests__/collection.test.tsx +1 -1
  7. package/__tests__/{control_group.test.tsx → control_group.text.tsx} +2 -4
  8. package/__tests__/modal.test.tsx +2 -74
  9. package/__tests__/panel.test.tsx +24 -96
  10. package/__tests__/popover.test.tsx +2 -24
  11. package/__tests__/tabs.test.tsx +0 -75
  12. package/dist/components/Button/index.d.ts +1 -4
  13. package/dist/components/Button/index.d.ts.map +1 -1
  14. package/dist/components/Button/index.js +7 -10
  15. package/dist/components/Button/index.js.map +1 -1
  16. package/dist/components/Checkbox/index.js +1 -1
  17. package/dist/components/Collection/index.d.ts +2 -7
  18. package/dist/components/Collection/index.d.ts.map +1 -1
  19. package/dist/components/Collection/index.js +53 -57
  20. package/dist/components/Collection/index.js.map +1 -1
  21. package/dist/components/Collection/item.d.ts +5 -5
  22. package/dist/components/Collection/item.d.ts.map +1 -1
  23. package/dist/components/Collection/item.js +4 -15
  24. package/dist/components/Collection/item.js.map +1 -1
  25. package/dist/components/Columns/column.d.ts.map +1 -1
  26. package/dist/components/Columns/column.js +1 -1
  27. package/dist/components/Columns/column.js.map +1 -1
  28. package/dist/components/ControlGroup/index.d.ts +4 -20
  29. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  30. package/dist/components/ControlGroup/index.js +55 -241
  31. package/dist/components/ControlGroup/index.js.map +1 -1
  32. package/dist/components/Drawer/index.d.ts +3 -3
  33. package/dist/components/Drawer/index.d.ts.map +1 -1
  34. package/dist/components/Drawer/index.js +16 -27
  35. package/dist/components/Drawer/index.js.map +1 -1
  36. package/dist/components/Dropdown/index.d.ts +0 -1
  37. package/dist/components/Dropdown/index.d.ts.map +1 -1
  38. package/dist/components/Dropdown/index.js +2 -2
  39. package/dist/components/Dropdown/index.js.map +1 -1
  40. package/dist/components/Dropdown/list.d.ts +3 -3
  41. package/dist/components/Dropdown/list.d.ts.map +1 -1
  42. package/dist/components/Effect/index.d.ts +9 -9
  43. package/dist/components/Effect/index.d.ts.map +1 -1
  44. package/dist/components/Effect/index.js +1 -1
  45. package/dist/components/Effect/index.js.map +1 -1
  46. package/dist/components/Icon/index.d.ts +6 -5
  47. package/dist/components/Icon/index.d.ts.map +1 -1
  48. package/dist/components/Icon/index.js +7 -14
  49. package/dist/components/Icon/index.js.map +1 -1
  50. package/dist/components/Input/index.d.ts +0 -2
  51. package/dist/components/Input/index.d.ts.map +1 -1
  52. package/dist/components/Input/index.js +6 -9
  53. package/dist/components/Input/index.js.map +1 -1
  54. package/dist/components/InternalPopover/index.d.ts.map +1 -1
  55. package/dist/components/InternalPopover/index.js +10 -12
  56. package/dist/components/InternalPopover/index.js.map +1 -1
  57. package/dist/components/Menu/index.d.ts.map +1 -1
  58. package/dist/components/Menu/index.js +1 -1
  59. package/dist/components/Menu/index.js.map +1 -1
  60. package/dist/components/Message/index.d.ts +0 -2
  61. package/dist/components/Message/index.d.ts.map +1 -1
  62. package/dist/components/Message/index.js +2 -2
  63. package/dist/components/Message/index.js.map +1 -1
  64. package/dist/components/MultiSelect/index.d.ts +2 -2
  65. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  66. package/dist/components/MultiSelect/index.js +10 -10
  67. package/dist/components/MultiSelect/index.js.map +1 -1
  68. package/dist/components/Notifications/index.d.ts +1 -1
  69. package/dist/components/Notifications/index.d.ts.map +1 -1
  70. package/dist/components/Notifications/notification.d.ts +1 -1
  71. package/dist/components/Notifications/notification.d.ts.map +1 -1
  72. package/dist/components/Panel/index.d.ts +6 -13
  73. package/dist/components/Panel/index.d.ts.map +1 -1
  74. package/dist/components/Panel/index.js +44 -78
  75. package/dist/components/Panel/index.js.map +1 -1
  76. package/dist/components/Popover/index.d.ts +2 -1
  77. package/dist/components/Popover/index.d.ts.map +1 -1
  78. package/dist/components/Popover/index.js +2 -2
  79. package/dist/components/Popover/index.js.map +1 -1
  80. package/dist/components/Spacer/index.d.ts +0 -2
  81. package/dist/components/Spacer/index.d.ts.map +1 -1
  82. package/dist/components/Spacer/index.js +7 -29
  83. package/dist/components/Spacer/index.js.map +1 -1
  84. package/dist/components/Table/helpers.d.ts +2 -3
  85. package/dist/components/Table/helpers.d.ts.map +1 -1
  86. package/dist/components/Table/helpers.js +3 -6
  87. package/dist/components/Table/helpers.js.map +1 -1
  88. package/dist/components/Table/index.d.ts +3 -4
  89. package/dist/components/Table/index.d.ts.map +1 -1
  90. package/dist/components/Table/index.js.map +1 -1
  91. package/dist/components/Tabs/content.d.ts +1 -3
  92. package/dist/components/Tabs/content.d.ts.map +1 -1
  93. package/dist/components/Tabs/content.js +3 -8
  94. package/dist/components/Tabs/content.js.map +1 -1
  95. package/dist/components/Tabs/index.d.ts +1 -4
  96. package/dist/components/Tabs/index.d.ts.map +1 -1
  97. package/dist/components/Tabs/index.js +4 -12
  98. package/dist/components/Tabs/index.js.map +1 -1
  99. package/dist/components/Tabs/item.d.ts +0 -1
  100. package/dist/components/Tabs/item.d.ts.map +1 -1
  101. package/dist/components/Tabs/item.js +7 -7
  102. package/dist/components/Tabs/item.js.map +1 -1
  103. package/dist/components/Tabs/list.d.ts +1 -1
  104. package/dist/components/Tabs/list.d.ts.map +1 -1
  105. package/dist/components/Tabs/list.js +3 -4
  106. package/dist/components/Tabs/list.js.map +1 -1
  107. package/dist/components/Tag/group.d.ts +2 -2
  108. package/dist/components/Tag/group.d.ts.map +1 -1
  109. package/dist/components/Tag/group.js +8 -7
  110. package/dist/components/Tag/group.js.map +1 -1
  111. package/dist/components/Tag/index.d.ts +2 -6
  112. package/dist/components/Tag/index.d.ts.map +1 -1
  113. package/dist/components/Tag/index.js +12 -20
  114. package/dist/components/Tag/index.js.map +1 -1
  115. package/dist/components/Tree/index.js +1 -1
  116. package/dist/components/Tree/index.js.map +1 -1
  117. package/dist/constants/animations.js +1 -1
  118. package/dist/constants/sizes.d.ts +2 -2
  119. package/dist/constants/sizes.d.ts.map +1 -1
  120. package/dist/constants/sizes.js +10 -10
  121. package/dist/constants/sizes.js.map +1 -1
  122. package/dist/constants/theme.d.ts +1 -1
  123. package/dist/constants/theme.d.ts.map +1 -1
  124. package/dist/containers/PopoverProvider.d.ts.map +1 -1
  125. package/dist/containers/PopoverProvider.js +8 -10
  126. package/dist/containers/PopoverProvider.js.map +1 -1
  127. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  128. package/dist/containers/ReqoreProvider.js +2 -4
  129. package/dist/containers/ReqoreProvider.js.map +1 -1
  130. package/dist/containers/UIProvider.d.ts +0 -7
  131. package/dist/containers/UIProvider.d.ts.map +1 -1
  132. package/dist/containers/UIProvider.js.map +1 -1
  133. package/dist/context/ReqoreContext.d.ts +0 -2
  134. package/dist/context/ReqoreContext.d.ts.map +1 -1
  135. package/dist/context/ReqoreContext.js.map +1 -1
  136. package/dist/helpers/utils.d.ts +0 -2
  137. package/dist/helpers/utils.d.ts.map +1 -1
  138. package/dist/helpers/utils.js +2 -4
  139. package/dist/helpers/utils.js.map +1 -1
  140. package/dist/hooks/useLatestZIndex.js +2 -2
  141. package/dist/hooks/useLatestZIndex.js.map +1 -1
  142. package/dist/hooks/usePopover.d.ts +0 -1
  143. package/dist/hooks/usePopover.d.ts.map +1 -1
  144. package/dist/hooks/usePopover.js +6 -8
  145. package/dist/hooks/usePopover.js.map +1 -1
  146. package/dist/styles.d.ts +0 -1
  147. package/dist/styles.d.ts.map +1 -1
  148. package/dist/styles.js +5 -6
  149. package/dist/styles.js.map +1 -1
  150. package/dist/types/global.d.ts +1 -27
  151. package/dist/types/global.d.ts.map +1 -1
  152. package/dist/types/icons.d.ts +1 -1
  153. package/dist/types/icons.d.ts.map +1 -1
  154. package/package.json +1 -1
  155. package/public/logo-dark.png +0 -0
  156. package/public/logo.png +0 -0
  157. package/public/q-symbol.png +0 -0
  158. package/public/qoreLogo-dark.png +0 -0
  159. package/public/qoreLogo.png +0 -0
  160. package/src/components/Button/index.tsx +5 -17
  161. package/src/components/Checkbox/index.tsx +1 -1
  162. package/src/components/Collection/index.tsx +60 -93
  163. package/src/components/Collection/item.tsx +9 -29
  164. package/src/components/Columns/column.tsx +0 -1
  165. package/src/components/ControlGroup/index.tsx +103 -426
  166. package/src/components/Drawer/index.tsx +27 -28
  167. package/src/components/Dropdown/index.tsx +1 -3
  168. package/src/components/Effect/index.tsx +0 -1
  169. package/src/components/Icon/index.tsx +62 -81
  170. package/src/components/Input/index.tsx +4 -8
  171. package/src/components/InternalPopover/index.tsx +126 -131
  172. package/src/components/Menu/index.tsx +1 -7
  173. package/src/components/Message/index.tsx +1 -9
  174. package/src/components/MultiSelect/index.tsx +188 -180
  175. package/src/components/Panel/index.tsx +100 -227
  176. package/src/components/Popover/index.tsx +3 -1
  177. package/src/components/Spacer/index.tsx +14 -63
  178. package/src/components/Table/helpers.ts +6 -12
  179. package/src/components/Table/index.tsx +0 -1
  180. package/src/components/Tabs/content.tsx +3 -11
  181. package/src/components/Tabs/index.tsx +3 -14
  182. package/src/components/Tabs/item.tsx +5 -28
  183. package/src/components/Tabs/list.tsx +0 -4
  184. package/src/components/Tag/group.tsx +12 -6
  185. package/src/components/Tag/index.tsx +35 -67
  186. package/src/components/Tree/index.tsx +1 -1
  187. package/src/constants/animations.ts +1 -1
  188. package/src/constants/sizes.ts +10 -10
  189. package/src/containers/PopoverProvider.tsx +8 -11
  190. package/src/containers/ReqoreProvider.tsx +35 -40
  191. package/src/containers/UIProvider.tsx +0 -7
  192. package/src/context/ReqoreContext.tsx +0 -2
  193. package/src/helpers/utils.ts +0 -3
  194. package/src/hooks/useLatestZIndex.ts +2 -2
  195. package/src/hooks/usePopover.tsx +6 -9
  196. package/src/mock/collectionData.tsx +2 -33
  197. package/src/stories/Button/Button.stories.tsx +6 -14
  198. package/src/stories/Checkbox/Checkbox.stories.tsx +3 -6
  199. package/src/stories/Collection/Collection.stories.tsx +2 -18
  200. package/src/stories/ControlGroup/ControlGroup.stories.tsx +34 -220
  201. package/src/stories/Drawer/Drawer.stories.tsx +3 -70
  202. package/src/stories/Dropdown/Dropdown.stories.tsx +3 -13
  203. package/src/stories/Icon/Icon.stories.tsx +0 -1
  204. package/src/stories/Input/Input.stories.tsx +3 -5
  205. package/src/stories/Menu/Menu.stories.tsx +0 -2
  206. package/src/stories/Message/Message.stories.tsx +0 -7
  207. package/src/stories/Panel/Panel.stories.tsx +13 -147
  208. package/src/stories/Popover/Popover.stories.tsx +82 -88
  209. package/src/stories/Tabs/Tabs.stories.tsx +15 -32
  210. package/src/stories/Tag/Tag.stories.tsx +3 -23
  211. package/src/stories/TextArea/TextArea.stories.tsx +3 -3
  212. package/src/styles.ts +0 -6
  213. package/src/types/global.ts +0 -28
  214. package/tests.json +1 -1
@@ -4,8 +4,6 @@ import { ReactElement, forwardRef, useCallback, useMemo, useState } from 'react'
4
4
  import { useUpdateEffect } from 'react-use';
5
5
  import styled, { css } from 'styled-components';
6
6
  import {
7
- GAP_FROM_SIZE,
8
- HEADER_SIZE_TO_NUMBER,
9
7
  ICON_FROM_HEADER_SIZE,
10
8
  PADDING_FROM_SIZE,
11
9
  RADIUS_FROM_SIZE,
@@ -19,7 +17,6 @@ import {
19
17
  getMainBackgroundColor,
20
18
  getReadableColor,
21
19
  } from '../../helpers/colors';
22
- import { isActionShown } from '../../helpers/utils';
23
20
  import { useCombinedRefs } from '../../hooks/useCombinedRefs';
24
21
  import { useReqoreTheme } from '../../hooks/useTheme';
25
22
  import { useTooltip } from '../../hooks/useTooltip';
@@ -28,7 +25,6 @@ import {
28
25
  IReqoreIntent,
29
26
  IWithReqoreCustomTheme,
30
27
  IWithReqoreFlat,
31
- IWithReqoreFluid,
32
28
  IWithReqoreSize,
33
29
  IWithReqoreTooltip,
34
30
  } from '../../types/global';
@@ -41,20 +37,17 @@ import { IReqoreDropdownItem } from '../Dropdown/list';
41
37
  import { IReqoreEffect, StyledEffect, TReqoreEffectColor } from '../Effect';
42
38
  import { ReqoreHeading } from '../Header';
43
39
  import ReqoreIcon, { StyledIconWrapper } from '../Icon';
44
- import { ReqoreHorizontalSpacer, ReqoreSpacer } from '../Spacer';
40
+ import { ReqoreSpacer } from '../Spacer';
45
41
 
46
42
  export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreTooltip, IReqoreIntent {
47
43
  label?: string | number;
48
44
  onClick?: () => void;
49
- group?: IReqorePanelAction[];
50
45
  actions?: Omit<IReqoreDropdownItem[], 'value'>;
51
46
  // Custom react element
52
47
  as?: React.ElementType;
53
- props?: { [key: string | number]: any } | undefined;
48
+ props?: any;
54
49
  // Hide the action if the condition is false
55
50
  show?: boolean;
56
- // Hide the action if the group is too small
57
- responsive?: boolean;
58
51
  }
59
52
 
60
53
  export interface IReqorePanelBottomAction extends IReqorePanelAction {
@@ -62,8 +55,6 @@ export interface IReqorePanelBottomAction extends IReqorePanelAction {
62
55
  }
63
56
 
64
57
  export interface IReqorePanelContent {}
65
- export type TReqorePanelActions = IReqorePanelAction[];
66
- export type TReqorePanelBottomActions = IReqorePanelBottomAction[];
67
58
 
68
59
  export interface IReqorePanelProps
69
60
  extends IWithReqoreSize,
@@ -71,7 +62,6 @@ export interface IReqorePanelProps
71
62
  IWithReqoreFlat,
72
63
  IReqoreIntent,
73
64
  IWithReqoreTooltip,
74
- IWithReqoreFluid,
75
65
  React.HTMLAttributes<HTMLDivElement> {
76
66
  as?: any;
77
67
  children?: any;
@@ -82,8 +72,8 @@ export interface IReqorePanelProps
82
72
  isCollapsed?: boolean;
83
73
  onClose?: () => void;
84
74
  rounded?: boolean;
85
- actions?: TReqorePanelActions;
86
- bottomActions?: TReqorePanelBottomActions;
75
+ actions?: (IReqorePanelAction | IReqorePanelAction[])[];
76
+ bottomActions?: IReqorePanelBottomAction[];
87
77
  unMountContentOnCollapse?: boolean;
88
78
  onCollapseChange?: (isCollapsed?: boolean) => void;
89
79
  fill?: boolean;
@@ -97,7 +87,6 @@ export interface IReqorePanelProps
97
87
  contentEffect?: IReqoreEffect;
98
88
  headerEffect?: IReqoreEffect;
99
89
  transparent?: boolean;
100
- iconColor?: TReqoreEffectColor;
101
90
  }
102
91
 
103
92
  export interface IStyledPanel extends IReqorePanelProps {
@@ -109,12 +98,12 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
109
98
  background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
110
99
  rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)};
111
100
  border-radius: ${({ rounded }) => (rounded ? RADIUS_FROM_SIZE.normal : 0)}px;
112
- border: ${({ theme, flat, intent }) =>
101
+ border: ${({ theme, flat, opacity = 1, intent }) =>
113
102
  flat && !intent
114
103
  ? undefined
115
- : `1px solid ${changeLightness(
116
- intent ? theme.intents[intent] : getMainBackgroundColor(theme),
117
- 0.2
104
+ : `1px solid ${rgba(
105
+ changeLightness(intent ? theme.intents[intent] : getMainBackgroundColor(theme), 0.2),
106
+ opacity
118
107
  )}`};
119
108
  color: ${({ theme }) => getReadableColor(theme, undefined, undefined, true)};
120
109
  overflow: hidden;
@@ -123,9 +112,7 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
123
112
  position: relative;
124
113
  backdrop-filter: ${({ blur, opacity }) => (blur && opacity < 1 ? `blur(${blur}px)` : undefined)};
125
114
  transition: 0.2s ease-in-out;
126
- width: ${({ fluid }) => (fluid ? '100%' : undefined)};
127
- max-width: 100%;
128
- flex: ${({ fluid }) => (fluid ? '1 auto' : '0 0 auto')};
115
+ flex: auto;
129
116
 
130
117
  ${({ interactive, theme, opacity = 1, flat, intent }) =>
131
118
  interactive
@@ -137,37 +124,35 @@ export const StyledPanel = styled(StyledEffect)<IStyledPanel>`
137
124
  transform: scale(${ACTIVE_ICON_SCALE});
138
125
  }
139
126
 
140
- background-color: ${opacity === 0 && flat
141
- ? undefined
142
- : rgba(
143
- darken(0.025, rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)),
144
- opacity
145
- )};
127
+ background-color: ${rgba(
128
+ darken(0.025, rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)),
129
+ opacity === 0 ? 0.2 : opacity
130
+ )};
146
131
 
147
132
  border-color: ${flat && !intent
148
133
  ? undefined
149
- : `${changeLightness(
150
- intent ? theme.intents[intent] : getMainBackgroundColor(theme),
151
- 0.25
134
+ : `${rgba(
135
+ changeLightness(
136
+ intent ? theme.intents[intent] : getMainBackgroundColor(theme),
137
+ 0.25
138
+ ),
139
+ opacity
152
140
  )}`};
153
141
 
154
- ${opacity !== 0 &&
155
- css`
156
- ${StyledCollectionItemContent}:after {
157
- background: linear-gradient(
158
- to top,
159
- ${rgba(
160
- darken(
161
- 0.025,
162
- rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)
163
- ),
164
- opacity
165
- )}
166
- 0%,
167
- transparent 100%
168
- );
169
- }
170
- `}
142
+ ${StyledCollectionItemContent}:after {
143
+ background: linear-gradient(
144
+ to top,
145
+ ${rgba(
146
+ darken(
147
+ 0.025,
148
+ rgba(changeDarkness(getMainBackgroundColor(theme), 0.03), opacity)
149
+ ),
150
+ opacity === 0 ? 0.2 : opacity
151
+ )}
152
+ 0%,
153
+ transparent 100%
154
+ );
155
+ }
171
156
  }
172
157
  `
173
158
  : undefined}
@@ -186,10 +171,12 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
186
171
  background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
187
172
  rgba(changeLightness(getMainBackgroundColor(theme), 0.03), opacity)};
188
173
  justify-content: space-between;
189
- min-height: 20px;
174
+ height: 40px;
190
175
  align-items: center;
191
- padding: ${({ noHorizontalPadding, size }: IStyledPanel) =>
192
- `${PADDING_FROM_SIZE[size]}px ${noHorizontalPadding ? 0 : `${PADDING_FROM_SIZE[size]}px`}`};
176
+ padding: ${({ noHorizontalPadding, contentSize }: IStyledPanel) =>
177
+ `0 ${noHorizontalPadding ? 0 : '5px'} 0 ${
178
+ noHorizontalPadding ? 0 : `${TEXT_FROM_SIZE[contentSize]}px`
179
+ }`};
193
180
  border-bottom: ${({ theme, isCollapsed, flat, opacity = 1 }) =>
194
181
  !isCollapsed && !flat
195
182
  ? `1px solid ${rgba(changeLightness(getMainBackgroundColor(theme), 0.2), opacity)}`
@@ -218,8 +205,7 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
218
205
  `;
219
206
 
220
207
  export const StyledPanelBottomActions = styled(StyledPanelTitle)`
221
- padding: ${({ noHorizontalPadding, size }: IStyledPanel) =>
222
- `${PADDING_FROM_SIZE[size]}px ${noHorizontalPadding ? 0 : `${PADDING_FROM_SIZE[size]}px`}`};
208
+ padding: ${({ noHorizontalPadding }: IStyledPanel) => `0 ${noHorizontalPadding ? 0 : '5px'}`};
223
209
  border-bottom: 0;
224
210
  border-top: ${({ theme, flat, opacity = 1 }) =>
225
211
  !flat
@@ -228,33 +214,29 @@ export const StyledPanelBottomActions = styled(StyledPanelTitle)`
228
214
  `;
229
215
 
230
216
  export const StyledPanelContent = styled.div<IStyledPanel>`
231
- display: ${({ isCollapsed }) => (isCollapsed ? 'none !important' : undefined)};
232
- padding: ${({ padded, size, noHorizontalPadding }) =>
217
+ display: ${({ isCollapsed }) => (isCollapsed ? 'none' : undefined)};
218
+ padding: ${({ padded, contentSize, noHorizontalPadding }) =>
233
219
  !padded
234
220
  ? undefined
235
221
  : noHorizontalPadding
236
- ? `${PADDING_FROM_SIZE[size]}px 0`
237
- : `${PADDING_FROM_SIZE[size]}px`};
222
+ ? `${TEXT_FROM_SIZE[contentSize]}px 0`
223
+ : `${TEXT_FROM_SIZE[contentSize]}px`};
238
224
  // The padding is not needed when the panel is minimal and has title, since
239
225
  // the title already has padding and is transparent
240
- padding-top: ${({ minimal, hasLabel, padded, size }) =>
241
- minimal && hasLabel && padded ? `${PADDING_FROM_SIZE[size] / 2}px` : undefined};
242
- padding-bottom: ${({ minimal, padded, size }) =>
243
- minimal && padded ? `${PADDING_FROM_SIZE[size]}px` : undefined};
226
+ padding-top: ${({ minimal, hasLabel, padded }) =>
227
+ minimal && hasLabel && padded ? '0px' : undefined};
228
+ padding-bottom: ${({ minimal, padded }) => (minimal && padded ? '10px' : undefined)};
244
229
  flex: 1;
245
230
  overflow: auto;
246
- font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
231
+ font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
247
232
  `;
248
233
 
249
234
  export const StyledPanelTitleHeader = styled.div`
250
235
  display: flex;
251
- justify-content: flex-start;
236
+ justify-content: center;
252
237
  align-items: center;
253
- padding-right: 5px;
254
- flex: 1 1 auto;
255
- width: 100%;
256
238
  overflow: hidden;
257
- min-width: 100px;
239
+ padding-right: 5px;
258
240
  `;
259
241
 
260
242
  export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
@@ -279,14 +261,11 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
279
261
  contentStyle,
280
262
  contentEffect,
281
263
  headerEffect = {},
282
- headerSize,
283
- contentSize,
264
+ headerSize = 4,
265
+ contentSize = 'normal',
284
266
  minimal,
285
267
  tooltip,
286
268
  badge,
287
- iconColor,
288
- fluid,
289
- size: panelSize = 'normal',
290
269
  ...rest
291
270
  }: IReqorePanelProps,
292
271
  ref
@@ -309,13 +288,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
309
288
 
310
289
  // Return true if the card has a title bar, otherwise return false.
311
290
  const hasTitleBar: boolean = useMemo(
312
- () =>
313
- !!label ||
314
- collapsible ||
315
- !!onClose ||
316
- !!size(actions.filter(isActionShown)) ||
317
- !!badge ||
318
- !!icon,
291
+ () => !!label || collapsible || !!onClose || !!size(actions) || !!badge,
319
292
  [label, collapsible, onClose, actions, badge]
320
293
  );
321
294
 
@@ -342,47 +315,21 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
342
315
 
343
316
  // Calculates whether or not the bottom actions should be displayed.
344
317
  const hasBottomActions: boolean = useMemo(
345
- () =>
346
- !!(
347
- size(leftBottomActions.filter(isActionShown)) ||
348
- size(rightBottomActions.filter(isActionShown))
349
- ),
318
+ () => !!(size(leftBottomActions) || size(rightBottomActions)),
350
319
  [leftBottomActions, rightBottomActions]
351
320
  );
352
321
 
353
- const renderResponsiveActions = useCallback(
354
- (action: IReqorePanelAction, index: number) => {
355
- return renderActions(action, index, true);
356
- },
357
- [actions]
358
- );
359
-
360
- const hasNonResponsiveActions = useCallback(
361
- (data: TReqorePanelActions) =>
362
- data.some((action) => action.responsive === false && action.show !== false),
363
- [actions, bottomActions]
364
- );
365
-
366
- const hasResponsiveActions = useCallback(
367
- (data: TReqorePanelActions) =>
368
- data.some((action) => action.responsive !== false && action.show !== false),
369
- [actions, bottomActions]
370
- );
371
-
372
- const renderNonResponsiveActions = useCallback(
373
- (action: IReqorePanelAction, index: number) => {
374
- return renderActions(action, index, false);
375
- },
376
- [actions]
377
- );
378
-
379
322
  const renderActions = useCallback(
380
- (action: IReqorePanelAction, index: number, includeResponsive) => {
381
- if (
382
- action.show === false ||
383
- (includeResponsive && action.responsive === false) ||
384
- (!includeResponsive && (action.responsive === true || !('responsive' in action)))
385
- ) {
323
+ (actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
324
+ if (Array.isArray(actionOrActions)) {
325
+ return (
326
+ <ReqoreControlGroup key={index} stack>
327
+ {actionOrActions.map(renderActions)}
328
+ </ReqoreControlGroup>
329
+ );
330
+ }
331
+
332
+ if (actionOrActions.show === false) {
386
333
  return null;
387
334
  }
388
335
 
@@ -393,38 +340,20 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
393
340
  intent,
394
341
  className,
395
342
  as: CustomElement,
396
- props = {},
397
- group,
343
+ props,
398
344
  ...rest
399
- }: IReqorePanelAction = action;
400
-
401
- if (size(group)) {
402
- return (
403
- <ReqoreControlGroup
404
- intent={intent}
405
- stack
406
- customTheme={rest.customTheme || theme}
407
- size={rest.size}
408
- fixed
409
- fluid={rest.fluid}
410
- key={index}
411
- >
412
- {group.map((action, index) => renderActions(action, index, true))}
413
- </ReqoreControlGroup>
414
- );
415
- }
345
+ }: IReqorePanelAction = actionOrActions;
416
346
 
417
347
  if (size(actions)) {
418
348
  return (
419
349
  <ReqoreDropdown<IReqoreButtonProps>
420
350
  {...rest}
421
351
  key={index}
422
- fixed
423
352
  label={label}
424
353
  items={actions}
425
354
  intent={intent}
426
355
  className={className}
427
- customTheme={rest.customTheme || theme}
356
+ customTheme={theme}
428
357
  onClick={(e: React.MouseEvent<HTMLButtonElement>) => e.stopPropagation()}
429
358
  id={id}
430
359
  />
@@ -434,10 +363,9 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
434
363
  if (CustomElement) {
435
364
  return (
436
365
  <CustomElement
437
- fixed
438
366
  {...props}
439
367
  key={index}
440
- customTheme={props.customTheme || theme}
368
+ customTheme={theme}
441
369
  onClick={(e: React.MouseEvent<any>) => {
442
370
  e.stopPropagation();
443
371
  props?.onClick?.(e);
@@ -450,10 +378,9 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
450
378
  <ReqoreButton
451
379
  {...rest}
452
380
  id={id}
453
- fixed
454
381
  key={index}
455
382
  className={className}
456
- customTheme={rest.customTheme || theme}
383
+ customTheme={theme}
457
384
  intent={intent}
458
385
  onClick={
459
386
  rest.onClick
@@ -482,7 +409,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
482
409
  const transformedContentEffect: IReqoreEffect = useMemo(() => {
483
410
  const newContentEffect: IReqoreEffect = { ...contentEffect };
484
411
 
485
- if (newContentEffect.gradient) {
412
+ if (newContentEffect?.gradient) {
486
413
  newContentEffect.gradient.borderColor = intent
487
414
  ? theme.intents[intent]
488
415
  : newContentEffect.gradient.borderColor;
@@ -494,7 +421,6 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
494
421
  }, [intent, theme, contentEffect, interactive]);
495
422
 
496
423
  const opacity = rest.transparent ? 0 : rest.opacity;
497
- const noHorizontalPadding = opacity === 0 && flat && !intent;
498
424
 
499
425
  return (
500
426
  <StyledPanel
@@ -510,7 +436,6 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
510
436
  theme={theme}
511
437
  effect={transformedContentEffect}
512
438
  opacity={opacity}
513
- fluid={fluid}
514
439
  >
515
440
  {hasTitleBar && (
516
441
  <StyledPanelTitle
@@ -520,24 +445,21 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
520
445
  className='reqore-panel-title'
521
446
  onClick={handleCollapseClick}
522
447
  theme={theme}
523
- size={contentSize || panelSize}
448
+ contentSize={contentSize}
524
449
  opacity={opacity ?? (minimal ? 0 : 1)}
525
- noHorizontalPadding={noHorizontalPadding}
450
+ noHorizontalPadding={opacity === 0}
526
451
  >
527
452
  <StyledPanelTitleHeader>
528
453
  {icon && (
529
454
  <ReqoreIcon
530
- size={`${
531
- ICON_FROM_HEADER_SIZE[headerSize || HEADER_SIZE_TO_NUMBER[panelSize]]
532
- }px`}
455
+ size={`${ICON_FROM_HEADER_SIZE[headerSize]}px`}
533
456
  icon={icon}
534
457
  margin='right'
535
- color={iconColor}
536
458
  />
537
459
  )}
538
460
  {typeof label === 'string' ? (
539
461
  <ReqoreHeading
540
- size={headerSize || panelSize}
462
+ size={headerSize}
541
463
  customTheme={theme}
542
464
  effect={{
543
465
  noWrap: true,
@@ -553,52 +475,34 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
553
475
  <>
554
476
  <ButtonBadge
555
477
  color={changeLightness(theme.main, 0.18)}
556
- size={panelSize}
478
+ size='big'
557
479
  content={badge}
558
480
  />
559
481
  <ReqoreSpacer width={PADDING_FROM_SIZE.normal} />
560
482
  </>
561
483
  ) : null}
562
484
  </StyledPanelTitleHeader>
563
- {hasResponsiveActions(actions) && (
564
- <ReqoreControlGroup
565
- responsive
566
- fluid
567
- horizontalAlign='flex-end'
568
- customTheme={theme}
569
- size={panelSize}
570
- >
571
- {actions.map(renderResponsiveActions)}
572
- </ReqoreControlGroup>
573
- )}
574
- {collapsible || onClose || hasNonResponsiveActions(actions) ? (
575
- <>
576
- <ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
577
- <ReqoreControlGroup fixed horizontalAlign='flex-end' size={panelSize}>
578
- {actions.map(renderNonResponsiveActions)}
579
- {collapsible && (
580
- <ReqoreButton
581
- customTheme={theme}
582
- icon={_isCollapsed ? 'ArrowDownSLine' : 'ArrowUpSLine'}
583
- onClick={handleCollapseClick}
584
- tooltip={_isCollapsed ? 'Expand' : 'Collapse'}
585
- fixed
586
- />
587
- )}
588
- {onClose && (
589
- <ReqoreButton
590
- fixed
591
- customTheme={theme}
592
- icon='CloseLine'
593
- onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
594
- e.stopPropagation();
595
- onClose?.();
596
- }}
597
- />
598
- )}
599
- </ReqoreControlGroup>
600
- </>
601
- ) : null}
485
+ <ReqoreControlGroup>
486
+ {actions.map(renderActions)}
487
+ {collapsible && (
488
+ <ReqoreButton
489
+ customTheme={theme}
490
+ icon={_isCollapsed ? 'ArrowDownSLine' : 'ArrowUpSLine'}
491
+ onClick={handleCollapseClick}
492
+ tooltip={_isCollapsed ? 'Expand' : 'Collapse'}
493
+ />
494
+ )}
495
+ {onClose && (
496
+ <ReqoreButton
497
+ customTheme={theme}
498
+ icon='CloseLine'
499
+ onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
500
+ e.stopPropagation();
501
+ onClose?.();
502
+ }}
503
+ />
504
+ )}
505
+ </ReqoreControlGroup>
602
506
  </StyledPanelTitle>
603
507
  )}
604
508
  {!_isCollapsed || (_isCollapsed && !unMountContentOnCollapse) ? (
@@ -610,8 +514,8 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
610
514
  style={contentStyle}
611
515
  padded={padded}
612
516
  minimal={minimal}
613
- size={contentSize || panelSize}
614
- noHorizontalPadding={noHorizontalPadding}
517
+ contentSize={contentSize}
518
+ noHorizontalPadding={opacity === 0}
615
519
  >
616
520
  {children}
617
521
  </StyledPanelContent>
@@ -622,41 +526,10 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
622
526
  className='reqore-panel-bottom-actions'
623
527
  theme={theme}
624
528
  opacity={opacity ?? (minimal ? 0 : 1)}
625
- size={contentSize || panelSize}
626
- noHorizontalPadding={noHorizontalPadding}
529
+ noHorizontalPadding={opacity === 0}
627
530
  >
628
- {hasNonResponsiveActions(leftBottomActions) ? (
629
- <>
630
- <ReqoreControlGroup size={panelSize}>
631
- {leftBottomActions.map(renderNonResponsiveActions)}
632
- </ReqoreControlGroup>
633
- <ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
634
- </>
635
- ) : null}
636
- {hasResponsiveActions(leftBottomActions) && (
637
- <ReqoreControlGroup fluid responsive customTheme={theme} size={panelSize}>
638
- {leftBottomActions.map(renderResponsiveActions)}
639
- </ReqoreControlGroup>
640
- )}
641
- {hasResponsiveActions(rightBottomActions) && (
642
- <ReqoreControlGroup
643
- fluid
644
- horizontalAlign='flex-end'
645
- responsive
646
- customTheme={theme}
647
- size={panelSize}
648
- >
649
- {rightBottomActions.map(renderResponsiveActions)}
650
- </ReqoreControlGroup>
651
- )}
652
- {hasNonResponsiveActions(rightBottomActions) ? (
653
- <>
654
- <ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
655
- <ReqoreControlGroup horizontalAlign='flex-end' size={panelSize}>
656
- {rightBottomActions.map(renderNonResponsiveActions)}
657
- </ReqoreControlGroup>
658
- </>
659
- ) : null}
531
+ <ReqoreControlGroup>{leftBottomActions.map(renderActions)}</ReqoreControlGroup>
532
+ <ReqoreControlGroup>{rightBottomActions.map(renderActions)}</ReqoreControlGroup>
660
533
  </StyledPanelBottomActions>
661
534
  ) : null}
662
535
  </StyledPanel>
@@ -8,6 +8,7 @@ export interface IReqorePopoverProps extends IReqoreComponent, IPopoverOptions {
8
8
  componentProps?: any;
9
9
  children?: any;
10
10
  isReqoreComponent?: boolean;
11
+ noWrapper?: boolean;
11
12
  wrapperTag?: string;
12
13
  wrapperStyle?: React.CSSProperties;
13
14
  }
@@ -22,6 +23,7 @@ const Popover = memo(
22
23
  componentProps,
23
24
  children,
24
25
  isReqoreComponent,
26
+ noWrapper,
25
27
  wrapperTag = 'span',
26
28
  wrapperStyle = {},
27
29
  passPopoverData,
@@ -37,7 +39,7 @@ const Popover = memo(
37
39
  passPopoverData?.(popoverData);
38
40
  }, [popoverData]);
39
41
 
40
- if (isReqoreComponent) {
42
+ if (isReqoreComponent || noWrapper) {
41
43
  return (
42
44
  <Component
43
45
  {...componentProps}