@qoretechnologies/reqore 0.32.3 → 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 +144 -5
- package/__tests__/containers/paging.test.tsx +106 -0
- package/__tests__/hooks/useLatestZIndex.test.tsx +10 -0
- package/__tests__/hooks/useReqorePaging.test.tsx +255 -0
- package/__tests__/hooks/useTheme.test.tsx +31 -0
- package/__tests__/pagination.test.tsx +305 -0
- package/__tests__/popover.test.tsx +20 -6
- package/__tests__/setup.js +8 -0
- package/__tests__/tree.test.tsx +0 -1
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +11 -7
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +4 -3
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +31 -13
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +9 -2
- 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 +6 -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/Menu/item.d.ts +1 -0
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +14 -2
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Paging/index.d.ts +32 -0
- package/dist/components/Paging/index.d.ts.map +1 -0
- package/dist/components/Paging/index.js +127 -0
- package/dist/components/Paging/index.js.map +1 -0
- 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/components/Tag/index.d.ts +3 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +10 -7
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/constants/colors.d.ts +2 -9
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +3 -1
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/paging.d.ts +17 -0
- package/dist/constants/paging.d.ts.map +1 -0
- package/dist/constants/paging.js +45 -0
- package/dist/constants/paging.js.map +1 -0
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js +8 -7
- package/dist/constants/theme.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/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +2 -2
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +9 -3
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/hooks/useCombinedRefs.d.ts +2 -2
- package/dist/hooks/useCombinedRefs.d.ts.map +1 -1
- package/dist/hooks/useCombinedRefs.js.map +1 -1
- package/dist/hooks/usePaging.d.ts +28 -0
- package/dist/hooks/usePaging.d.ts.map +1 -0
- package/dist/hooks/usePaging.js +85 -0
- package/dist/hooks/usePaging.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/src/components/Button/index.tsx +18 -10
- package/src/components/Collection/index.tsx +78 -49
- package/src/components/ControlGroup/index.tsx +1 -1
- package/src/components/Dropdown/index.tsx +27 -12
- package/src/components/Dropdown/list.tsx +49 -24
- package/src/components/Menu/index.tsx +3 -2
- package/src/components/Menu/item.tsx +16 -2
- package/src/components/MultiSelect/index.tsx +1 -1
- package/src/components/Paging/index.tsx +260 -0
- package/src/components/Panel/index.tsx +4 -1
- package/src/components/Tag/index.tsx +9 -7
- package/src/constants/colors.ts +5 -1
- package/src/constants/paging.ts +67 -0
- package/src/constants/theme.ts +8 -7
- package/src/containers/Paging.tsx +90 -0
- package/src/containers/ReqoreProvider.tsx +3 -3
- package/src/containers/UIProvider.tsx +17 -4
- package/src/hooks/useCombinedRefs.ts +2 -2
- package/src/hooks/usePaging.ts +114 -0
- package/src/index.tsx +3 -0
- package/src/mock/collectionData.tsx +19 -0
- package/src/mock/tableData.ts +1 -0
- package/src/stories/Button/Button.stories.tsx +25 -8
- package/src/stories/Collection/Collection.stories.tsx +51 -42
- package/src/stories/Dropdown/Dropdown.stories.tsx +71 -29
- package/src/stories/Menu/Menu.stories.tsx +4 -0
- package/src/stories/Paging/Paging.stories.tsx +202 -0
- package/src/stories/Tag/Tag.stories.tsx +50 -0
- package/tests.json +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Story, StoryObj } from '@storybook/react/types-6-0';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useMount } from 'react-use';
|
|
4
|
+
import { IReqorePaginationProps, ReqorePagination } from '../../components/Paging';
|
|
5
|
+
import { IReqorePagingOptions } from '../../hooks/usePaging';
|
|
6
|
+
import { ReqoreControlGroup, ReqoreTag, useReqorePaging } from '../../index';
|
|
7
|
+
import { tableData } from '../../mock/tableData';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Components/Paging',
|
|
11
|
+
} as StoryObj<typeof ReqorePagination>;
|
|
12
|
+
|
|
13
|
+
const Template: Story<IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }> =
|
|
14
|
+
(args) => {
|
|
15
|
+
const [scrollContainer, setScrollContainer] = useState<any>(undefined);
|
|
16
|
+
const paging = useReqorePaging<any>({ items: tableData, ...args.pagingOptions });
|
|
17
|
+
|
|
18
|
+
useMount(() => {
|
|
19
|
+
setScrollContainer(document.querySelector('.reqore-content')!);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<ReqoreControlGroup vertical fluid>
|
|
24
|
+
{paging.items.map((item) => (
|
|
25
|
+
<ReqoreTag fixed='key' labelKey={item.id} label={`${item.firstName} ${item.lastName}`} />
|
|
26
|
+
))}
|
|
27
|
+
<ReqorePagination<any> {...paging} {...args} scrollContainer={scrollContainer} />
|
|
28
|
+
</ReqoreControlGroup>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Basic = Template.bind({});
|
|
33
|
+
export const NoPageButtons = Template.bind({});
|
|
34
|
+
NoPageButtons.args = {
|
|
35
|
+
showPages: false,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const NoControlButtons = Template.bind({});
|
|
39
|
+
NoControlButtons.args = {
|
|
40
|
+
showControls: false,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const ShowSomePages = Template.bind({});
|
|
44
|
+
ShowSomePages.args = {
|
|
45
|
+
pagingOptions: {
|
|
46
|
+
pagesToShow: 4,
|
|
47
|
+
} as IReqorePagingOptions<any>,
|
|
48
|
+
};
|
|
49
|
+
export const AsList = Template.bind({});
|
|
50
|
+
AsList.args = {
|
|
51
|
+
showPagesAs: 'list',
|
|
52
|
+
pagingOptions: {
|
|
53
|
+
pagesToShow: 5,
|
|
54
|
+
} as IReqorePagingOptions<any>,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithStyling: Story<
|
|
58
|
+
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
59
|
+
> = Template.bind({});
|
|
60
|
+
WithStyling.args = {
|
|
61
|
+
showPagesAs: 'buttons',
|
|
62
|
+
activePageButtonProps: {
|
|
63
|
+
effect: {
|
|
64
|
+
gradient: {
|
|
65
|
+
colors: 'info',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
pageButtonProps: {
|
|
70
|
+
effect: {
|
|
71
|
+
gradient: {
|
|
72
|
+
colors: 'warning',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
controlPageButtonProps: {
|
|
77
|
+
effect: {
|
|
78
|
+
gradient: {
|
|
79
|
+
colors: 'success',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
pagingOptions: {
|
|
84
|
+
pagesToShow: 15,
|
|
85
|
+
} as IReqorePagingOptions<any>,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const ListWithStyling: Story<
|
|
89
|
+
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
90
|
+
> = Template.bind({});
|
|
91
|
+
ListWithStyling.args = {
|
|
92
|
+
showPagesAs: 'list',
|
|
93
|
+
activePageButtonProps: {
|
|
94
|
+
effect: {
|
|
95
|
+
gradient: {
|
|
96
|
+
colors: 'info',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
pageButtonProps: {
|
|
101
|
+
effect: {
|
|
102
|
+
gradient: {
|
|
103
|
+
colors: 'warning',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
listPageButtonProps: {
|
|
108
|
+
isDefaultOpen: true,
|
|
109
|
+
effect: {
|
|
110
|
+
gradient: {
|
|
111
|
+
colors: 'info',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
controlPageButtonProps: {
|
|
116
|
+
effect: {
|
|
117
|
+
gradient: {
|
|
118
|
+
colors: 'success',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
pagingOptions: {
|
|
123
|
+
pagesToShow: 15,
|
|
124
|
+
} as IReqorePagingOptions<any>,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const WithLabels: Story<
|
|
128
|
+
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
129
|
+
> = Template.bind({});
|
|
130
|
+
WithLabels.args = {
|
|
131
|
+
showPagesAs: 'list',
|
|
132
|
+
showLabels: true,
|
|
133
|
+
listPageButtonProps: {
|
|
134
|
+
isDefaultOpen: true,
|
|
135
|
+
},
|
|
136
|
+
pagingOptions: {
|
|
137
|
+
pagesToShow: 15,
|
|
138
|
+
} as IReqorePagingOptions<any>,
|
|
139
|
+
};
|
|
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
|
+
|
|
152
|
+
export const Infinite: Story<
|
|
153
|
+
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
154
|
+
> = Template.bind({});
|
|
155
|
+
Infinite.args = {
|
|
156
|
+
showLabels: true,
|
|
157
|
+
fluid: true,
|
|
158
|
+
loadMoreButtonProps: {
|
|
159
|
+
textAlign: 'center',
|
|
160
|
+
},
|
|
161
|
+
loadMoreLabel: 'Load 10 more',
|
|
162
|
+
pagingOptions: {
|
|
163
|
+
infinite: true,
|
|
164
|
+
} as IReqorePagingOptions<any>,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const InfiniteWithAutoScroll: Story<
|
|
168
|
+
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
169
|
+
> = Template.bind({});
|
|
170
|
+
InfiniteWithAutoScroll.args = {
|
|
171
|
+
showLabels: true,
|
|
172
|
+
fluid: true,
|
|
173
|
+
scrollOnLoadMore: true,
|
|
174
|
+
loadMoreButtonProps: {
|
|
175
|
+
textAlign: 'center',
|
|
176
|
+
size: 'big',
|
|
177
|
+
},
|
|
178
|
+
loadMoreLabel: 'Load 100 more',
|
|
179
|
+
pagingOptions: {
|
|
180
|
+
infinite: true,
|
|
181
|
+
itemsPerPage: 100,
|
|
182
|
+
} as IReqorePagingOptions<any>,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const InfiniteWithAutoLoad: Story<
|
|
186
|
+
IReqorePaginationProps<any> & { pagingOptions?: IReqorePagingOptions<any> }
|
|
187
|
+
> = Template.bind({});
|
|
188
|
+
InfiniteWithAutoLoad.args = {
|
|
189
|
+
showLabels: true,
|
|
190
|
+
fluid: true,
|
|
191
|
+
autoLoadMore: true,
|
|
192
|
+
scrollOnLoadMore: true,
|
|
193
|
+
loadMoreButtonProps: {
|
|
194
|
+
textAlign: 'center',
|
|
195
|
+
icon: 'Loader5Line',
|
|
196
|
+
},
|
|
197
|
+
loadMoreLabel: 'Scroll to load 20 more',
|
|
198
|
+
pagingOptions: {
|
|
199
|
+
infinite: true,
|
|
200
|
+
itemsPerPage: 20,
|
|
201
|
+
} as IReqorePagingOptions<any>,
|
|
202
|
+
};
|
|
@@ -267,6 +267,56 @@ const Template: Story<IReqoreTagGroup & IReqoreTagProps> = ({ columns, ...args }
|
|
|
267
267
|
},
|
|
268
268
|
]}
|
|
269
269
|
/>
|
|
270
|
+
<ReqoreTag
|
|
271
|
+
{...args}
|
|
272
|
+
labelKey='Fixed'
|
|
273
|
+
fixed='key'
|
|
274
|
+
label='Wrapped tag with some long text and NO width specified, AND wrap specified, with fixed key'
|
|
275
|
+
icon='DriveLine'
|
|
276
|
+
rightIcon={args.rightIcon}
|
|
277
|
+
wrap
|
|
278
|
+
onRemoveClick={null}
|
|
279
|
+
actions={[
|
|
280
|
+
{
|
|
281
|
+
icon: '24HoursFill',
|
|
282
|
+
onClick: noop,
|
|
283
|
+
disabled: true,
|
|
284
|
+
intent: 'info',
|
|
285
|
+
tooltip: { content: 'I am a tooltip' },
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
icon: 'SpyFill',
|
|
289
|
+
onClick: noop,
|
|
290
|
+
intent: 'success',
|
|
291
|
+
tooltip: { content: 'Hm, another tooltip', openOnMount: true },
|
|
292
|
+
},
|
|
293
|
+
]}
|
|
294
|
+
/>
|
|
295
|
+
<ReqoreTag
|
|
296
|
+
{...args}
|
|
297
|
+
labelKey='Wrapped tag with some long text and NO width specified, AND wrap specified, with fixed label, Wrapped tag with some long text and NO width specified, AND wrap specified, with fixed label'
|
|
298
|
+
fixed='label'
|
|
299
|
+
label='Fixed'
|
|
300
|
+
icon='DriveLine'
|
|
301
|
+
rightIcon={args.rightIcon}
|
|
302
|
+
wrap
|
|
303
|
+
onRemoveClick={null}
|
|
304
|
+
actions={[
|
|
305
|
+
{
|
|
306
|
+
icon: '24HoursFill',
|
|
307
|
+
onClick: noop,
|
|
308
|
+
disabled: true,
|
|
309
|
+
intent: 'info',
|
|
310
|
+
tooltip: { content: 'I am a tooltip' },
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
icon: 'SpyFill',
|
|
314
|
+
onClick: noop,
|
|
315
|
+
intent: 'success',
|
|
316
|
+
tooltip: { content: 'Hm, another tooltip', openOnMount: true },
|
|
317
|
+
},
|
|
318
|
+
]}
|
|
319
|
+
/>
|
|
270
320
|
</ReqoreTagGroup>
|
|
271
321
|
);
|
|
272
322
|
};
|