@qoretechnologies/reqore 0.34.13 → 0.35.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.
- package/__tests__/helpers/table.test.tsx +47 -0
- package/__tests__/table.test.tsx +356 -124
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +7 -4
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +2 -1
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +5 -11
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +4 -3
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +4 -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 +4 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +10 -5
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Input/index.js +4 -4
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +4 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Table/cell.d.ts +13 -0
- package/dist/components/Table/cell.d.ts.map +1 -0
- package/dist/components/Table/cell.js +89 -0
- package/dist/components/Table/cell.js.map +1 -0
- package/dist/components/Table/header.d.ts +15 -2
- package/dist/components/Table/header.d.ts.map +1 -1
- package/dist/components/Table/header.js +31 -14
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.d.ts +9 -6
- package/dist/components/Table/headerCell.d.ts.map +1 -1
- package/dist/components/Table/headerCell.js +73 -51
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +43 -1
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +145 -1
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +45 -25
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +167 -52
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +11 -5
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +32 -55
- package/dist/components/Table/row.js.map +1 -1
- package/dist/hooks/useQueryWithDelay.d.ts +8 -0
- package/dist/hooks/useQueryWithDelay.d.ts.map +1 -0
- package/dist/hooks/useQueryWithDelay.js +25 -0
- package/dist/hooks/useQueryWithDelay.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +6 -1
- package/src/components/Collection/index.tsx +9 -15
- package/src/components/ControlGroup/index.tsx +10 -5
- package/src/components/Dropdown/index.tsx +9 -0
- package/src/components/Dropdown/list.tsx +18 -6
- package/src/components/Input/index.tsx +3 -3
- package/src/components/Panel/index.tsx +3 -1
- package/src/components/Table/cell.tsx +120 -0
- package/src/components/Table/header.tsx +102 -45
- package/src/components/Table/headerCell.tsx +133 -80
- package/src/components/Table/helpers.ts +211 -1
- package/src/components/Table/index.tsx +334 -91
- package/src/components/Table/row.tsx +51 -127
- package/src/hooks/useQueryWithDelay.ts +30 -0
- package/src/index.tsx +3 -0
- package/src/mock/tableData.ts +40 -20
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/src/stories/Button/Button.stories.tsx +1 -1
- package/src/stories/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/stories/Collection/Collection.stories.tsx +19 -1
- package/src/stories/Columns/Columns.stories.tsx +1 -1
- package/src/stories/Comment/Comment.stories.tsx +1 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +1 -1
- package/src/stories/Drawer/Drawer.stories.tsx +5 -5
- package/src/stories/Dropdown/Dropdown.stories.tsx +11 -1
- package/src/stories/Header/Header.stories.tsx +1 -1
- package/src/stories/Icon/Icon.stories.tsx +1 -1
- package/src/stories/Input/Input.stories.tsx +1 -1
- package/src/stories/Menu/Menu.stories.tsx +1 -1
- package/src/stories/Message/Message.stories.tsx +1 -1
- package/src/stories/Modal/Modal.stories.tsx +1 -1
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +1 -1
- package/src/stories/Navbar/Navbar.stories.tsx +1 -1
- package/src/stories/Notifications/Interactive.stories.tsx +1 -1
- package/src/stories/Notifications/Notification.stories.tsx +1 -1
- package/src/stories/Notifications/Notifications.stories.tsx +1 -1
- package/src/stories/Paging/Paging.stories.tsx +1 -1
- package/src/stories/Panel/Panel.stories.tsx +5 -5
- package/src/stories/Paragraph/Paragraph.stories.tsx +1 -1
- package/src/stories/Popover/Popover.stories.tsx +2 -2
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +1 -1
- package/src/stories/Sidebar/Sidebar.stories.tsx +2 -2
- package/src/stories/Spacer/Spacer.stories.tsx +1 -1
- package/src/stories/Spinner/Spinner.stories.tsx +1 -1
- package/src/stories/Table/Table.stories.tsx +297 -78
- package/src/stories/Tabs/Tabs.stories.tsx +1 -1
- package/src/stories/Tag/Tag.stories.tsx +1 -1
- package/src/stories/TextArea/TextArea.stories.tsx +2 -2
- package/src/stories/Tree/Tree.stories.tsx +2 -2
- package/src/stories/utils/args.ts +1 -1
- package/tests.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
import { isFunction, isString } from 'lodash';
|
|
3
|
-
import { lighten, rgba } from 'polished';
|
|
4
3
|
import React, { ReactElement, useState } from 'react';
|
|
5
4
|
import styled, { css } from 'styled-components';
|
|
6
5
|
import {
|
|
@@ -10,16 +9,17 @@ import {
|
|
|
10
9
|
TReqoreTableColumnContent,
|
|
11
10
|
} from '.';
|
|
12
11
|
import { ReqorePopover } from '../..';
|
|
13
|
-
import { SIZE_TO_PX,
|
|
12
|
+
import { SIZE_TO_PX, TSizes } from '../../constants/sizes';
|
|
14
13
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { TReqoreColor, TReqoreHexColor } from '../Effect';
|
|
14
|
+
import { IReqoreTooltip } from '../../types/global';
|
|
15
|
+
import { TReqoreHexColor } from '../Effect';
|
|
18
16
|
import { ReqoreH4 } from '../Header';
|
|
19
17
|
import ReqoreIcon from '../Icon';
|
|
20
18
|
import { ReqoreP } from '../Paragraph';
|
|
21
19
|
import ReqoreTag from '../Tag';
|
|
22
20
|
import { TimeAgo } from '../TimeAgo';
|
|
21
|
+
import { IReqoreCustomTableBodyCell, ReqoreTableBodyCell } from './cell';
|
|
22
|
+
import { calculateMinimumCellWidth, getOnlyShownColumns } from './helpers';
|
|
23
23
|
|
|
24
24
|
export interface IReqoreTableRowOptions {
|
|
25
25
|
columns: IReqoreTableColumn[];
|
|
@@ -32,11 +32,13 @@ export interface IReqoreTableRowOptions {
|
|
|
32
32
|
selectedRowIntent?: TReqoreIntent;
|
|
33
33
|
size?: TSizes;
|
|
34
34
|
flat?: boolean;
|
|
35
|
+
cellComponent?: IReqoreCustomTableBodyCell;
|
|
36
|
+
rowComponent?: IReqoreCustomTableRow;
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
export interface
|
|
38
|
+
export interface IReqoreCustomTableRowProps extends IReqoreTableRowOptions {}
|
|
39
|
+
export interface IReqoreCustomTableRow extends React.FC<IReqoreCustomTableRowProps> {}
|
|
40
|
+
export interface IReqoreTableRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
38
41
|
data: IReqoreTableRowOptions;
|
|
39
|
-
style: React.StyleHTMLAttributes<HTMLDivElement>;
|
|
40
42
|
index: number;
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -60,8 +62,8 @@ export const StyledTableRow = styled.div<IReqoreTableRowStyle>`
|
|
|
60
62
|
|
|
61
63
|
export interface IReqoreTableCellStyle {
|
|
62
64
|
width?: number;
|
|
63
|
-
grow?: number;
|
|
64
65
|
theme?: IReqoreTheme;
|
|
66
|
+
grow: 1 | 2 | 3 | 4;
|
|
65
67
|
align?: 'center' | 'left' | 'right';
|
|
66
68
|
intent?: TReqoreIntent;
|
|
67
69
|
interactive?: boolean;
|
|
@@ -74,105 +76,9 @@ export interface IReqoreTableCellStyle {
|
|
|
74
76
|
selectedIntent?: TReqoreIntent;
|
|
75
77
|
even?: boolean;
|
|
76
78
|
striped?: boolean;
|
|
79
|
+
padded?: IReqoreTableColumn['cell']['padded'];
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
80
|
-
${({ width, grow }) =>
|
|
81
|
-
css`
|
|
82
|
-
width: ${!width || width < 80 ? 80 : width}px;
|
|
83
|
-
flex-grow: ${grow || (width ? undefined : 1)};
|
|
84
|
-
`}
|
|
85
|
-
|
|
86
|
-
${({
|
|
87
|
-
theme,
|
|
88
|
-
align,
|
|
89
|
-
interactive,
|
|
90
|
-
interactiveCell,
|
|
91
|
-
intent,
|
|
92
|
-
size,
|
|
93
|
-
flat,
|
|
94
|
-
striped,
|
|
95
|
-
even,
|
|
96
|
-
selected,
|
|
97
|
-
selectedIntent,
|
|
98
|
-
disabled,
|
|
99
|
-
hovered,
|
|
100
|
-
}: IReqoreTableCellStyle) => {
|
|
101
|
-
const getBackgroundColor = (): TReqoreColor => {
|
|
102
|
-
let color = theme.main;
|
|
103
|
-
let opacity = 0;
|
|
104
|
-
// Is there any intent
|
|
105
|
-
if (intent || (selected && selectedIntent)) {
|
|
106
|
-
color = theme.intents[intent || selectedIntent];
|
|
107
|
-
opacity += 0.02;
|
|
108
|
-
}
|
|
109
|
-
// Is the table striped and this row odd
|
|
110
|
-
if (striped && !even) {
|
|
111
|
-
opacity += 0.05;
|
|
112
|
-
}
|
|
113
|
-
// Is this row selected
|
|
114
|
-
if (selected) {
|
|
115
|
-
opacity += 0.02;
|
|
116
|
-
}
|
|
117
|
-
// Is this row hovered
|
|
118
|
-
if (hovered) {
|
|
119
|
-
opacity += 0.08;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Set the color as transparent if opacity is 0
|
|
123
|
-
if (opacity === 0) {
|
|
124
|
-
return 'transparent';
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return changeLightness(color, opacity);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const backgroundColor = getBackgroundColor();
|
|
131
|
-
|
|
132
|
-
return css`
|
|
133
|
-
display: flex;
|
|
134
|
-
align-items: center;
|
|
135
|
-
justify-content: ${align ? alignToFlexAlign(align) : 'flex-start'};
|
|
136
|
-
flex-shrink: 0;
|
|
137
|
-
border-bottom: ${!flat ? '1px solid ' : undefined};
|
|
138
|
-
|
|
139
|
-
height: 100%;
|
|
140
|
-
padding: 0 10px;
|
|
141
|
-
font-size: ${TEXT_FROM_SIZE[size]}px;
|
|
142
|
-
background-color: ${backgroundColor === 'transparent'
|
|
143
|
-
? 'transparent'
|
|
144
|
-
: rgba(getBackgroundColor(), 0.8)};
|
|
145
|
-
color: ${getReadableColorFrom(
|
|
146
|
-
backgroundColor === 'transparent' ? theme.main : backgroundColor,
|
|
147
|
-
!hovered
|
|
148
|
-
)};
|
|
149
|
-
border-color: ${changeLightness(
|
|
150
|
-
backgroundColor === 'transparent' ? theme.main : backgroundColor,
|
|
151
|
-
0.1
|
|
152
|
-
)};
|
|
153
|
-
transition: background-color 0.2s ease-out;
|
|
154
|
-
opacity: ${disabled ? 0.2 : 1};
|
|
155
|
-
pointer-events: ${disabled ? 'none' : undefined};
|
|
156
|
-
cursor: ${interactive || interactiveCell ? 'pointer' : 'default'};
|
|
157
|
-
|
|
158
|
-
${interactiveCell &&
|
|
159
|
-
css`
|
|
160
|
-
&:hover {
|
|
161
|
-
background-color: ${lighten(0.2, getBackgroundColor())};
|
|
162
|
-
}
|
|
163
|
-
`}
|
|
164
|
-
|
|
165
|
-
p.reqore-table-text {
|
|
166
|
-
overflow: hidden;
|
|
167
|
-
white-space: nowrap;
|
|
168
|
-
text-overflow: ellipsis;
|
|
169
|
-
margin: 0;
|
|
170
|
-
padding: 0;
|
|
171
|
-
}
|
|
172
|
-
`;
|
|
173
|
-
}}
|
|
174
|
-
`;
|
|
175
|
-
|
|
176
82
|
const ReqoreTableRow = ({
|
|
177
83
|
data: {
|
|
178
84
|
data,
|
|
@@ -185,6 +91,8 @@ const ReqoreTableRow = ({
|
|
|
185
91
|
size,
|
|
186
92
|
selectedRowIntent = 'info',
|
|
187
93
|
flat,
|
|
94
|
+
cellComponent,
|
|
95
|
+
rowComponent,
|
|
188
96
|
},
|
|
189
97
|
style,
|
|
190
98
|
index,
|
|
@@ -192,6 +100,9 @@ const ReqoreTableRow = ({
|
|
|
192
100
|
const [isHovered, setIsHovered] = useState<boolean>(false);
|
|
193
101
|
const isSelected = selected.find((selectId) => selectId === data[index]._selectId);
|
|
194
102
|
|
|
103
|
+
const CellComponent = cellComponent || ReqoreTableBodyCell;
|
|
104
|
+
const RowComponent = rowComponent || StyledTableRow;
|
|
105
|
+
|
|
195
106
|
const renderContent = (
|
|
196
107
|
content: TReqoreTableColumnContent,
|
|
197
108
|
data: any,
|
|
@@ -200,7 +111,7 @@ const ReqoreTableRow = ({
|
|
|
200
111
|
if (isFunction(content)) {
|
|
201
112
|
const Content = content;
|
|
202
113
|
|
|
203
|
-
return <Content {...data} />;
|
|
114
|
+
return <Content {...data} _size={size} _dataId={dataId} />;
|
|
204
115
|
}
|
|
205
116
|
|
|
206
117
|
if (isString(content)) {
|
|
@@ -244,35 +155,47 @@ const ReqoreTableRow = ({
|
|
|
244
155
|
};
|
|
245
156
|
|
|
246
157
|
const renderCells = (columns: IReqoreTableColumn[], data: IReqoreTableData) =>
|
|
247
|
-
columns.map(
|
|
248
|
-
({ width, grow, dataId,
|
|
249
|
-
columns
|
|
250
|
-
renderCells(columns, data)
|
|
251
|
-
|
|
158
|
+
getOnlyShownColumns(columns).map(
|
|
159
|
+
({ width, resizedWidth, grow, dataId, cell, header, align, intent }) => {
|
|
160
|
+
if (header.columns) {
|
|
161
|
+
return renderCells(header.columns, data);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Build the tooltip
|
|
165
|
+
const tooltip: IReqoreTooltip = cell?.tooltip
|
|
166
|
+
? typeof cell?.tooltip(data[index][dataId]) !== 'object'
|
|
167
|
+
? {
|
|
168
|
+
content: cell.tooltip(data[index][dataId]) as string,
|
|
169
|
+
}
|
|
170
|
+
: (cell.tooltip(data[index][dataId]) as IReqoreTooltip)
|
|
171
|
+
: {};
|
|
172
|
+
|
|
173
|
+
return (
|
|
252
174
|
<ReqorePopover
|
|
253
175
|
key={dataId}
|
|
254
|
-
component={
|
|
176
|
+
component={CellComponent}
|
|
255
177
|
isReqoreComponent
|
|
256
178
|
componentProps={
|
|
257
179
|
{
|
|
258
|
-
width,
|
|
180
|
+
width: resizedWidth || width,
|
|
259
181
|
grow,
|
|
260
182
|
align,
|
|
261
183
|
size,
|
|
262
184
|
striped,
|
|
185
|
+
padded: cell?.padded,
|
|
263
186
|
disabled: data[index]._disabled,
|
|
264
187
|
selected: !!isSelected,
|
|
265
188
|
selectedIntent: selectedRowIntent,
|
|
266
189
|
flat,
|
|
267
190
|
even: index % 2 === 0 ? true : false,
|
|
268
|
-
intent: intent || data[index]._intent,
|
|
191
|
+
intent: cell?.intent || data[index]._intent || intent,
|
|
269
192
|
hovered: isHovered,
|
|
270
|
-
interactive: !!
|
|
271
|
-
interactiveCell: !!
|
|
193
|
+
interactive: !!cell?.onClick || !!onRowClick,
|
|
194
|
+
interactiveCell: !!cell?.onClick,
|
|
272
195
|
onClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
|
273
|
-
if (
|
|
196
|
+
if (cell?.onClick) {
|
|
274
197
|
e.stopPropagation();
|
|
275
|
-
|
|
198
|
+
cell.onClick(data[index]);
|
|
276
199
|
} else if (onRowClick) {
|
|
277
200
|
e.stopPropagation();
|
|
278
201
|
onRowClick(data[index]);
|
|
@@ -284,15 +207,16 @@ const ReqoreTableRow = ({
|
|
|
284
207
|
className: 'reqore-table-cell',
|
|
285
208
|
} as IReqoreTableCellStyle
|
|
286
209
|
}
|
|
287
|
-
|
|
210
|
+
{...tooltip}
|
|
288
211
|
>
|
|
289
|
-
{renderContent(content, data[index], dataId)}
|
|
212
|
+
{renderContent(cell?.content, data[index], dataId)}
|
|
290
213
|
</ReqorePopover>
|
|
291
|
-
)
|
|
214
|
+
);
|
|
215
|
+
}
|
|
292
216
|
);
|
|
293
217
|
|
|
294
218
|
return (
|
|
295
|
-
<
|
|
219
|
+
<RowComponent
|
|
296
220
|
style={style}
|
|
297
221
|
className='reqore-table-row'
|
|
298
222
|
interactive={!!onRowClick}
|
|
@@ -307,9 +231,9 @@ const ReqoreTableRow = ({
|
|
|
307
231
|
}}
|
|
308
232
|
>
|
|
309
233
|
{selectable && (
|
|
310
|
-
<
|
|
234
|
+
<CellComponent
|
|
311
235
|
align='center'
|
|
312
|
-
width={
|
|
236
|
+
width={calculateMinimumCellWidth(50, size)}
|
|
313
237
|
className='reqore-table-cell'
|
|
314
238
|
{...{
|
|
315
239
|
size,
|
|
@@ -343,10 +267,10 @@ const ReqoreTableRow = ({
|
|
|
343
267
|
size={size}
|
|
344
268
|
style={{ opacity: !data[index]._selectId || !isSelected ? 0.4 : 1 }}
|
|
345
269
|
/>
|
|
346
|
-
</
|
|
270
|
+
</CellComponent>
|
|
347
271
|
)}
|
|
348
272
|
{renderCells(columns, data)}
|
|
349
|
-
</
|
|
273
|
+
</RowComponent>
|
|
350
274
|
);
|
|
351
275
|
};
|
|
352
276
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { useDebounce, useUpdateEffect } from 'react-use';
|
|
3
|
+
|
|
4
|
+
export const useQueryWithDelay = (
|
|
5
|
+
defaultQuery: string = '',
|
|
6
|
+
delay: number = 300,
|
|
7
|
+
onQueryChange?: (query: string | number) => void
|
|
8
|
+
) => {
|
|
9
|
+
const [query, setQuery] = useState<string>(defaultQuery);
|
|
10
|
+
const [preQuery, setPreQuery] = useState<string>(defaultQuery);
|
|
11
|
+
|
|
12
|
+
useUpdateEffect(() => {
|
|
13
|
+
onQueryChange?.(query);
|
|
14
|
+
}, [query]);
|
|
15
|
+
|
|
16
|
+
useDebounce(
|
|
17
|
+
() => {
|
|
18
|
+
setQuery(preQuery);
|
|
19
|
+
},
|
|
20
|
+
delay,
|
|
21
|
+
[preQuery]
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
query,
|
|
26
|
+
setQuery,
|
|
27
|
+
setPreQuery,
|
|
28
|
+
preQuery,
|
|
29
|
+
};
|
|
30
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -46,6 +46,9 @@ export { default as ReqoreSidebar } from './components/Sidebar';
|
|
|
46
46
|
export { ReqoreHorizontalSpacer, ReqoreSpacer, ReqoreVerticalSpacer } from './components/Spacer';
|
|
47
47
|
export { ReqoreSpinner } from './components/Spinner';
|
|
48
48
|
export { default as ReqoreTable } from './components/Table';
|
|
49
|
+
export { ReqoreTableBodyCell } from './components/Table/cell';
|
|
50
|
+
export { ReqoreTableHeaderCell } from './components/Table/headerCell';
|
|
51
|
+
export { default as ReqoreTableRow } from './components/Table/row';
|
|
49
52
|
export { default as ReqoreTabs } from './components/Tabs';
|
|
50
53
|
export { default as ReqoreTabsContent } from './components/Tabs/content';
|
|
51
54
|
export { default as ReqoreTabsListItem } from './components/Tabs/item';
|
package/src/mock/tableData.ts
CHANGED
|
@@ -1,29 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IReqoreTableProps } from '../components/Table';
|
|
2
2
|
import data from './data.json';
|
|
3
3
|
|
|
4
4
|
export const tableData = data;
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
export const testColumns: IReqoreTableProps['columns'] = [
|
|
6
|
+
{
|
|
7
|
+
dataId: 'id',
|
|
8
|
+
header: { label: 'ID' },
|
|
9
|
+
width: 50,
|
|
10
|
+
align: 'center',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
dataId: 'name',
|
|
14
|
+
header: {
|
|
15
|
+
label: 'Name',
|
|
16
|
+
columns: [
|
|
17
|
+
{ dataId: 'firstName', header: { label: 'First Name' }, width: 150 },
|
|
18
|
+
{ dataId: 'lastName', header: { label: 'Last Name' }, width: 150 },
|
|
19
|
+
],
|
|
12
20
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
},
|
|
22
|
+
{ dataId: 'address', header: { label: 'Address' }, width: 300, grow: 2 },
|
|
23
|
+
{
|
|
24
|
+
dataId: 'age',
|
|
25
|
+
header: { label: 'Really long age header' },
|
|
26
|
+
width: 50,
|
|
27
|
+
align: 'center',
|
|
28
|
+
cell: {
|
|
21
29
|
intent: 'success',
|
|
22
30
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
dataId: 'data',
|
|
34
|
+
header: {
|
|
35
|
+
label: 'Data',
|
|
36
|
+
columns: [
|
|
37
|
+
{ dataId: 'occupation', header: { label: 'Ocuppation' }, width: 200 },
|
|
38
|
+
{ dataId: 'group', header: { label: 'Group' }, width: 150, intent: 'muted' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{ dataId: 'date', header: { label: 'Date' }, width: 150, cell: { content: 'time-ago' } },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
columns: testColumns,
|
|
27
47
|
data: data.map((datum) => ({
|
|
28
48
|
...datum,
|
|
29
49
|
date: Date.now(),
|
|
@@ -3,7 +3,7 @@ import Checkbox from '../../components/Checkbox';
|
|
|
3
3
|
import { ReqoreCheckbox, ReqoreControlGroup, ReqoreVerticalSpacer } from '../../index';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
title: '
|
|
6
|
+
title: 'Form/Checkbox/Stories',
|
|
7
7
|
parameters: ['checkbox.test.tsx'],
|
|
8
8
|
} as ComponentMeta<typeof Checkbox>;
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ export interface IColumnsStoryArgs extends IReqoreColumnsProps {
|
|
|
14
14
|
const { createArg, disableArgs } = argManager<IReqoreCollectionProps>();
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
-
title: '
|
|
17
|
+
title: 'Collections/Collection/Stories',
|
|
18
18
|
component: ReqoreCollection,
|
|
19
19
|
argTypes: {
|
|
20
20
|
...createArg('stacked', {
|
|
@@ -225,3 +225,21 @@ CustomFilteringSearchingPaging.args = {
|
|
|
225
225
|
fill: true,
|
|
226
226
|
items: [...bigCollection, ...bigCollection, ...bigCollection, ...bigCollection, ...bigCollection],
|
|
227
227
|
} as IReqoreCollectionProps;
|
|
228
|
+
|
|
229
|
+
export const DefaultFilter = Template.bind({});
|
|
230
|
+
DefaultFilter.args = {
|
|
231
|
+
inputProps: {
|
|
232
|
+
fluid: true,
|
|
233
|
+
},
|
|
234
|
+
defaultQuery: 'Med',
|
|
235
|
+
paging: {
|
|
236
|
+
itemsPerPage: 55,
|
|
237
|
+
scrollToTopOnPageChange: true,
|
|
238
|
+
},
|
|
239
|
+
inputInTitle: false,
|
|
240
|
+
responsiveTitle: true,
|
|
241
|
+
size: 'small',
|
|
242
|
+
padded: false,
|
|
243
|
+
fill: true,
|
|
244
|
+
items: [...bigCollection, ...bigCollection, ...bigCollection, ...bigCollection, ...bigCollection],
|
|
245
|
+
} as IReqoreCollectionProps;
|
|
@@ -18,7 +18,7 @@ export interface IColumnsStoryArgs extends IReqoreColumnsProps {
|
|
|
18
18
|
const { createArg, disableArgs } = argManager<IColumnsStoryArgs>();
|
|
19
19
|
|
|
20
20
|
export default {
|
|
21
|
-
title: '
|
|
21
|
+
title: 'Layout/Columns/Stories',
|
|
22
22
|
component: ReqoreColumns,
|
|
23
23
|
argTypes: {
|
|
24
24
|
...createArg('multipleColumns', {
|
|
@@ -14,7 +14,7 @@ import { GapSizeArg, MinimalArg, SizeArg, argManager } from '../utils/args';
|
|
|
14
14
|
const { createArg } = argManager<IReqoreControlGroupProps>();
|
|
15
15
|
|
|
16
16
|
export default {
|
|
17
|
-
title: '
|
|
17
|
+
title: 'Form/Control Group/Stories',
|
|
18
18
|
argTypes: {
|
|
19
19
|
...SizeArg,
|
|
20
20
|
...GapSizeArg,
|
|
@@ -15,7 +15,7 @@ import { FlatArg, IntentArg, argManager } from '../utils/args';
|
|
|
15
15
|
const { createArg } = argManager<IReqoreDrawerProps>();
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
|
-
title: '
|
|
18
|
+
title: 'Dialogs/Drawer/Stories',
|
|
19
19
|
parameters: {
|
|
20
20
|
chromatic: {
|
|
21
21
|
viewports: [450, 600, 1440],
|
|
@@ -170,8 +170,8 @@ const Template: Story<IReqoreDrawerProps> = (args: IReqoreDrawerProps) => {
|
|
|
170
170
|
{
|
|
171
171
|
label: 'More actions',
|
|
172
172
|
actions: [
|
|
173
|
-
{
|
|
174
|
-
{
|
|
173
|
+
{ label: 'Sub Test', icon: 'FileDownloadLine' },
|
|
174
|
+
{ label: 'Sub Test 2', icon: 'FileDownloadLine', intent: 'success' },
|
|
175
175
|
],
|
|
176
176
|
intent: 'info',
|
|
177
177
|
},
|
|
@@ -189,8 +189,8 @@ const Template: Story<IReqoreDrawerProps> = (args: IReqoreDrawerProps) => {
|
|
|
189
189
|
label: 'More actions',
|
|
190
190
|
position: 'right',
|
|
191
191
|
actions: [
|
|
192
|
-
{
|
|
193
|
-
{
|
|
192
|
+
{ label: 'Sub Test', icon: 'FileDownloadLine', intent: 'success' },
|
|
193
|
+
{ label: 'Sub Test 2', icon: 'FileDownloadLine' },
|
|
194
194
|
],
|
|
195
195
|
},
|
|
196
196
|
]}
|
|
@@ -7,7 +7,7 @@ import { argManager } from '../utils/args';
|
|
|
7
7
|
const { createArg, disableArg } = argManager<IReqoreDropdownProps>();
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title: '
|
|
10
|
+
title: 'Form/Dropdown/Stories',
|
|
11
11
|
parameters: {
|
|
12
12
|
chromatic: {
|
|
13
13
|
delay: 1500,
|
|
@@ -225,6 +225,16 @@ ScrollToSelectedItem.args = {
|
|
|
225
225
|
scrollToSelected: true,
|
|
226
226
|
label: 'Dropdown that scrolls to selected item',
|
|
227
227
|
};
|
|
228
|
+
|
|
229
|
+
export const WithCustomFilter: Story<IReqoreDropdownProps> = Template.bind({});
|
|
230
|
+
WithCustomFilter.args = {
|
|
231
|
+
label: 'Dropdown with custom filter',
|
|
232
|
+
filterPlaceholder: 'Custom filter placeholder',
|
|
233
|
+
filter: 'something',
|
|
234
|
+
onFilterChange: (value) => {
|
|
235
|
+
console.log(value);
|
|
236
|
+
},
|
|
237
|
+
};
|
|
228
238
|
export const WithPaging: Story<IReqoreDropdownProps> = Template.bind({});
|
|
229
239
|
WithPaging.args = {
|
|
230
240
|
paging: {
|
|
@@ -13,7 +13,7 @@ import { IntentArg, argManager } from '../utils/args';
|
|
|
13
13
|
const { createArg } = argManager<IReqoreMenuProps>();
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
|
-
title: '
|
|
16
|
+
title: 'Navigation/Menu/Stories',
|
|
17
17
|
argTypes: {
|
|
18
18
|
...createArg('width', {
|
|
19
19
|
type: 'string',
|
|
@@ -8,7 +8,7 @@ import { FlatArg, IconArg, MinimalArg, SizeArg, argManager } from '../utils/args
|
|
|
8
8
|
const { createArg } = argManager<IReqoreMultiSelectProps>();
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
|
-
title: '
|
|
11
|
+
title: 'Form/Multi Select/Stories',
|
|
12
12
|
parameters: {
|
|
13
13
|
chromatic: {
|
|
14
14
|
delay: 500,
|
|
@@ -6,7 +6,7 @@ import { IReqoreUIProviderProps } from '../../containers/UIProvider';
|
|
|
6
6
|
import { ReqoreUIProvider, useReqoreProperty } from '../../index';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Other/Notifications/Interactive/Stories',
|
|
10
10
|
component: ReqoreNotification,
|
|
11
11
|
} as Meta;
|
|
12
12
|
|
|
@@ -9,7 +9,7 @@ import { IReqoreUIProviderProps } from '../../containers/UIProvider';
|
|
|
9
9
|
import { ReqoreTag, ReqoreUIProvider } from '../../index';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
|
-
title: '
|
|
12
|
+
title: 'Other/Notifications/Item/Stories',
|
|
13
13
|
component: ReqoreNotification,
|
|
14
14
|
} as Meta;
|
|
15
15
|
|
|
@@ -10,7 +10,7 @@ import { IReqoreUIProviderProps } from '../../containers/UIProvider';
|
|
|
10
10
|
import { ReqoreUIProvider } from '../../index';
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
|
-
title: '
|
|
13
|
+
title: 'Other/Notifications/Wrapper/Stories',
|
|
14
14
|
component: ReqoreNotification,
|
|
15
15
|
} as Meta;
|
|
16
16
|
|