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