@qoretechnologies/reqore 0.30.1 → 0.30.3

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 (62) hide show
  1. package/__tests__/collection.test.tsx +1 -1
  2. package/__tests__/panel.test.tsx +74 -0
  3. package/__tests__/tabs.test.tsx +43 -0
  4. package/dist/components/Checkbox/index.js +1 -1
  5. package/dist/components/Collection/index.d.ts.map +1 -1
  6. package/dist/components/Collection/index.js +21 -22
  7. package/dist/components/Collection/index.js.map +1 -1
  8. package/dist/components/Collection/item.d.ts +1 -1
  9. package/dist/components/Collection/item.d.ts.map +1 -1
  10. package/dist/components/Collection/item.js +7 -7
  11. package/dist/components/Collection/item.js.map +1 -1
  12. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  13. package/dist/components/ControlGroup/index.js +7 -25
  14. package/dist/components/ControlGroup/index.js.map +1 -1
  15. package/dist/components/Drawer/index.d.ts +1 -1
  16. package/dist/components/Drawer/index.d.ts.map +1 -1
  17. package/dist/components/InternalPopover/index.js +1 -1
  18. package/dist/components/InternalPopover/index.js.map +1 -1
  19. package/dist/components/Menu/index.d.ts.map +1 -1
  20. package/dist/components/Menu/index.js +1 -1
  21. package/dist/components/Menu/index.js.map +1 -1
  22. package/dist/components/Panel/index.d.ts +5 -2
  23. package/dist/components/Panel/index.d.ts.map +1 -1
  24. package/dist/components/Panel/index.js +44 -42
  25. package/dist/components/Panel/index.js.map +1 -1
  26. package/dist/components/Tag/index.d.ts +2 -2
  27. package/dist/components/Tag/index.d.ts.map +1 -1
  28. package/dist/components/Tag/index.js.map +1 -1
  29. package/dist/constants/sizes.js +3 -3
  30. package/dist/constants/sizes.js.map +1 -1
  31. package/dist/containers/PopoverProvider.d.ts.map +1 -1
  32. package/dist/containers/PopoverProvider.js +10 -8
  33. package/dist/containers/PopoverProvider.js.map +1 -1
  34. package/dist/helpers/utils.d.ts +2 -0
  35. package/dist/helpers/utils.d.ts.map +1 -1
  36. package/dist/helpers/utils.js +3 -1
  37. package/dist/helpers/utils.js.map +1 -1
  38. package/dist/hooks/usePopover.js +4 -4
  39. package/dist/hooks/usePopover.js.map +1 -1
  40. package/dist/types/global.d.ts +13 -0
  41. package/dist/types/global.d.ts.map +1 -1
  42. package/package.json +6 -1
  43. package/src/components/Checkbox/index.tsx +1 -1
  44. package/src/components/Collection/index.tsx +25 -28
  45. package/src/components/Collection/item.tsx +0 -2
  46. package/src/components/ControlGroup/index.tsx +10 -28
  47. package/src/components/Drawer/index.tsx +1 -1
  48. package/src/components/InternalPopover/index.tsx +2 -2
  49. package/src/components/Menu/index.tsx +7 -1
  50. package/src/components/Panel/index.tsx +88 -58
  51. package/src/components/Tag/index.tsx +3 -1
  52. package/src/constants/sizes.ts +3 -3
  53. package/src/containers/PopoverProvider.tsx +11 -8
  54. package/src/helpers/utils.ts +3 -0
  55. package/src/hooks/usePopover.tsx +4 -4
  56. package/src/mock/collectionData.tsx +2 -1
  57. package/src/stories/Checkbox/Checkbox.stories.tsx +2 -0
  58. package/src/stories/Drawer/Drawer.stories.tsx +6 -2
  59. package/src/stories/Panel/Panel.stories.tsx +66 -14
  60. package/src/stories/Tag/Tag.stories.tsx +2 -2
  61. package/src/types/global.ts +14 -0
  62. package/tests.json +1 -1
@@ -129,6 +129,19 @@ export interface IWithReqoreFluid {
129
129
  */
130
130
  fluid?: boolean;
131
131
  }
132
+ export interface IWithReqoreFixed {
133
+ /**
134
+ * If true, the component will be fixed in fluid containers
135
+ * @default false
136
+ * @type boolean
137
+ * @example
138
+ * <ReqoreInput fixed />
139
+ * <ReqoreInput fixed={true} />
140
+ * <ReqoreInput fixed={false} />
141
+ *
142
+ */
143
+ fixed?: boolean;
144
+ }
132
145
  export interface IWithReqoreMinimal {
133
146
  /**
134
147
  * If true, the component will be minimal
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MA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,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;CAAG;AAC1D,oBAAY,kBAAkB,GAAG,MAAM,GAAG,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoretechnologies/reqore",
3
- "version": "0.30.1",
3
+ "version": "0.30.3",
4
4
  "description": "ReQore is a highly theme-able and modular UI library for React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,6 +24,10 @@
24
24
  "qorus",
25
25
  "react"
26
26
  ],
27
+ "pre-push": [
28
+ "build:test",
29
+ "test"
30
+ ],
27
31
  "author": "Qore Technologies",
28
32
  "license": "ISC",
29
33
  "bugs": {
@@ -60,6 +64,7 @@
60
64
  "jest-github-actions-reporter": "^1.0.2",
61
65
  "npm-cli-login": "^0.1.1",
62
66
  "playwright": "^1.16.3",
67
+ "pre-push": "^0.1.4",
63
68
  "react": "^17.0.2",
64
69
  "react-dom": "^17.0.2",
65
70
  "react-test-renderer": "^17.0.2",
@@ -272,7 +272,7 @@ const Checkbox = forwardRef<HTMLDivElement, IReqoreCheckboxProps>(
272
272
  textSize: getOneLessSize(size),
273
273
  weight: 'bold',
274
274
  ...switchTextEffect,
275
- opacity: checked ? 0.8 : 1,
275
+ opacity: checked ? 0.3 : 1,
276
276
  } as IReqoreEffect
277
277
  }
278
278
  >
@@ -6,7 +6,7 @@ import { IReqoreIconName } from '../../types/icons';
6
6
  import { IReqoreColumnsProps, StyledColumns } from '../Columns';
7
7
  import ReqoreInput from '../Input';
8
8
  import ReqoreMessage from '../Message';
9
- import { IReqorePanelAction, IReqorePanelProps, ReqorePanel } from '../Panel';
9
+ import { IReqorePanelAction, IReqorePanelProps, ReqorePanel, TReqorePanelActions } from '../Panel';
10
10
  import { sortTableData } from '../Table/helpers';
11
11
  import { IReqoreCollectionItemProps, ReqoreCollectionItem } from './item';
12
12
 
@@ -134,10 +134,29 @@ export const ReqoreCollection = ({
134
134
  };
135
135
 
136
136
  const finalItems = filteredItems;
137
- const finalActions: (IReqorePanelAction[] | IReqorePanelAction)[] = useMemo(() => {
138
- let actions: (IReqorePanelAction[] | IReqorePanelAction)[] = rest.actions
139
- ? [...rest.actions]
140
- : [];
137
+ const finalActions: TReqorePanelActions = useMemo(() => {
138
+ let actions: TReqorePanelActions = rest.actions ? [...rest.actions] : [];
139
+
140
+ const toolbarGroup: IReqorePanelAction = {
141
+ responsive: false,
142
+ group: [
143
+ {
144
+ icon: _showAs === 'grid' ? 'ListOrdered' : 'GridLine',
145
+ onClick: () => setShowAs(_showAs === 'grid' ? 'list' : 'grid'),
146
+ tooltip: _showAs === 'grid' ? 'Show as list' : 'Show as grid',
147
+ disabled: !size(finalItems),
148
+ },
149
+ ],
150
+ };
151
+
152
+ if (sortable) {
153
+ toolbarGroup.group.push({
154
+ icon: sort === 'desc' ? 'SortDesc' : 'SortAsc',
155
+ onClick: () => setSort(sort === 'desc' ? 'asc' : 'desc'),
156
+ tooltip: sort === 'desc' ? 'Sort ascending' : 'Sort descending',
157
+ disabled: !size(finalItems),
158
+ });
159
+ }
141
160
 
142
161
  if (filterable) {
143
162
  actions = [
@@ -156,29 +175,7 @@ export const ReqoreCollection = ({
156
175
  ];
157
176
  }
158
177
 
159
- if (sortable) {
160
- actions = [
161
- ...actions,
162
- {
163
- icon: sort === 'desc' ? 'SortDesc' : 'SortAsc',
164
- onClick: () => setSort(sort === 'desc' ? 'asc' : 'desc'),
165
- tooltip: sort === 'desc' ? 'Sort ascending' : 'Sort descending',
166
- disabled: !size(finalItems),
167
- responsive: false,
168
- },
169
- ];
170
- }
171
-
172
- return [
173
- ...actions,
174
- {
175
- icon: _showAs === 'grid' ? 'ListOrdered' : 'GridLine',
176
- onClick: () => setShowAs(_showAs === 'grid' ? 'list' : 'grid'),
177
- tooltip: _showAs === 'grid' ? 'Show as list' : 'Show as grid',
178
- disabled: !size(finalItems),
179
- responsive: false,
180
- },
181
- ];
178
+ return [...actions, toolbarGroup];
182
179
  }, [filterable, handleQueryChange, query, rest.actions, _showAs, sort, sortable, finalItems]);
183
180
 
184
181
  return (
@@ -71,7 +71,6 @@ export const StyledCollectionItemContent = styled.div`
71
71
  export const ReqoreCollectionItem = ({
72
72
  flat = true,
73
73
  minimal = true,
74
- headerSize = 3,
75
74
  style,
76
75
  content,
77
76
  actions,
@@ -203,7 +202,6 @@ export const ReqoreCollectionItem = ({
203
202
  )}
204
203
  <ReqorePanel
205
204
  flat={flat}
206
- headerSize={headerSize}
207
205
  ref={ref}
208
206
  minimal={minimal}
209
207
  {...rest}
@@ -2,7 +2,7 @@ import { debounce } from 'lodash';
2
2
  import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { useMount, useUnmount } from 'react-use';
4
4
  import styled, { css } from 'styled-components';
5
- import { ReqoreButton, ReqoreModal } from '../..';
5
+ import { ReqoreButton, ReqoreDrawer } from '../..';
6
6
  import { GAP_FROM_SIZE, RADIUS_FROM_SIZE, TSizes } from '../../constants/sizes';
7
7
  import { IReqoreTheme } from '../../constants/theme';
8
8
  import {
@@ -131,12 +131,9 @@ const ReqoreControlGroup = memo(
131
131
 
132
132
  const [overflowingChildren, setOverflowingChildren] = useState<number | undefined>(0);
133
133
  const [lastReSize, setLastReSize] = useState<number>(0);
134
- const [isResizing, setIsResizing] = useState<boolean>(false);
135
134
  const [isOverflownDialogOpen, setIsOverflownDialogOpen] = useState<boolean>(false);
136
135
  const observer = useRef<ResizeObserver | null>(null);
137
136
  const ref = useRef<HTMLDivElement>(null);
138
- const resizeTimerObserver = useRef<ResizeObserver | null>(null);
139
- const resizingTimer = useRef<any>(null);
140
137
 
141
138
  const realChildCount = useMemo((): number => {
142
139
  let count = 0;
@@ -160,10 +157,10 @@ const ReqoreControlGroup = memo(
160
157
 
161
158
  const checkIfOverflowing = useCallback(() => {
162
159
  return (
160
+ ref.current &&
163
161
  ref.current.clientWidth > 40 &&
164
162
  !vertical &&
165
163
  responsive &&
166
- ref.current &&
167
164
  ref.current.scrollWidth > ref.current.clientWidth
168
165
  );
169
166
  }, [vertical, responsive, ref, children]);
@@ -180,18 +177,7 @@ const ReqoreControlGroup = memo(
180
177
  }, 200)
181
178
  );
182
179
 
183
- resizeTimerObserver.current = new ResizeObserver(() => {
184
- if (ref && ref.current) {
185
- setIsResizing(true);
186
- clearTimeout(resizingTimer.current);
187
- resizingTimer.current = setTimeout(() => {
188
- setIsResizing(false);
189
- }, 500);
190
- }
191
- });
192
-
193
180
  observer.current.observe(ref.current);
194
- resizeTimerObserver.current.observe(ref.current);
195
181
  }
196
182
  }
197
183
  });
@@ -200,12 +186,6 @@ const ReqoreControlGroup = memo(
200
186
  if (observer.current) {
201
187
  observer.current.disconnect();
202
188
  }
203
-
204
- if (resizeTimerObserver.current) {
205
- resizeTimerObserver.current.disconnect();
206
- }
207
-
208
- clearTimeout(resizingTimer.current);
209
189
  });
210
190
 
211
191
  useEffect(() => {
@@ -427,12 +407,12 @@ const ReqoreControlGroup = memo(
427
407
  customTheme={customTheme}
428
408
  tooltip={{
429
409
  content: `Show ${React.Children.count(overflownChildren)} hidden items`,
430
- closeOnAnyClick: true,
431
410
  }}
432
411
  fixed
412
+ active={isOverflownDialogOpen}
433
413
  onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
434
414
  e.stopPropagation();
435
- setIsOverflownDialogOpen(true);
415
+ setIsOverflownDialogOpen(!isOverflownDialogOpen);
436
416
  }}
437
417
  flat
438
418
  />,
@@ -444,26 +424,28 @@ const ReqoreControlGroup = memo(
444
424
  return (
445
425
  <>
446
426
  {isOverflownDialogOpen ? (
447
- <ReqoreModal
427
+ <ReqoreDrawer
448
428
  isOpen
449
429
  onClose={() => setIsOverflownDialogOpen(false)}
450
430
  flat
431
+ floating
451
432
  minimal
433
+ position='bottom'
452
434
  hasBackdrop={false}
453
- intent='info'
454
435
  label='Hidden items'
436
+ minSize='100px'
437
+ size='auto'
455
438
  >
456
439
  <ReqoreControlGroup fluid wrap>
457
440
  {overflownChildren}
458
441
  </ReqoreControlGroup>
459
- </ReqoreModal>
442
+ </ReqoreDrawer>
460
443
  ) : null}
461
444
  <StyledReqoreControlGroup
462
445
  {...rest}
463
446
  vertical={vertical}
464
447
  style={{
465
448
  overflowX: responsive ? 'auto' : undefined,
466
- visibility: isResizing ? 'hidden' : undefined,
467
449
  ...rest.style,
468
450
  }}
469
451
  size={size}
@@ -27,7 +27,7 @@ export interface IReqoreDrawerProps extends Omit<IReqorePanelProps, 'size'> {
27
27
  onClose?: () => void;
28
28
  onHideToggle?: (isHidden: boolean) => void;
29
29
  hasBackdrop?: boolean;
30
- size?: string;
30
+ size?: string | 'auto';
31
31
  maxSize?: string;
32
32
  minSize?: string;
33
33
  opacity?: number;
@@ -1,4 +1,4 @@
1
- import { isString } from 'lodash';
1
+ import { cloneDeep, isString } from 'lodash';
2
2
  import { rgba } from 'polished';
3
3
  import React, { MutableRefObject, memo, useContext, useEffect, useRef, useState } from 'react';
4
4
  import { usePopper } from 'react-popper';
@@ -187,7 +187,7 @@ const InternalPopover: React.FC<IReqoreInternalPopoverProps> = memo(
187
187
 
188
188
  useEffect(() => {
189
189
  if (popperRef.current) {
190
- updatePopover?.(id, { popperRef });
190
+ updatePopover?.(id, { popperRef: cloneDeep(popperRef) });
191
191
  }
192
192
  }, [popperRef]);
193
193
 
@@ -74,7 +74,13 @@ const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
74
74
 
75
75
  return (
76
76
  <ReqoreThemeProvider theme={theme}>
77
- <StyledReqoreMenu {...rest} position={position} ref={ref} theme={theme}>
77
+ <StyledReqoreMenu
78
+ {...rest}
79
+ position={position}
80
+ ref={ref}
81
+ theme={theme}
82
+ className={`${rest.className || ''} reqore-menu`}
83
+ >
78
84
  {React.Children.map(children, (child) => {
79
85
  return child
80
86
  ? // @ts-ignore
@@ -5,6 +5,7 @@ import { useUpdateEffect } from 'react-use';
5
5
  import styled, { css } from 'styled-components';
6
6
  import {
7
7
  GAP_FROM_SIZE,
8
+ HEADER_SIZE_TO_NUMBER,
8
9
  ICON_FROM_HEADER_SIZE,
9
10
  PADDING_FROM_SIZE,
10
11
  RADIUS_FROM_SIZE,
@@ -18,6 +19,7 @@ import {
18
19
  getMainBackgroundColor,
19
20
  getReadableColor,
20
21
  } from '../../helpers/colors';
22
+ import { isActionShown } from '../../helpers/utils';
21
23
  import { useCombinedRefs } from '../../hooks/useCombinedRefs';
22
24
  import { useReqoreTheme } from '../../hooks/useTheme';
23
25
  import { useTooltip } from '../../hooks/useTooltip';
@@ -44,6 +46,7 @@ import { ReqoreHorizontalSpacer, ReqoreSpacer } from '../Spacer';
44
46
  export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreTooltip, IReqoreIntent {
45
47
  label?: string | number;
46
48
  onClick?: () => void;
49
+ group?: IReqorePanelAction[];
47
50
  actions?: Omit<IReqoreDropdownItem[], 'value'>;
48
51
  // Custom react element
49
52
  as?: React.ElementType;
@@ -59,6 +62,8 @@ export interface IReqorePanelBottomAction extends IReqorePanelAction {
59
62
  }
60
63
 
61
64
  export interface IReqorePanelContent {}
65
+ export type TReqorePanelActions = IReqorePanelAction[];
66
+ export type TReqorePanelBottomActions = IReqorePanelBottomAction[];
62
67
 
63
68
  export interface IReqorePanelProps
64
69
  extends IWithReqoreSize,
@@ -77,8 +82,8 @@ export interface IReqorePanelProps
77
82
  isCollapsed?: boolean;
78
83
  onClose?: () => void;
79
84
  rounded?: boolean;
80
- actions?: (IReqorePanelAction | IReqorePanelAction[])[];
81
- bottomActions?: IReqorePanelBottomAction[];
85
+ actions?: TReqorePanelActions;
86
+ bottomActions?: TReqorePanelBottomActions;
82
87
  unMountContentOnCollapse?: boolean;
83
88
  onCollapseChange?: (isCollapsed?: boolean) => void;
84
89
  fill?: boolean;
@@ -181,12 +186,10 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
181
186
  background-color: ${({ theme, opacity = 1 }: IStyledPanel) =>
182
187
  rgba(changeLightness(getMainBackgroundColor(theme), 0.03), opacity)};
183
188
  justify-content: space-between;
184
- height: 40px;
189
+ min-height: 20px;
185
190
  align-items: center;
186
- padding: ${({ noHorizontalPadding, contentSize }: IStyledPanel) =>
187
- `0 ${noHorizontalPadding ? 0 : '5px'} 0 ${
188
- noHorizontalPadding ? 0 : `${TEXT_FROM_SIZE[contentSize]}px`
189
- }`};
191
+ padding: ${({ noHorizontalPadding, size }: IStyledPanel) =>
192
+ `${PADDING_FROM_SIZE[size]}px ${noHorizontalPadding ? 0 : `${PADDING_FROM_SIZE[size]}px`}`};
190
193
  border-bottom: ${({ theme, isCollapsed, flat, opacity = 1 }) =>
191
194
  !isCollapsed && !flat
192
195
  ? `1px solid ${rgba(changeLightness(getMainBackgroundColor(theme), 0.2), opacity)}`
@@ -215,7 +218,8 @@ export const StyledPanelTitle = styled.div<IStyledPanel>`
215
218
  `;
216
219
 
217
220
  export const StyledPanelBottomActions = styled(StyledPanelTitle)`
218
- 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`}`};
219
223
  border-bottom: 0;
220
224
  border-top: ${({ theme, flat, opacity = 1 }) =>
221
225
  !flat
@@ -225,21 +229,21 @@ export const StyledPanelBottomActions = styled(StyledPanelTitle)`
225
229
 
226
230
  export const StyledPanelContent = styled.div<IStyledPanel>`
227
231
  display: ${({ isCollapsed }) => (isCollapsed ? 'none !important' : undefined)};
228
- padding: ${({ padded, contentSize, noHorizontalPadding }) =>
232
+ padding: ${({ padded, size, noHorizontalPadding }) =>
229
233
  !padded
230
234
  ? undefined
231
235
  : noHorizontalPadding
232
- ? `${TEXT_FROM_SIZE[contentSize]}px 0`
233
- : `${TEXT_FROM_SIZE[contentSize]}px`};
236
+ ? `${PADDING_FROM_SIZE[size]}px 0`
237
+ : `${PADDING_FROM_SIZE[size]}px`};
234
238
  // The padding is not needed when the panel is minimal and has title, since
235
239
  // the title already has padding and is transparent
236
- padding-top: ${({ minimal, hasLabel, padded, contentSize }) =>
237
- minimal && hasLabel && padded ? `${TEXT_FROM_SIZE[contentSize] / 2}px` : undefined};
238
- padding-bottom: ${({ minimal, padded, contentSize }) =>
239
- minimal && padded ? `${TEXT_FROM_SIZE[contentSize]}px` : 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};
240
244
  flex: 1;
241
245
  overflow: auto;
242
- font-size: ${({ contentSize }) => TEXT_FROM_SIZE[contentSize]}px;
246
+ font-size: ${({ size }) => TEXT_FROM_SIZE[size]}px;
243
247
  `;
244
248
 
245
249
  export const StyledPanelTitleHeader = styled.div`
@@ -275,13 +279,14 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
275
279
  contentStyle,
276
280
  contentEffect,
277
281
  headerEffect = {},
278
- headerSize = 4,
279
- contentSize = 'normal',
282
+ headerSize,
283
+ contentSize,
280
284
  minimal,
281
285
  tooltip,
282
286
  badge,
283
287
  iconColor,
284
288
  fluid,
289
+ size: panelSize = 'normal',
285
290
  ...rest
286
291
  }: IReqorePanelProps,
287
292
  ref
@@ -304,7 +309,13 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
304
309
 
305
310
  // Return true if the card has a title bar, otherwise return false.
306
311
  const hasTitleBar: boolean = useMemo(
307
- () => !!label || collapsible || !!onClose || !!size(actions) || !!badge,
312
+ () =>
313
+ !!label ||
314
+ collapsible ||
315
+ !!onClose ||
316
+ !!size(actions.filter(isActionShown)) ||
317
+ !!badge ||
318
+ !!icon,
308
319
  [label, collapsible, onClose, actions, badge]
309
320
  );
310
321
 
@@ -331,55 +342,42 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
331
342
 
332
343
  // Calculates whether or not the bottom actions should be displayed.
333
344
  const hasBottomActions: boolean = useMemo(
334
- () => !!(size(leftBottomActions) || size(rightBottomActions)),
345
+ () =>
346
+ !!(
347
+ size(leftBottomActions.filter(isActionShown)) ||
348
+ size(rightBottomActions.filter(isActionShown))
349
+ ),
335
350
  [leftBottomActions, rightBottomActions]
336
351
  );
337
352
 
338
353
  const renderResponsiveActions = useCallback(
339
- (actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
340
- return renderActions(actionOrActions, index, true);
354
+ (action: IReqorePanelAction, index: number) => {
355
+ return renderActions(action, index, true);
341
356
  },
342
357
  [actions]
343
358
  );
344
359
 
345
360
  const hasNonResponsiveActions = useCallback(
346
- (data: (IReqorePanelAction[] | IReqorePanelAction)[]) =>
347
- data.some((action) => !Array.isArray(action) && action.responsive === false),
361
+ (data: TReqorePanelActions) =>
362
+ data.some((action) => action.responsive === false && action.show !== false),
348
363
  [actions, bottomActions]
349
364
  );
350
365
 
351
366
  const hasResponsiveActions = useCallback(
352
- (data: (IReqorePanelAction[] | IReqorePanelAction)[]) =>
353
- data.some((action) => Array.isArray(action) || action.responsive !== false),
367
+ (data: TReqorePanelActions) =>
368
+ data.some((action) => action.responsive !== false && action.show !== false),
354
369
  [actions, bottomActions]
355
370
  );
356
371
 
357
372
  const renderNonResponsiveActions = useCallback(
358
- (actionOrActions: IReqorePanelAction | IReqorePanelAction[], index: number) => {
359
- return renderActions(actionOrActions, index, false);
373
+ (action: IReqorePanelAction, index: number) => {
374
+ return renderActions(action, index, false);
360
375
  },
361
376
  [actions]
362
377
  );
363
378
 
364
379
  const renderActions = useCallback(
365
- (
366
- actionOrActions: IReqorePanelAction | IReqorePanelAction[],
367
- index: number,
368
- includeResponsive
369
- ) => {
370
- const action: IReqorePanelAction = Array.isArray(actionOrActions)
371
- ? {
372
- show: true,
373
- responsive: true,
374
- as: ReqoreControlGroup,
375
- props: {
376
- stack: true,
377
- fluid: true,
378
- children: actionOrActions.map(renderActions),
379
- },
380
- }
381
- : actionOrActions;
382
-
380
+ (action: IReqorePanelAction, index: number, includeResponsive) => {
383
381
  if (
384
382
  action.show === false ||
385
383
  (includeResponsive && action.responsive === false) ||
@@ -396,9 +394,26 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
396
394
  className,
397
395
  as: CustomElement,
398
396
  props = {},
397
+ group,
399
398
  ...rest
400
399
  }: IReqorePanelAction = action;
401
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
+ }
416
+
402
417
  if (size(actions)) {
403
418
  return (
404
419
  <ReqoreDropdown<IReqoreButtonProps>
@@ -467,7 +482,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
467
482
  const transformedContentEffect: IReqoreEffect = useMemo(() => {
468
483
  const newContentEffect: IReqoreEffect = { ...contentEffect };
469
484
 
470
- if (newContentEffect?.gradient) {
485
+ if (newContentEffect.gradient) {
471
486
  newContentEffect.gradient.borderColor = intent
472
487
  ? theme.intents[intent]
473
488
  : newContentEffect.gradient.borderColor;
@@ -505,14 +520,16 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
505
520
  className='reqore-panel-title'
506
521
  onClick={handleCollapseClick}
507
522
  theme={theme}
508
- contentSize={contentSize}
523
+ size={contentSize || panelSize}
509
524
  opacity={opacity ?? (minimal ? 0 : 1)}
510
525
  noHorizontalPadding={noHorizontalPadding}
511
526
  >
512
527
  <StyledPanelTitleHeader>
513
528
  {icon && (
514
529
  <ReqoreIcon
515
- size={`${ICON_FROM_HEADER_SIZE[headerSize]}px`}
530
+ size={`${
531
+ ICON_FROM_HEADER_SIZE[headerSize || HEADER_SIZE_TO_NUMBER[panelSize]]
532
+ }px`}
516
533
  icon={icon}
517
534
  margin='right'
518
535
  color={iconColor}
@@ -520,7 +537,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
520
537
  )}
521
538
  {typeof label === 'string' ? (
522
539
  <ReqoreHeading
523
- size={headerSize}
540
+ size={headerSize || panelSize}
524
541
  customTheme={theme}
525
542
  effect={{
526
543
  noWrap: true,
@@ -536,7 +553,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
536
553
  <>
537
554
  <ButtonBadge
538
555
  color={changeLightness(theme.main, 0.18)}
539
- size='big'
556
+ size={panelSize}
540
557
  content={badge}
541
558
  />
542
559
  <ReqoreSpacer width={PADDING_FROM_SIZE.normal} />
@@ -544,14 +561,20 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
544
561
  ) : null}
545
562
  </StyledPanelTitleHeader>
546
563
  {hasResponsiveActions(actions) && (
547
- <ReqoreControlGroup responsive fluid horizontalAlign='flex-end' customTheme={theme}>
564
+ <ReqoreControlGroup
565
+ responsive
566
+ fluid
567
+ horizontalAlign='flex-end'
568
+ customTheme={theme}
569
+ size={panelSize}
570
+ >
548
571
  {actions.map(renderResponsiveActions)}
549
572
  </ReqoreControlGroup>
550
573
  )}
551
574
  {collapsible || onClose || hasNonResponsiveActions(actions) ? (
552
575
  <>
553
576
  <ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
554
- <ReqoreControlGroup fixed horizontalAlign='flex-end'>
577
+ <ReqoreControlGroup fixed horizontalAlign='flex-end' size={panelSize}>
555
578
  {actions.map(renderNonResponsiveActions)}
556
579
  {collapsible && (
557
580
  <ReqoreButton
@@ -587,7 +610,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
587
610
  style={contentStyle}
588
611
  padded={padded}
589
612
  minimal={minimal}
590
- contentSize={contentSize}
613
+ size={contentSize || panelSize}
591
614
  noHorizontalPadding={noHorizontalPadding}
592
615
  >
593
616
  {children}
@@ -599,30 +622,37 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
599
622
  className='reqore-panel-bottom-actions'
600
623
  theme={theme}
601
624
  opacity={opacity ?? (minimal ? 0 : 1)}
625
+ size={contentSize || panelSize}
602
626
  noHorizontalPadding={noHorizontalPadding}
603
627
  >
604
628
  {hasNonResponsiveActions(leftBottomActions) ? (
605
629
  <>
606
- <ReqoreControlGroup>
630
+ <ReqoreControlGroup size={panelSize}>
607
631
  {leftBottomActions.map(renderNonResponsiveActions)}
608
632
  </ReqoreControlGroup>
609
633
  <ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
610
634
  </>
611
635
  ) : null}
612
636
  {hasResponsiveActions(leftBottomActions) && (
613
- <ReqoreControlGroup fluid responsive customTheme={theme}>
637
+ <ReqoreControlGroup fluid responsive customTheme={theme} size={panelSize}>
614
638
  {leftBottomActions.map(renderResponsiveActions)}
615
639
  </ReqoreControlGroup>
616
640
  )}
617
641
  {hasResponsiveActions(rightBottomActions) && (
618
- <ReqoreControlGroup fluid horizontalAlign='flex-end' responsive customTheme={theme}>
642
+ <ReqoreControlGroup
643
+ fluid
644
+ horizontalAlign='flex-end'
645
+ responsive
646
+ customTheme={theme}
647
+ size={panelSize}
648
+ >
619
649
  {rightBottomActions.map(renderResponsiveActions)}
620
650
  </ReqoreControlGroup>
621
651
  )}
622
652
  {hasNonResponsiveActions(rightBottomActions) ? (
623
653
  <>
624
654
  <ReqoreHorizontalSpacer width={GAP_FROM_SIZE.normal} />
625
- <ReqoreControlGroup horizontalAlign='flex-end'>
655
+ <ReqoreControlGroup horizontalAlign='flex-end' size={panelSize}>
626
656
  {rightBottomActions.map(renderNonResponsiveActions)}
627
657
  </ReqoreControlGroup>
628
658
  </>
@@ -26,6 +26,7 @@ import {
26
26
  IReqoreDisabled,
27
27
  IReqoreIntent,
28
28
  IWithReqoreEffect,
29
+ IWithReqoreFixed,
29
30
  IWithReqoreFluid,
30
31
  IWithReqoreMinimal,
31
32
  IWithReqoreTooltip,
@@ -46,7 +47,8 @@ export interface IReqoreTagProps
46
47
  IReqoreDisabled,
47
48
  IWithReqoreEffect,
48
49
  IWithReqoreMinimal,
49
- IWithReqoreFluid {
50
+ IWithReqoreFluid,
51
+ IWithReqoreFixed {
50
52
  size?: TSizes;
51
53
  label?: string | number;
52
54
  labelKey?: string | number;