@qoretechnologies/reqore 0.33.0 → 0.34.0
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.
- package/__tests__/collection.test.tsx +22 -1
- package/__tests__/containers/paging.test.tsx +106 -0
- package/__tests__/hooks/useReqorePaging.test.tsx +4 -0
- package/__tests__/pagination.test.tsx +4 -0
- package/dist/components/Collection/index.d.ts +1 -6
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +7 -15
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +5 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +3 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +13 -5
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +4 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Paging/index.d.ts +3 -1
- package/dist/components/Paging/index.d.ts.map +1 -1
- package/dist/components/Paging/index.js +31 -10
- package/dist/components/Paging/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +2 -2
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/constants/paging.d.ts +11 -4
- package/dist/constants/paging.d.ts.map +1 -1
- package/dist/constants/paging.js +7 -3
- package/dist/constants/paging.js.map +1 -1
- package/dist/containers/Paging.d.ts +15 -0
- package/dist/containers/Paging.d.ts.map +1 -0
- package/dist/containers/Paging.js +51 -0
- package/dist/containers/Paging.js.map +1 -0
- package/dist/hooks/usePaging.d.ts +1 -0
- package/dist/hooks/usePaging.d.ts.map +1 -1
- package/dist/hooks/usePaging.js +2 -0
- package/dist/hooks/usePaging.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Collection/index.tsx +45 -68
- package/src/components/Dropdown/index.tsx +21 -12
- package/src/components/Dropdown/list.tsx +43 -24
- package/src/components/Menu/index.tsx +3 -2
- package/src/components/Paging/index.tsx +32 -4
- package/src/components/Panel/index.tsx +4 -1
- package/src/constants/paging.ts +27 -8
- package/src/containers/Paging.tsx +90 -0
- package/src/hooks/usePaging.ts +4 -0
- package/src/index.tsx +1 -0
- package/src/stories/Collection/Collection.stories.tsx +20 -1
- package/src/stories/Dropdown/Dropdown.stories.tsx +54 -35
- package/src/stories/Menu/Menu.stories.tsx +4 -0
- package/src/stories/Paging/Paging.stories.tsx +19 -1
- package/tests.json +1 -1
package/src/index.tsx
CHANGED
|
@@ -58,6 +58,7 @@ export { ReqoreTree } from './components/Tree';
|
|
|
58
58
|
export { Colors as ReqoreColors } from './constants/colors';
|
|
59
59
|
export { ReqoreSizes } from './constants/sizes';
|
|
60
60
|
export { ReqoreIntents } from './constants/theme';
|
|
61
|
+
export { ReqorePaginationContainer } from './containers/Paging';
|
|
61
62
|
export { default as ReqoreNotifications } from './containers/ReqoreProvider';
|
|
62
63
|
export { default as ReqoreUIProvider } from './containers/UIProvider';
|
|
63
64
|
export { default as ReqoreContext } from './context/ReqoreContext';
|
|
@@ -188,9 +188,28 @@ FilteringSearchingPaging.args = {
|
|
|
188
188
|
sortButtonProps: {
|
|
189
189
|
fixed: false,
|
|
190
190
|
},
|
|
191
|
-
paging:
|
|
191
|
+
paging: 'buttons',
|
|
192
192
|
size: 'big',
|
|
193
193
|
padded: false,
|
|
194
194
|
fill: true,
|
|
195
195
|
items: bigCollection,
|
|
196
196
|
} as IReqoreCollectionProps;
|
|
197
|
+
|
|
198
|
+
export const CustomFilteringSearchingPaging = Template.bind({});
|
|
199
|
+
CustomFilteringSearchingPaging.args = {
|
|
200
|
+
inputProps: {
|
|
201
|
+
fluid: true,
|
|
202
|
+
focusRules: {
|
|
203
|
+
type: 'auto',
|
|
204
|
+
clearOnFocus: true,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
paging: {
|
|
208
|
+
itemsPerPage: 25,
|
|
209
|
+
scrollToTopOnPageChange: true,
|
|
210
|
+
},
|
|
211
|
+
size: 'small',
|
|
212
|
+
padded: false,
|
|
213
|
+
height: '300px',
|
|
214
|
+
items: bigCollection,
|
|
215
|
+
} as IReqoreCollectionProps;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react/types-6-0';
|
|
2
|
-
import { useState } from 'react';
|
|
3
2
|
import ReqoreButton from '../../components/Button';
|
|
4
3
|
import { IReqoreDropdownProps } from '../../components/Dropdown';
|
|
5
|
-
import { ReqoreControlGroup, ReqoreDropdown, ReqoreInput
|
|
4
|
+
import { ReqoreControlGroup, ReqoreDropdown, ReqoreInput } from '../../index';
|
|
6
5
|
import { argManager } from '../utils/args';
|
|
7
6
|
|
|
8
7
|
const { createArg, disableArg } = argManager<IReqoreDropdownProps>();
|
|
@@ -130,15 +129,16 @@ export default {
|
|
|
130
129
|
} as Meta<IReqoreDropdownProps>;
|
|
131
130
|
|
|
132
131
|
const Template: Story<IReqoreDropdownProps> = (args: IReqoreDropdownProps) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (args.scrollToSelected) {
|
|
132
|
+
if (args.scrollToSelected || args.paging) {
|
|
136
133
|
return (
|
|
137
134
|
<ReqoreControlGroup>
|
|
138
135
|
<ReqoreDropdown
|
|
139
|
-
|
|
136
|
+
{...args}
|
|
137
|
+
label={args.label}
|
|
140
138
|
isDefaultOpen
|
|
141
|
-
|
|
139
|
+
filterable
|
|
140
|
+
scrollToSelected={args.scrollToSelected}
|
|
141
|
+
paging={args.paging}
|
|
142
142
|
items={Array(130)
|
|
143
143
|
.fill(null)
|
|
144
144
|
.map((_, i) => ({
|
|
@@ -151,31 +151,6 @@ const Template: Story<IReqoreDropdownProps> = (args: IReqoreDropdownProps) => {
|
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
if (args.multiSelect) {
|
|
155
|
-
return (
|
|
156
|
-
<>
|
|
157
|
-
<ReqoreControlGroup>
|
|
158
|
-
<ReqoreDropdown
|
|
159
|
-
label='Multi Select'
|
|
160
|
-
multiSelect
|
|
161
|
-
isDefaultOpen
|
|
162
|
-
onItemSelect={({ label }) => setSelected([...selected, label])}
|
|
163
|
-
items={Array(13)
|
|
164
|
-
.fill(null)
|
|
165
|
-
.map((_, i) => ({
|
|
166
|
-
label: `Item ${i}`,
|
|
167
|
-
value: `item-${i}`,
|
|
168
|
-
selected: selected.includes(`Item ${i}`),
|
|
169
|
-
}))}
|
|
170
|
-
/>
|
|
171
|
-
{selected.map((item, index) => (
|
|
172
|
-
<ReqoreTag label={item} key={index} />
|
|
173
|
-
))}
|
|
174
|
-
</ReqoreControlGroup>
|
|
175
|
-
</>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
154
|
return (
|
|
180
155
|
<>
|
|
181
156
|
<ReqoreControlGroup wrap>
|
|
@@ -248,8 +223,52 @@ CustomComponent.args = {
|
|
|
248
223
|
export const ScrollToSelectedItem = Template.bind({});
|
|
249
224
|
ScrollToSelectedItem.args = {
|
|
250
225
|
scrollToSelected: true,
|
|
226
|
+
label: 'Dropdown that scrolls to selected item',
|
|
251
227
|
};
|
|
252
|
-
export const
|
|
253
|
-
|
|
254
|
-
|
|
228
|
+
export const WithPaging: Story<IReqoreDropdownProps> = Template.bind({});
|
|
229
|
+
WithPaging.args = {
|
|
230
|
+
paging: {
|
|
231
|
+
itemsPerPage: 50,
|
|
232
|
+
},
|
|
233
|
+
label: 'Dropdown with paging',
|
|
255
234
|
};
|
|
235
|
+
|
|
236
|
+
export const WithLoadMore: Story<IReqoreDropdownProps> = Template.bind({});
|
|
237
|
+
WithLoadMore.args = {
|
|
238
|
+
paging: {
|
|
239
|
+
fluid: true,
|
|
240
|
+
infinite: true,
|
|
241
|
+
scrollOnLoadMore: true,
|
|
242
|
+
loadMoreLabel: 'Load additional items...',
|
|
243
|
+
showLabels: true,
|
|
244
|
+
includeBottomControls: false,
|
|
245
|
+
},
|
|
246
|
+
label: 'Dropdown with load more',
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export const WithCustomPaging: Story<IReqoreDropdownProps> = Template.bind({});
|
|
250
|
+
WithCustomPaging.args = {
|
|
251
|
+
paging: {
|
|
252
|
+
fluid: true,
|
|
253
|
+
infinite: true,
|
|
254
|
+
scrollOnLoadMore: true,
|
|
255
|
+
pageControlsPosition: 'both',
|
|
256
|
+
loadMoreLabel: 'Load additional items...',
|
|
257
|
+
showLabels: true,
|
|
258
|
+
loadMoreButtonProps: {
|
|
259
|
+
textAlign: 'center',
|
|
260
|
+
effect: {
|
|
261
|
+
gradient: {
|
|
262
|
+
colors: 'info',
|
|
263
|
+
animate: 'hover',
|
|
264
|
+
},
|
|
265
|
+
textSize: 'small',
|
|
266
|
+
uppercase: true,
|
|
267
|
+
spaced: 3,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
label: 'Dropdown with custom paging',
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
WithCustomPaging.play = () => {};
|
|
@@ -192,6 +192,10 @@ export const Minimal = Template.bind({});
|
|
|
192
192
|
Minimal.args = {
|
|
193
193
|
minimal: true,
|
|
194
194
|
};
|
|
195
|
+
export const NoPadding = Template.bind({});
|
|
196
|
+
NoPadding.args = {
|
|
197
|
+
padded: false,
|
|
198
|
+
};
|
|
195
199
|
export const NotFlat = Template.bind({});
|
|
196
200
|
NotFlat.args = {
|
|
197
201
|
flat: false,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Story, StoryObj } from '@storybook/react/types-6-0';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useMount } from 'react-use';
|
|
2
4
|
import { IReqorePaginationProps, ReqorePagination } from '../../components/Paging';
|
|
3
5
|
import { IReqorePagingOptions } from '../../hooks/usePaging';
|
|
4
6
|
import { ReqoreControlGroup, ReqoreTag, useReqorePaging } from '../../index';
|
|
@@ -10,14 +12,19 @@ export default {
|
|
|
10
12
|
|
|
11
13
|
const Template: Story<IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }> =
|
|
12
14
|
(args) => {
|
|
15
|
+
const [scrollContainer, setScrollContainer] = useState<any>(undefined);
|
|
13
16
|
const paging = useReqorePaging<any>({ items: tableData, ...args.pagingOptions });
|
|
14
17
|
|
|
18
|
+
useMount(() => {
|
|
19
|
+
setScrollContainer(document.querySelector('.reqore-content')!);
|
|
20
|
+
});
|
|
21
|
+
|
|
15
22
|
return (
|
|
16
23
|
<ReqoreControlGroup vertical fluid>
|
|
17
24
|
{paging.items.map((item) => (
|
|
18
25
|
<ReqoreTag fixed='key' labelKey={item.id} label={`${item.firstName} ${item.lastName}`} />
|
|
19
26
|
))}
|
|
20
|
-
<ReqorePagination<any> {...paging} {...args} />
|
|
27
|
+
<ReqorePagination<any> {...paging} {...args} scrollContainer={scrollContainer} />
|
|
21
28
|
</ReqoreControlGroup>
|
|
22
29
|
);
|
|
23
30
|
};
|
|
@@ -131,6 +138,17 @@ WithLabels.args = {
|
|
|
131
138
|
} as IReqorePagingOptions<any>,
|
|
132
139
|
};
|
|
133
140
|
|
|
141
|
+
export const ScrollToTop: Story<
|
|
142
|
+
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
143
|
+
> = Template.bind({});
|
|
144
|
+
ScrollToTop.args = {
|
|
145
|
+
scrollToTopOnPageChange: true,
|
|
146
|
+
pagingOptions: {
|
|
147
|
+
pagesToShow: 5,
|
|
148
|
+
itemsPerPage: 100,
|
|
149
|
+
} as IReqorePagingOptions<any>,
|
|
150
|
+
};
|
|
151
|
+
|
|
134
152
|
export const Infinite: Story<
|
|
135
153
|
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
136
154
|
> = Template.bind({});
|