@qoretechnologies/reqore 0.33.0 → 0.34.1

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 (61) hide show
  1. package/__tests__/collection.test.tsx +22 -1
  2. package/__tests__/containers/paging.test.tsx +106 -0
  3. package/__tests__/hooks/useReqorePaging.test.tsx +4 -0
  4. package/__tests__/pagination.test.tsx +4 -0
  5. package/dist/components/Collection/index.d.ts +5 -9
  6. package/dist/components/Collection/index.d.ts.map +1 -1
  7. package/dist/components/Collection/index.js +30 -21
  8. package/dist/components/Collection/index.js.map +1 -1
  9. package/dist/components/Dropdown/index.d.ts +5 -1
  10. package/dist/components/Dropdown/index.d.ts.map +1 -1
  11. package/dist/components/Dropdown/index.js +2 -2
  12. package/dist/components/Dropdown/index.js.map +1 -1
  13. package/dist/components/Dropdown/list.d.ts +3 -1
  14. package/dist/components/Dropdown/list.d.ts.map +1 -1
  15. package/dist/components/Dropdown/list.js +13 -5
  16. package/dist/components/Dropdown/list.js.map +1 -1
  17. package/dist/components/Menu/index.d.ts +1 -0
  18. package/dist/components/Menu/index.d.ts.map +1 -1
  19. package/dist/components/Menu/index.js +4 -1
  20. package/dist/components/Menu/index.js.map +1 -1
  21. package/dist/components/Paging/index.d.ts +3 -1
  22. package/dist/components/Paging/index.d.ts.map +1 -1
  23. package/dist/components/Paging/index.js +31 -10
  24. package/dist/components/Paging/index.js.map +1 -1
  25. package/dist/components/Panel/index.d.ts +1 -0
  26. package/dist/components/Panel/index.d.ts.map +1 -1
  27. package/dist/components/Panel/index.js +16 -9
  28. package/dist/components/Panel/index.js.map +1 -1
  29. package/dist/constants/paging.d.ts +11 -4
  30. package/dist/constants/paging.d.ts.map +1 -1
  31. package/dist/constants/paging.js +7 -3
  32. package/dist/constants/paging.js.map +1 -1
  33. package/dist/containers/Paging.d.ts +15 -0
  34. package/dist/containers/Paging.d.ts.map +1 -0
  35. package/dist/containers/Paging.js +51 -0
  36. package/dist/containers/Paging.js.map +1 -0
  37. package/dist/hooks/usePaging.d.ts +1 -0
  38. package/dist/hooks/usePaging.d.ts.map +1 -1
  39. package/dist/hooks/usePaging.js +2 -0
  40. package/dist/hooks/usePaging.js.map +1 -1
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +3 -1
  44. package/dist/index.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/components/Collection/index.tsx +94 -89
  47. package/src/components/Dropdown/index.tsx +21 -12
  48. package/src/components/Dropdown/list.tsx +43 -24
  49. package/src/components/Menu/index.tsx +3 -2
  50. package/src/components/Paging/index.tsx +32 -4
  51. package/src/components/Panel/index.tsx +27 -16
  52. package/src/constants/paging.ts +27 -8
  53. package/src/containers/Paging.tsx +90 -0
  54. package/src/hooks/usePaging.ts +4 -0
  55. package/src/index.tsx +1 -0
  56. package/src/stories/Collection/Collection.stories.tsx +23 -2
  57. package/src/stories/Dropdown/Dropdown.stories.tsx +54 -35
  58. package/src/stories/Menu/Menu.stories.tsx +4 -0
  59. package/src/stories/Paging/Paging.stories.tsx +19 -1
  60. package/src/stories/Panel/Panel.stories.tsx +18 -1
  61. package/tests.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC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I,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
12
12
  }));
13
13
  exports.__esModule = true;
14
14
  exports.ReqoreVerticalSpacer = exports.ReqoreSpacer = exports.ReqoreHorizontalSpacer = exports.ReqoreSidebar = exports.ReqoreRadioGroup = exports.ReqorePopover = exports.ReqoreParagraph = exports.ReqoreP = exports.ReqorePanel = exports.ReqorePagination = exports.ReqoreNotification = exports.ReqoreNotificationsWrapper = exports.ReqoreNavbarItem = exports.ReqoreNavbarGroup = exports.ReqoreNavbarDivider = exports.ReqoreHeader = exports.ReqoreFooter = exports.ReqoreMultiSelect = exports.ReqoreModal = exports.ReqoreMessage = exports.ReqoreMenuItem = exports.ReqoreMenuDivider = exports.ReqoreMenu = exports.ReqoreLayoutContent = exports.ReqoreInput = exports.ReqoreIcon = exports.ReqoreHeading = exports.ReqoreH6 = exports.ReqoreH5 = exports.ReqoreH4 = exports.ReqoreH3 = exports.ReqoreH2 = exports.ReqoreH1 = exports.ReqoreTextEffect = exports.ReqoreEffect = exports.ReqoreDropdownItem = exports.ReqoreDropdownDivider = exports.ReqoreDropdown = exports.ReqoreDrawer = exports.ReqoreControlGroup = exports.ReqoreContent = exports.ReqoreCommentFeed = exports.ReqoreComment = exports.ReqoreColumn = exports.ReqoreColumns = exports.ReqoreCollection = exports.ReqoreCheckbox = exports.ReqoreButton = exports.ReqoreBreadcrumbsItem = exports.ReqoreBreadcrumbs = void 0;
15
- exports.useReqoreTheme = exports.useReqoreProperty = exports.useReqore = exports.useReqorePaging = exports.useLatestZIndex = exports.ReqoreThemeContext = exports.ReqoreContext = exports.ReqoreUIProvider = exports.ReqoreNotifications = exports.ReqoreIntents = exports.ReqoreSizes = exports.ReqoreColors = exports.ReqoreTree = exports.ReqoreTimeAgo = exports.ReqoreTextarea = exports.ReqoreTagGroup = exports.ReqoreTag = exports.ReqoreTabsList = exports.ReqoreTabsListItem = exports.ReqoreTabsContent = exports.ReqoreTabs = exports.ReqoreTable = exports.ReqoreSpinner = void 0;
15
+ exports.useReqoreTheme = exports.useReqoreProperty = exports.useReqore = exports.useReqorePaging = exports.useLatestZIndex = exports.ReqoreThemeContext = exports.ReqoreContext = exports.ReqoreUIProvider = exports.ReqoreNotifications = exports.ReqorePaginationContainer = exports.ReqoreIntents = exports.ReqoreSizes = exports.ReqoreColors = exports.ReqoreTree = exports.ReqoreTimeAgo = exports.ReqoreTextarea = exports.ReqoreTagGroup = exports.ReqoreTag = exports.ReqoreTabsList = exports.ReqoreTabsListItem = exports.ReqoreTabsContent = exports.ReqoreTabs = exports.ReqoreTable = exports.ReqoreSpinner = void 0;
16
16
  var Breadcrumbs_1 = require("./components/Breadcrumbs");
17
17
  __createBinding(exports, Breadcrumbs_1, "default", "ReqoreBreadcrumbs");
18
18
  var item_1 = require("./components/Breadcrumbs/item");
@@ -129,6 +129,8 @@ var sizes_1 = require("./constants/sizes");
129
129
  __createBinding(exports, sizes_1, "ReqoreSizes");
130
130
  var theme_1 = require("./constants/theme");
131
131
  __createBinding(exports, theme_1, "ReqoreIntents");
132
+ var Paging_2 = require("./containers/Paging");
133
+ __createBinding(exports, Paging_2, "ReqorePaginationContainer");
132
134
  var ReqoreProvider_1 = require("./containers/ReqoreProvider");
133
135
  __createBinding(exports, ReqoreProvider_1, "default", "ReqoreNotifications");
134
136
  var UIProvider_1 = require("./containers/UIProvider");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAAwE;AAA/D,wEAA4B;AACrC,sDAAiF;AAAxE,qEAAgC;AACzC,8CAA8D;AAArD,8DAAuB;AAChC,kDAAkE;AAAzD,kEAAyB;AAClC,sDAA2D;AAAlD,2DAAgB;AACzB,gDAAqD;AAA5C,qDAAa;AACtB,sDAA2D;AAAlD,mDAAY;AACrB,gDAAqD;AAA5C,qDAAa;AACtB,wDAA6D;AAApD,6DAAiB;AAC1B,gDAAgE;AAAvD,gEAAwB;AACjC,0DAA0E;AAAjE,0EAA6B;AACtC,8CAAmD;AAA1C,mDAAY;AACrB,kDAAkE;AAAzD,kEAAyB;AAClC,mDAAuF;AAA9E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 +1,6 @@
1
1
  {
2
2
  "name": "@qoretechnologies/reqore",
3
- "version": "0.33.0",
3
+ "version": "0.34.1",
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",
@@ -2,47 +2,25 @@ import { size } from 'lodash';
2
2
  import { useCallback, useMemo, useState } from 'react';
3
3
  import { useDebounce, useUpdateEffect } from 'react-use';
4
4
  import styled, { css } from 'styled-components';
5
- import { getPaginationOptionsFromType, TReqorePaginationType } from '../../constants/paging';
5
+ import { useReqoreProperty } from '../..';
6
+ import { TReqorePaginationType } from '../../constants/paging';
6
7
  import { PADDING_FROM_SIZE } from '../../constants/sizes';
7
- import { IReqorePagingOptions, useReqorePaging } from '../../hooks/usePaging';
8
+ import { ReqorePaginationContainer } from '../../containers/Paging';
8
9
  import { IReqoreIconName } from '../../types/icons';
9
10
  import { IReqoreColumnsProps, StyledColumns } from '../Columns';
11
+ import ReqoreControlGroup from '../ControlGroup';
10
12
  import ReqoreInput, { IReqoreInputProps } from '../Input';
11
13
  import ReqoreMessage from '../Message';
12
- import { IReqorePaginationComponentProps, ReqorePagination } from '../Paging';
13
14
  import { IReqorePanelAction, IReqorePanelProps, ReqorePanel, TReqorePanelActions } from '../Panel';
14
15
  import { ReqoreVerticalSpacer } from '../Spacer';
15
16
  import { sortTableData } from '../Table/helpers';
16
17
  import { IReqoreCollectionItemProps, ReqoreCollectionItem } from './item';
17
18
 
18
- export interface IReqoreCollectionPagingOptions
19
- extends Omit<IReqorePagingOptions<IReqoreCollectionItemProps>, 'items'>,
20
- IReqorePaginationComponentProps {
21
- pageControlsPosition?: 'top' | 'bottom' | 'both';
22
- }
23
-
24
- export interface IReqoreCollectionProps
25
- extends Pick<
26
- IReqorePanelProps,
27
- | 'size'
28
- | 'intent'
29
- | 'customTheme'
30
- | 'actions'
31
- | 'bottomActions'
32
- | 'label'
33
- | 'headerSize'
34
- | 'badge'
35
- | 'icon'
36
- | 'flat'
37
- | 'minimal'
38
- | 'transparent'
39
- | 'fluid'
40
- | 'responsiveActions'
41
- | 'padded'
42
- >,
43
- IReqoreColumnsProps {
19
+ export interface IReqoreCollectionProps extends IReqorePanelProps, IReqoreColumnsProps {
44
20
  items?: IReqoreCollectionItemProps[];
45
21
  inputProps?: IReqoreInputProps;
22
+ inputInTitle?: boolean;
23
+
46
24
  sortButtonProps?: IReqorePanelAction;
47
25
  displayButtonProps?: IReqorePanelAction;
48
26
  stacked?: boolean;
@@ -59,7 +37,8 @@ export interface IReqoreCollectionProps
59
37
 
60
38
  contentRenderer?: (
61
39
  children: React.ReactNode,
62
- items: IReqoreCollectionItemProps[]
40
+ items: IReqoreCollectionItemProps[],
41
+ searchInput?: React.ReactNode
63
42
  ) => React.ReactNode;
64
43
 
65
44
  onQueryChange?: (query: string) => void;
@@ -69,11 +48,12 @@ export interface IReqoreCollectionProps
69
48
  displayButtonTooltip?: (display?: 'list' | 'grid') => string;
70
49
  inputPlaceholder?: (items?: IReqoreCollectionItemProps[]) => string;
71
50
 
72
- paging?: TReqorePaginationType;
51
+ paging?: TReqorePaginationType<IReqoreCollectionItemProps>;
73
52
  }
74
53
 
75
54
  export const StyledCollectionWrapper = styled(StyledColumns)`
76
55
  height: ${({ height }) => (height ? `${height}` : 'auto')};
56
+ flex: ${({ fill }) => (fill ? 1 : undefined)};
77
57
 
78
58
  ${({ rounded, stacked }: IReqoreCollectionProps) =>
79
59
  (!rounded || stacked) &&
@@ -93,6 +73,7 @@ export const ReqoreCollection = ({
93
73
  fill,
94
74
  maxItemHeight,
95
75
  filterable,
76
+ inputInTitle = true,
96
77
  sortable,
97
78
  showSelectedFirst,
98
79
  inputProps,
@@ -105,19 +86,28 @@ export const ReqoreCollection = ({
105
86
  minimal,
106
87
  transparent = true,
107
88
  onQueryChange,
108
- contentRenderer = (children) => children,
89
+ contentRenderer = (children, _items, searchInput) => (
90
+ <>
91
+ {searchInput}
92
+ {!!searchInput && <ReqoreVerticalSpacer height={PADDING_FROM_SIZE.normal} />}
93
+ {children}
94
+ </>
95
+ ),
109
96
  searchDelay = 300,
110
97
  emptyMessage = 'No data in this collection, try changing your search query or filters',
111
98
  sortButtonTooltip = (sort) => (sort === 'desc' ? 'Sort ascending' : 'Sort descending'),
112
99
  displayButtonTooltip = (display) => (display === 'grid' ? 'Show as list' : 'Show as grid'),
113
100
  inputPlaceholder = (items) => `Search in ${size(items)} items`,
114
101
  paging,
102
+ height,
115
103
  ...rest
116
104
  }: IReqoreCollectionProps) => {
117
105
  const [_showAs, setShowAs] = useState<'list' | 'grid'>(showAs);
118
106
  const [sort, setSort] = useState<'asc' | 'desc'>('asc');
119
107
  const [query, setQuery] = useState<string>('');
120
108
  const [preQuery, setPreQuery] = useState<string>('');
109
+ const [contentRef, setContentRef] = useState<HTMLDivElement>(undefined);
110
+ const isMobile = useReqoreProperty('isMobile');
121
111
 
122
112
  useUpdateEffect(() => {
123
113
  setShowAs(showAs);
@@ -183,18 +173,6 @@ export const ReqoreCollection = ({
183
173
  });
184
174
  }, [items, query, sortedItems]);
185
175
 
186
- const {
187
- pagingOptions = {},
188
- componentOptions = {},
189
- pageControlsPosition,
190
- } = useMemo(() => getPaginationOptionsFromType(paging), [paging]);
191
-
192
- const { items: finalItems, ...pagingData } = useReqorePaging({
193
- items: filteredItems,
194
- ...pagingOptions,
195
- enabled: !!paging,
196
- });
197
-
198
176
  const handlePreQueryChange = (event: React.ChangeEvent<HTMLInputElement>) => {
199
177
  setPreQuery(event.target.value);
200
178
  };
@@ -204,13 +182,15 @@ export const ReqoreCollection = ({
204
182
 
205
183
  const toolbarGroup: IReqorePanelAction = {
206
184
  responsive: false,
185
+ fluid: isMobile,
207
186
  group: [
208
187
  {
209
188
  icon: _showAs === 'grid' ? 'ListUnordered' : 'GridLine',
210
189
  onClick: () => setShowAs(_showAs === 'grid' ? 'list' : 'grid'),
211
190
  tooltip: displayButtonTooltip(_showAs),
212
- disabled: !size(finalItems),
191
+ disabled: !size(filteredItems),
213
192
  textAlign: 'center',
193
+ fixed: !isMobile,
214
194
  ...displayButtonProps,
215
195
  },
216
196
  ],
@@ -221,13 +201,14 @@ export const ReqoreCollection = ({
221
201
  icon: sort === 'desc' ? 'SortDesc' : 'SortAsc',
222
202
  onClick: () => setSort(sort === 'desc' ? 'asc' : 'desc'),
223
203
  tooltip: sortButtonTooltip(sort),
224
- disabled: !size(finalItems),
204
+ disabled: !size(filteredItems),
225
205
  textAlign: 'center',
206
+ fixed: !isMobile,
226
207
  ...sortButtonProps,
227
208
  });
228
209
  }
229
210
 
230
- if (filterable) {
211
+ if (filterable && inputInTitle) {
231
212
  actions = [
232
213
  ...actions,
233
214
  {
@@ -251,56 +232,73 @@ export const ReqoreCollection = ({
251
232
  }
252
233
 
253
234
  return [...actions, toolbarGroup];
254
- }, [filterable, preQuery, query, rest.actions, _showAs, sort, sortable, finalItems]);
235
+ }, [filterable, preQuery, query, rest.actions, _showAs, sort, sortable, filteredItems, isMobile]);
255
236
 
256
237
  const renderContent = useCallback(() => {
257
238
  return contentRenderer(
258
239
  <>
259
- {!!paging && (pageControlsPosition === 'top' || pageControlsPosition === 'both') ? (
260
- <>
261
- <ReqorePagination size={rest.size} {...pagingData} {...componentOptions} />
262
- <ReqoreVerticalSpacer height={PADDING_FROM_SIZE[rest.size || 'normal']} />
263
- </>
264
- ) : null}
265
- {!size(finalItems) ? (
266
- <ReqoreMessage flat icon='Search2Line'>
267
- {emptyMessage}
268
- </ReqoreMessage>
269
- ) : (
270
- <StyledCollectionWrapper
271
- columns={_showAs === 'grid' ? 'auto-fit' : 1}
272
- columnsGap={stacked ? '0px' : columnsGap}
273
- rounded={rounded}
274
- stacked={stacked}
275
- {...rest}
276
- >
277
- {finalItems?.map((item, index) => (
278
- <ReqoreCollectionItem
279
- size={rest.size}
280
- {...item}
281
- icon={item.icon || (item.selected ? selectedIcon : undefined)}
282
- key={index}
283
- rounded={!stacked}
284
- maxContentHeight={maxItemHeight}
285
- />
286
- ))}
287
- </StyledCollectionWrapper>
288
- )}
289
- {!!paging &&
290
- (!pageControlsPosition ||
291
- pageControlsPosition === 'bottom' ||
292
- pageControlsPosition === 'both') ? (
293
- <>
294
- <ReqoreVerticalSpacer height={PADDING_FROM_SIZE[rest.size || 'normal']} />
295
- <ReqorePagination size={rest.size} {...pagingData} {...componentOptions} />
296
- </>
297
- ) : null}
240
+ <ReqorePaginationContainer
241
+ items={filteredItems}
242
+ type={paging}
243
+ size={rest.size}
244
+ scrollContainer={contentRef}
245
+ >
246
+ {(finalItems) => (
247
+ <>
248
+ {!size(finalItems) ? (
249
+ <ReqoreMessage flat icon='Search2Line'>
250
+ {emptyMessage}
251
+ </ReqoreMessage>
252
+ ) : (
253
+ <StyledCollectionWrapper
254
+ columns={_showAs === 'grid' ? 'auto-fit' : 1}
255
+ columnsGap={stacked ? '0px' : columnsGap}
256
+ rounded={rounded}
257
+ stacked={stacked}
258
+ fill={fill}
259
+ ref={setContentRef}
260
+ height={height}
261
+ >
262
+ {finalItems?.map((item, index) => (
263
+ <ReqoreCollectionItem
264
+ size={rest.size}
265
+ {...item}
266
+ icon={item.icon || (item.selected ? selectedIcon : undefined)}
267
+ key={index}
268
+ rounded={!stacked}
269
+ maxContentHeight={maxItemHeight}
270
+ />
271
+ ))}
272
+ </StyledCollectionWrapper>
273
+ )}
274
+ </>
275
+ )}
276
+ </ReqorePaginationContainer>
298
277
  </>,
299
- finalItems
278
+ filteredItems,
279
+ !inputInTitle && filterable ? (
280
+ <ReqoreControlGroup>
281
+ <ReqoreInput
282
+ key='search'
283
+ fixed={false}
284
+ placeholder={inputPlaceholder(items)}
285
+ onClearClick={() => {
286
+ setQuery('');
287
+ setPreQuery('');
288
+ }}
289
+ onChange={handlePreQueryChange}
290
+ value={preQuery}
291
+ icon='Search2Line'
292
+ minimal={false}
293
+ size={rest.size}
294
+ {...inputProps}
295
+ />
296
+ </ReqoreControlGroup>
297
+ ) : undefined
300
298
  );
301
299
  }, [
302
300
  contentRenderer,
303
- finalItems,
301
+ filteredItems,
304
302
  _showAs,
305
303
  columnsGap,
306
304
  emptyMessage,
@@ -312,6 +310,8 @@ export const ReqoreCollection = ({
312
310
  stacked,
313
311
  ]);
314
312
 
313
+ console.log(rest);
314
+
315
315
  return (
316
316
  <ReqorePanel
317
317
  {...rest}
@@ -320,6 +320,11 @@ export const ReqoreCollection = ({
320
320
  ...rest.style,
321
321
  }}
322
322
  fill={fill}
323
+ contentStyle={{
324
+ overflow: fill ? 'hidden' : 'auto',
325
+ display: 'flex',
326
+ flexFlow: 'column',
327
+ }}
323
328
  transparent={transparent}
324
329
  minimal={minimal}
325
330
  flat={flat}
@@ -1,10 +1,12 @@
1
1
  import { size } from 'lodash';
2
2
  import React, { memo, useMemo } from 'react';
3
- import { ReqorePopover } from '../..';
3
+ import { ReqorePanel, ReqorePopover } from '../..';
4
+ import { TReqorePaginationType } from '../../constants/paging';
4
5
  import { IPopoverOptions } from '../../hooks/usePopover';
5
6
  import { IReqoreIconName } from '../../types/icons';
6
7
  import ReqoreButton, { IReqoreButtonProps } from '../Button';
7
8
  import { IReqoreInputProps } from '../Input';
9
+ import { IReqorePanelProps } from '../Panel';
8
10
  import ReqoreDropdownList, { IReqoreDropdownItem, TDropdownItemOnClick } from './list';
9
11
 
10
12
  export interface IReqoreDropdownProps extends Partial<Omit<IPopoverOptions, 'openOnMount'>> {
@@ -25,7 +27,9 @@ export interface IReqoreDropdownProps extends Partial<Omit<IPopoverOptions, 'ope
25
27
  onItemSelect?: TDropdownItemOnClick;
26
28
  style?: React.CSSProperties;
27
29
  inputProps?: IReqoreInputProps;
30
+ wrapperProps?: IReqorePanelProps;
28
31
  scrollToSelected?: boolean;
32
+ paging?: TReqorePaginationType<IReqoreDropdownItem>;
29
33
  }
30
34
 
31
35
  function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
@@ -61,6 +65,8 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
61
65
  passPopoverData,
62
66
  inputProps,
63
67
  scrollToSelected,
68
+ wrapperProps,
69
+ paging,
64
70
  ...rest
65
71
  }: IReqoreDropdownProps & T) {
66
72
  const componentProps = useMemo(
@@ -78,17 +84,20 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
78
84
 
79
85
  const popoverContent = useMemo(() => {
80
86
  return size(items) ? (
81
- <ReqoreDropdownList
82
- multiSelect={multiSelect}
83
- listStyle={listStyle}
84
- width={useTargetWidth ? '100%' : listWidth}
85
- height={listHeight}
86
- items={items}
87
- filterable={filterable}
88
- onItemSelect={onItemSelect}
89
- inputProps={inputProps}
90
- scrollToSelected={scrollToSelected}
91
- />
87
+ <ReqorePanel flat size='small' {...wrapperProps}>
88
+ <ReqoreDropdownList
89
+ multiSelect={multiSelect}
90
+ listStyle={listStyle}
91
+ width={useTargetWidth ? '100%' : listWidth}
92
+ height={listHeight}
93
+ items={items}
94
+ filterable={filterable}
95
+ onItemSelect={onItemSelect}
96
+ inputProps={inputProps}
97
+ scrollToSelected={scrollToSelected}
98
+ paging={paging}
99
+ />
100
+ </ReqorePanel>
92
101
  ) : undefined;
93
102
  }, [items]);
94
103
 
@@ -1,9 +1,14 @@
1
+ import { size } from 'lodash';
1
2
  import React, { memo, useEffect, useMemo, useState } from 'react';
3
+ import { TReqorePaginationType } from '../../constants/paging';
4
+ import { PADDING_FROM_SIZE } from '../../constants/sizes';
5
+ import { ReqorePaginationContainer } from '../../containers/Paging';
2
6
  import { IReqoreComponent } from '../../types/global';
3
7
  import ReqoreInput, { IReqoreInputProps } from '../Input';
4
8
  import ReqoreMenu from '../Menu';
5
9
  import ReqoreMenuDivider from '../Menu/divider';
6
10
  import ReqoreMenuItem, { IReqoreMenuItemProps } from '../Menu/item';
11
+ import { ReqoreVerticalSpacer } from '../Spacer';
7
12
 
8
13
  export type TDropdownItemOnClick = (item: IReqoreDropdownItem) => void;
9
14
  export interface IReqoreDropdownItem
@@ -27,6 +32,7 @@ export interface IReqoreDropdownListProps extends IReqoreComponent {
27
32
  onItemSelect?: TDropdownItemOnClick;
28
33
  inputProps?: IReqoreInputProps;
29
34
  scrollToSelected?: boolean;
35
+ paging?: TReqorePaginationType<TReqoreDropdownItem>;
30
36
  }
31
37
 
32
38
  const ReqoreDropdownList = memo(
@@ -41,9 +47,11 @@ const ReqoreDropdownList = memo(
41
47
  onItemSelect,
42
48
  inputProps,
43
49
  scrollToSelected,
50
+ paging,
44
51
  }: IReqoreDropdownListProps) => {
45
52
  const [_items, setItems] = useState<TReqoreDropdownItems>(items);
46
53
  const [query, setQuery] = useState<string>('');
54
+ const [menuRef, setMenuRef] = useState<HTMLDivElement>(undefined);
47
55
 
48
56
  useEffect(() => {
49
57
  setItems(items);
@@ -84,40 +92,51 @@ const ReqoreDropdownList = memo(
84
92
  };
85
93
 
86
94
  return (
87
- <ReqoreMenu
88
- _insidePopover={!multiSelect}
89
- _popoverId={_popoverId}
90
- style={listStyle}
91
- width={width}
92
- maxHeight={height || '300px'}
93
- >
95
+ <>
94
96
  {filterable && (
95
97
  <>
96
98
  <ReqoreInput
97
99
  value={query}
100
+ icon='SearchLine'
98
101
  onChange={handleQueryChange}
99
- placeholder='Filter'
102
+ placeholder={`Search ${size(_items)} items...`}
100
103
  onClearClick={() => setQuery('')}
101
104
  {...inputProps}
102
105
  />
106
+ <ReqoreVerticalSpacer height={PADDING_FROM_SIZE.normal} />
103
107
  </>
104
108
  )}
105
- {filteredItems.map(
106
- ({ onClick, dividerAlign, divider, ...item }: IReqoreDropdownItem, index: number) =>
107
- divider ? (
108
- <ReqoreMenuDivider key={index} {...item} align={dividerAlign} />
109
- ) : (
110
- <ReqoreMenuItem
111
- key={index}
112
- {...item}
113
- label={item.label || item.value}
114
- onClick={() => handleItemClick({ ...item, onClick })}
115
- rightIcon={item.selected ? 'CheckLine' : undefined}
116
- scrollIntoView={scrollToSelected && item.selected && !multiSelect}
117
- />
118
- )
119
- )}
120
- </ReqoreMenu>
109
+ <ReqorePaginationContainer type={paging} items={filteredItems} scrollContainer={menuRef}>
110
+ {(finalItems, Controls, { includeBottomControls }) => (
111
+ <ReqoreMenu
112
+ _insidePopover={!multiSelect}
113
+ _popoverId={_popoverId}
114
+ style={listStyle}
115
+ width={width}
116
+ maxHeight={height || '300px'}
117
+ padded={false}
118
+ ref={setMenuRef}
119
+ >
120
+ {finalItems.map(
121
+ ({ onClick, dividerAlign, divider, ...item }: IReqoreDropdownItem, index: number) =>
122
+ divider ? (
123
+ <ReqoreMenuDivider key={index} {...item} align={dividerAlign} />
124
+ ) : (
125
+ <ReqoreMenuItem
126
+ key={index}
127
+ {...item}
128
+ label={item.label || item.value}
129
+ onClick={() => handleItemClick({ ...item, onClick })}
130
+ rightIcon={item.selected ? 'CheckLine' : undefined}
131
+ scrollIntoView={scrollToSelected && item.selected && !multiSelect}
132
+ />
133
+ )
134
+ )}
135
+ {!includeBottomControls && <Controls />}
136
+ </ReqoreMenu>
137
+ )}
138
+ </ReqorePaginationContainer>
139
+ </>
121
140
  );
122
141
  }
123
142
  );
@@ -21,6 +21,7 @@ export interface IReqoreMenuProps
21
21
  wrapText?: boolean;
22
22
  flat?: boolean;
23
23
  rounded?: boolean;
24
+ padded?: boolean;
24
25
  }
25
26
 
26
27
  export interface IReqoreMenuStyle extends IReqoreMenuProps {
@@ -30,7 +31,7 @@ export interface IReqoreMenuStyle extends IReqoreMenuProps {
30
31
  const StyledReqoreMenu = styled.div<IReqoreMenuStyle>`
31
32
  width: ${({ width }) => width || undefined};
32
33
  min-width: ${({ width }) => (width ? undefined : '160px')};
33
- padding: 5px;
34
+ padding: ${({ padded = true }) => (padded ? '5px' : undefined)};
34
35
  max-height: ${({ maxHeight }) => maxHeight || undefined};
35
36
  overflow-y: auto;
36
37
  overflow-x: hidden;
@@ -68,7 +69,7 @@ const ReqoreMenu = forwardRef<HTMLDivElement, IReqoreMenuProps>(
68
69
  minimal,
69
70
  ...rest
70
71
  }: IReqoreMenuProps,
71
- ref: any
72
+ ref
72
73
  ) => {
73
74
  const theme = useReqoreTheme('main', customTheme, intent);
74
75
 
@@ -27,6 +27,8 @@ export interface IReqorePaginationComponentProps
27
27
  showLabels?: boolean;
28
28
  scrollOnLoadMore?: boolean;
29
29
  autoLoadMore?: boolean;
30
+ scrollContainer?: HTMLElement;
31
+ scrollToTopOnPageChange?: boolean;
30
32
  }
31
33
  export interface IReqorePaginationProps<T>
32
34
  extends Omit<IReqorePagingResult<T>, 'items'>,
@@ -34,7 +36,7 @@ export interface IReqorePaginationProps<T>
34
36
 
35
37
  export const StyledPagesWrapper = styled(ReqoreControlGroup)`
36
38
  width: unset;
37
- max-width: 100%;
39
+ flex: 0 auto;
38
40
  justify-content: center;
39
41
 
40
42
  & > ${StyledButton} {
@@ -74,6 +76,9 @@ function Pagination<T>({
74
76
  scrollOnLoadMore,
75
77
  autoLoadMore,
76
78
  itemsPerPage,
79
+ renderControls,
80
+ scrollContainer,
81
+ scrollToTopOnPageChange = true,
77
82
  ...rest
78
83
  }: IReqorePaginationProps<T>) {
79
84
  const [loadMoreRef, setLoadMoreRef] = useState<HTMLButtonElement>(undefined);
@@ -90,6 +95,26 @@ function Pagination<T>({
90
95
  }
91
96
  }, [currentPage, scrollTargetRef, scrollOnLoadMore, isLastPage, isFirstPage]);
92
97
 
98
+ // Scroll to bottom on load more
99
+ useEffect(() => {
100
+ if (scrollContainer && scrollOnLoadMore && !isFirstPage) {
101
+ scrollContainer.scrollBy?.({
102
+ top: scrollContainer.scrollHeight,
103
+ behavior: 'smooth',
104
+ });
105
+ }
106
+ }, [currentPage, scrollContainer, scrollOnLoadMore, isFirstPage]);
107
+
108
+ // Scroll to top on page change
109
+ useEffect(() => {
110
+ if (scrollContainer && scrollToTopOnPageChange && !infinite) {
111
+ scrollContainer.scrollTo?.({
112
+ top: 0,
113
+ behavior: 'smooth',
114
+ });
115
+ }
116
+ }, [currentPage, scrollContainer, scrollToTopOnPageChange, infinite]);
117
+
93
118
  useUpdateEffect(() => {
94
119
  if (loadMoreRef && autoLoadMore) {
95
120
  observer.current = new IntersectionObserver(
@@ -113,7 +138,9 @@ function Pagination<T>({
113
138
  observer.current?.disconnect();
114
139
  });
115
140
 
116
- if (pageCount === 1 || pageCount === 0) return null;
141
+ if (!renderControls) {
142
+ return null;
143
+ }
117
144
 
118
145
  return (
119
146
  <ReqoreControlGroup
@@ -138,7 +165,8 @@ function Pagination<T>({
138
165
  {showLabels && loadMoreLabel}
139
166
  </ReqoreButton>
140
167
  </ReqoreControlGroup>
141
- ) : (
168
+ ) : null}
169
+ {!infinite ? (
142
170
  <>
143
171
  {showPagesAs === 'list' || (showControls && !showPages) ? (
144
172
  <ReqoreButton
@@ -224,7 +252,7 @@ function Pagination<T>({
224
252
  </ReqoreButton>
225
253
  ) : null}
226
254
  </>
227
- )}
255
+ ) : null}
228
256
  </ReqoreControlGroup>
229
257
  );
230
258
  }