@qoretechnologies/reqore 0.37.3 → 0.37.5

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.
@@ -1,7 +1,8 @@
1
- import { keys } from 'lodash';
1
+ import { keys, size } from 'lodash';
2
2
  import { useMemo } from 'react';
3
- import { SIZE_TO_PX } from '../../constants/sizes';
3
+ import { TABLE_SIZE_TO_PX } from '../../constants/sizes';
4
4
  import { TReqoreIntent } from '../../constants/theme';
5
+ import { IReqoreTooltip } from '../../types/global';
5
6
  import { IReqoreIconName } from '../../types/icons';
6
7
  import { IReqoreButtonProps } from '../Button';
7
8
  import { IReqoreExportModalProps } from '../ExportModal';
@@ -45,16 +46,21 @@ export interface IReqoreKeyValueTableProps
45
46
 
46
47
  keyLabel?: string;
47
48
  keyIcon?: IReqoreIconName;
49
+ keyTooltip?: (key: string | number) => string | IReqoreTooltip;
48
50
  keyColumnIntent?: TReqoreIntent;
49
51
  keyAlign?: IReqoreTableColumn['align'];
50
52
  maxKeyWidth?: number;
51
53
 
52
54
  sortable?: boolean;
53
55
 
54
- rowActions?: (key: string, value: TReqoreKeyValueTableValue) => IReqoreButtonProps[];
56
+ rowActions?: (
57
+ key: string,
58
+ value: TReqoreKeyValueTableValue
59
+ ) => Omit<IReqoreButtonProps, 'rightIcon' | 'label' | 'children'>[];
55
60
 
56
61
  valueLabel?: string;
57
62
  valueIcon?: IReqoreIconName;
63
+ valueTooltip?: (value: TReqoreKeyValueTableValue) => string | IReqoreTooltip;
58
64
  valueAlign?: IReqoreTableColumn['align'];
59
65
  minValueWidth?: number;
60
66
  defaultValueFilter?: string | number;
@@ -74,8 +80,10 @@ export const ReqoreKeyValueTable = ({
74
80
  keyLabel,
75
81
  keyIcon,
76
82
  keyRenderer,
83
+ keyTooltip,
77
84
  valueLabel,
78
85
  valueIcon,
86
+ valueTooltip,
79
87
  valueRenderer,
80
88
  keyColumnIntent,
81
89
  minValueWidth = 100,
@@ -106,6 +114,7 @@ export const ReqoreKeyValueTable = ({
106
114
  },
107
115
 
108
116
  cell: {
117
+ tooltip: keyTooltip ? (cellValue) => keyTooltip(cellValue) : undefined,
109
118
  content: keyRenderer ? ({ tableKey }) => keyRenderer(tableKey) : 'title',
110
119
  },
111
120
  },
@@ -126,12 +135,7 @@ export const ReqoreKeyValueTable = ({
126
135
  },
127
136
 
128
137
  cell: {
129
- tooltip: (value) => ({
130
- content: JSON.stringify(value),
131
- noArrow: true,
132
- useTargetWidth: true,
133
- delay: 400,
134
- }),
138
+ tooltip: valueTooltip ? (cellValue) => valueTooltip(cellValue) : undefined,
135
139
  content: (data) =>
136
140
  valueRenderer?.(data, ReqoreTableValue) || <ReqoreTableValue value={data.value} />,
137
141
  },
@@ -146,7 +150,7 @@ export const ReqoreKeyValueTable = ({
146
150
  header: {
147
151
  icon: 'SettingsLine',
148
152
  },
149
- width: SIZE_TO_PX[rest.size || 'normal'] * 2,
153
+ width: size(rowActions('noop', 'noop')) * TABLE_SIZE_TO_PX[rest.size || 'normal'],
150
154
  align: 'center',
151
155
  cell: {
152
156
  padded: 'none',
@@ -122,6 +122,7 @@ export interface IReqorePanelProps
122
122
  getContentRef?: (ref: HTMLDivElement) => any;
123
123
 
124
124
  headerProps?: React.HTMLAttributes<unknown>;
125
+ showHeaderTooltip?: boolean;
125
126
  }
126
127
 
127
128
  export interface IStyledPanel extends IReqorePanelProps {
@@ -357,6 +358,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
357
358
  disabled,
358
359
  breadcrumbs,
359
360
  showActionsWhenCollapsed = true,
361
+ showHeaderTooltip,
360
362
  ...rest
361
363
  }: IReqorePanelProps,
362
364
  ref
@@ -698,7 +700,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
698
700
  noWrap: true,
699
701
  ...headerEffect,
700
702
  }}
701
- tooltip={label}
703
+ tooltip={showHeaderTooltip ? label : undefined}
702
704
  >
703
705
  {label}
704
706
  </ReqoreHeading>
@@ -787,7 +789,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
787
789
  noHorizontalPadding={noHorizontalPadding}
788
790
  >
789
791
  {hasNonResponsiveActions(leftBottomActions) ? (
790
- <ReqoreControlGroup size={panelSize}>
792
+ <ReqoreControlGroup size={panelSize} style={{ marginRight: 'auto' }}>
791
793
  {leftBottomActions.map(renderNonResponsiveActions('flex-start'))}
792
794
  </ReqoreControlGroup>
793
795
  ) : null}
@@ -797,6 +799,7 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
797
799
  responsive={responsiveActions}
798
800
  customTheme={theme}
799
801
  size={panelSize}
802
+ style={{ marginRight: 'auto' }}
800
803
  >
801
804
  {leftBottomActions.map(renderResponsiveActions('flex-start'))}
802
805
  </ReqoreControlGroup>
@@ -807,13 +810,18 @@ export const ReqorePanel = forwardRef<HTMLDivElement, IReqorePanelProps>(
807
810
  horizontalAlign='flex-end'
808
811
  responsive={responsiveActions}
809
812
  customTheme={theme}
813
+ style={{ marginLeft: 'auto' }}
810
814
  size={panelSize}
811
815
  >
812
816
  {rightBottomActions.map(renderResponsiveActions())}
813
817
  </ReqoreControlGroup>
814
818
  )}
815
819
  {hasNonResponsiveActions(rightBottomActions) ? (
816
- <ReqoreControlGroup horizontalAlign='flex-end' size={panelSize}>
820
+ <ReqoreControlGroup
821
+ horizontalAlign='flex-end'
822
+ size={panelSize}
823
+ style={{ marginLeft: 'auto' }}
824
+ >
817
825
  {rightBottomActions.map(renderNonResponsiveActions())}
818
826
  </ReqoreControlGroup>
819
827
  ) : null}
@@ -88,7 +88,9 @@ export interface IReqoreTableColumn extends IReqoreIntent {
88
88
  onClick?: (cellValue: any) => void;
89
89
  tooltip?: (cellValue: any) => string | IReqoreTooltip;
90
90
  content?: TReqoreTableColumnContent;
91
- actions?: (data: IReqoreTableRowData) => IReqoreButtonProps[];
91
+ actions?: (
92
+ data: IReqoreTableRowData
93
+ ) => Omit<IReqoreButtonProps, 'children' | 'label' | 'rightIcon'>[];
92
94
  intent?: TReqoreIntent;
93
95
  padded?: 'both' | 'horizontal' | 'vertical' | 'none';
94
96
  };
@@ -5,6 +5,7 @@ import shortid from 'shortid';
5
5
  import { useContext } from 'use-context-selector';
6
6
  import { useReqoreProperty } from '..';
7
7
  import { IPopoverData } from '../containers/PopoverProvider';
8
+ import { IReqoreOptions } from '../containers/UIProvider';
8
9
  import PopoverContext from '../context/PopoverContext';
9
10
  import {
10
11
  IReqoreIntent,
@@ -58,6 +59,7 @@ export interface IPopover
58
59
  icon?: IReqoreIconName;
59
60
  title?: string;
60
61
  updater?: string | number;
62
+ uiScale?: IReqoreOptions['uiScale'];
61
63
  }
62
64
 
63
65
  export interface IPopoverOptions extends IPopover {
@@ -5,6 +5,7 @@ import ReqoreIcon from '../../components/Icon';
5
5
  import { IReqoreKeyValueTableProps, ReqoreKeyValueTable } from '../../components/KeyValueTable';
6
6
  import { IReqoreTableRowData, TReqoreTableColumnContent } from '../../components/Table';
7
7
  import { TReqorePaginationType } from '../../constants/paging';
8
+ import { sleep } from '../../helpers/utils';
8
9
  import { Exportable as ExportableTable } from '../Table/Table.stories';
9
10
  import { StoryMeta } from '../utils';
10
11
  import { CustomIntentArg, FlatArg, IntentArg, SizeArg, argManager } from '../utils/args';
@@ -178,6 +179,9 @@ export const AllFiltersActive: Story = {
178
179
  export const WithActions: Story = {
179
180
  args: {
180
181
  rowActions: () => [
182
+ {
183
+ icon: 'InformationLine',
184
+ },
181
185
  {
182
186
  icon: 'EditLine',
183
187
  },
@@ -231,6 +235,34 @@ export const DefaultPaging: Story = {
231
235
  },
232
236
  };
233
237
 
238
+ export const KeyTooltip: Story = {
239
+ args: {
240
+ keyTooltip: (key) => `Tooltip for ${key}`,
241
+ },
242
+ play: async () => {
243
+ await sleep(500);
244
+
245
+ await fireEvent.mouseEnter(document.querySelector('.reqore-table-cell'));
246
+ },
247
+ };
248
+
249
+ export const ValueTooltip: Story = {
250
+ args: {
251
+ valueTooltip: (value) => ({
252
+ content: `${JSON.stringify(value || 'No value')}`,
253
+ noArrow: true,
254
+ blur: true,
255
+ flat: false,
256
+ placement: 'top',
257
+ }),
258
+ },
259
+ play: async () => {
260
+ await sleep(500);
261
+
262
+ await fireEvent.mouseEnter(document.querySelectorAll('.reqore-table-cell')[23]);
263
+ },
264
+ };
265
+
234
266
  export const CustomColumnWidths: Story = {
235
267
  args: {
236
268
  minValueWidth: 500,
@@ -11,6 +11,9 @@ import { FlatArg, IconArg, IntentArg, SizeArg, argManager } from '../utils/args'
11
11
 
12
12
  const { createArg } = argManager<IReqorePanelProps>();
13
13
 
14
+ const message =
15
+ 'Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant. This system works for main characters who have started late, for alts, for players who have switched Covenants and are starting over, and for players who have simply missed weekly quests for earning Renown due to being away from the game. I am a message a very long message - Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant. This system works for main characters who have started late, for alts, for players who have switched Covenants and are starting over, and for players who have simply missed weekly quests for earning Renown due to being away from the game. I am a message a very long message - Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant. This system works for main characters who have started late, for alts, for players who have switched Covenants and are starting over, and for players who have simply missed weekly quests for earning Renown due to being away from the game. I am a message a very long message - Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant. This system works for main characters who have started late, for alts, for players who have switched Covenants and are starting over, and for players who have simply missed weekly quests for earning Renown due to being away from the game. I am a message a very long message - Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant. This system works for main characters who have started late, for alts, for players who have switched Covenants and are starting over, and for players who have simply missed weekly quests for earning Renown due to being away from the game. I am a message a very long message - Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant. This system works for main characters who have started late, for alts, for players who have switched Covenants and are starting over, and for players who have simply missed weekly quests for earning Renown due to being away from the game.';
16
+
14
17
  const meta = {
15
18
  title: 'Layout/Panel/Stories',
16
19
  component: ReqorePanel,
@@ -270,31 +273,7 @@ const Template: StoryFn<IReqorePanelProps> = (args: IReqorePanelProps) => {
270
273
  ]}
271
274
  {...args}
272
275
  >
273
- Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system
274
- of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant.
275
- This system works for main characters who have started late, for alts, for players who have
276
- switched Covenants and are starting over, and for players who have simply missed weekly quests
277
- for earning Renown due to being away from the game. I am a message a very long message -
278
- Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system
279
- of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant.
280
- This system works for main characters who have started late, for alts, for players who have
281
- switched Covenants and are starting over, and for players who have simply missed weekly quests
282
- for earning Renown due to being away from the game. I am a message a very long message -
283
- Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system
284
- of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant.
285
- This system works for main characters who have started late, for alts, for players who have
286
- switched Covenants and are starting over, and for players who have simply missed weekly quests
287
- for earning Renown due to being away from the game. I am a message a very long message -
288
- Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system
289
- of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant.
290
- This system works for main characters who have started late, for alts, for players who have
291
- switched Covenants and are starting over, and for players who have simply missed weekly quests
292
- for earning Renown due to being away from the game. I am a message a very long message -
293
- Shadowlands has mechanisms put in place for allowing players to catch up on Renown, the system
294
- of gaining favor and unlocking rewards, Campaign chapters, and soulbinds within your Covenant.
295
- This system works for main characters who have started late, for alts, for players who have
296
- switched Covenants and are starting over, and for players who have simply missed weekly quests
297
- for earning Renown due to being away from the game.
276
+ {args.children || message}
298
277
  </ReqorePanel>
299
278
  );
300
279
  };
@@ -426,11 +405,12 @@ export const ActionsShownOnHover: Story = {
426
405
  render: Template,
427
406
 
428
407
  args: {
429
- label: undefined,
408
+ style: { minWidth: 400, maxWidth: 600 },
409
+ label: 'This is a simple test to',
430
410
  collapsible: false,
431
- icon: undefined,
432
- badge: undefined,
411
+ responsiveActions: false,
433
412
  actions: [{ label: 'test', show: 'hover' }],
413
+ children: 'This is a panel',
434
414
  bottomActions: [
435
415
  {
436
416
  position: 'right',
@@ -28,6 +28,7 @@ export type AdditionalStorybookArgs = IReqoreUIProviderProps & {
28
28
  insideModal?: boolean;
29
29
  animatedButtons?: IReqoreUIProviderProps['options']['animations']['buttons'];
30
30
  animatedDialogs?: IReqoreUIProviderProps['options']['animations']['dialogs'];
31
+ globalUiScale?: IReqoreUIProviderProps['options']['uiScale'];
31
32
  };
32
33
 
33
34
  export type StoryMeta<