@qoretechnologies/reqore 0.35.3 → 0.36.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__/collection.test.tsx +1 -22
- package/__tests__/table.test.tsx +1 -1
- package/__tests__/tree.test.tsx +0 -18
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Button/index.d.ts +1 -4
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +11 -26
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +2 -2
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +10 -10
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +3 -3
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/index.d.ts +1 -1
- package/dist/components/Columns/index.d.ts.map +1 -1
- package/dist/components/Comment/index.d.ts +1 -1
- package/dist/components/Comment/index.d.ts.map +1 -1
- package/dist/components/CommentFeed/index.d.ts +1 -1
- package/dist/components/CommentFeed/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.d.ts +1 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/item.d.ts +2 -2
- package/dist/components/Dropdown/item.d.ts.map +1 -1
- package/dist/components/Dropdown/list.d.ts +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Effect/index.d.ts +2 -2
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/ExportModal/index.d.ts +11 -0
- package/dist/components/ExportModal/index.d.ts.map +1 -0
- package/dist/components/ExportModal/index.js +91 -0
- package/dist/components/ExportModal/index.js.map +1 -0
- package/dist/components/Header/index.d.ts +7 -7
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/InputClearButton/index.d.ts +1 -0
- package/dist/components/InputClearButton/index.d.ts.map +1 -1
- package/dist/components/KeyValueTable/index.d.ts +27 -0
- package/dist/components/KeyValueTable/index.d.ts.map +1 -0
- package/dist/components/KeyValueTable/index.js +87 -0
- package/dist/components/KeyValueTable/index.js.map +1 -0
- package/dist/components/Layout/content.d.ts +1 -1
- package/dist/components/Layout/content.d.ts.map +1 -1
- package/dist/components/Layout/index.d.ts +1 -1
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/Menu/item.d.ts +1 -1
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +3 -3
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +2 -2
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +3 -3
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Paging/index.d.ts +1 -1
- package/dist/components/Paging/index.d.ts.map +1 -1
- package/dist/components/Panel/NonResponsiveActions.d.ts +1 -1
- package/dist/components/Panel/NonResponsiveActions.d.ts.map +1 -1
- package/dist/components/Panel/index.js +1 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Panel/panel.screenshot.d.ts +1 -1
- package/dist/components/Panel/panel.screenshot.d.ts.map +1 -1
- package/dist/components/Paragraph/index.d.ts +1 -1
- package/dist/components/Paragraph/index.d.ts.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/RadioGroup/index.d.ts +1 -1
- package/dist/components/RadioGroup/index.d.ts.map +1 -1
- package/dist/components/Sidebar/item.d.ts +1 -1
- package/dist/components/Sidebar/item.d.ts.map +1 -1
- package/dist/components/Spacer/index.d.ts +3 -3
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/Spinner/index.d.ts.map +1 -1
- package/dist/components/Table/body.d.ts +1 -1
- package/dist/components/Table/body.d.ts.map +1 -1
- package/dist/components/Table/body.js +4 -2
- package/dist/components/Table/body.js.map +1 -1
- package/dist/components/Table/cell.d.ts +1 -1
- package/dist/components/Table/cell.d.ts.map +1 -1
- package/dist/components/Table/headerCell.d.ts +1 -1
- package/dist/components/Table/headerCell.d.ts.map +1 -1
- package/dist/components/Table/helpers.d.ts +8 -6
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +49 -16
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +5 -4
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +63 -53
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +7 -5
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +12 -5
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Table/value.d.ts +7 -0
- package/dist/components/Table/value.d.ts.map +1 -0
- package/dist/components/Table/value.js +37 -0
- package/dist/components/Table/value.js.map +1 -0
- package/dist/components/Tabs/content.d.ts +1 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/index.d.ts +1 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/list.d.ts +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +1 -1
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +1 -1
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tree/index.d.ts +2 -1
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +35 -31
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/containers/Paging.d.ts +1 -1
- package/dist/containers/Paging.d.ts.map +1 -1
- package/dist/containers/ThemeProvider.d.ts +1 -1
- package/dist/containers/ThemeProvider.d.ts.map +1 -1
- package/dist/helpers/utils.d.ts +2 -1
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +20 -2
- package/dist/helpers/utils.js.map +1 -1
- package/dist/hooks/useAutoFocus.d.ts +1 -1
- package/dist/hooks/useAutoFocus.d.ts.map +1 -1
- package/dist/hooks/usePopover.d.ts +1 -0
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.d.ts +3 -0
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +49 -11
- package/dist/styles.js.map +1 -1
- package/migration-storybook.log +88 -0
- package/package.json +26 -20
- package/src/components/Breadcrumbs/index.tsx +1 -1
- package/src/components/Button/index.tsx +3 -54
- package/src/components/Collection/index.tsx +18 -15
- package/src/components/Collection/item.tsx +2 -1
- package/src/components/ExportModal/index.tsx +98 -0
- package/src/components/KeyValueTable/index.tsx +129 -0
- package/src/components/Menu/item.tsx +4 -4
- package/src/components/Notifications/notification.tsx +2 -2
- package/src/components/Panel/index.tsx +2 -2
- package/src/components/Table/body.tsx +6 -3
- package/src/components/Table/helpers.ts +52 -21
- package/src/components/Table/index.tsx +127 -90
- package/src/components/Table/row.tsx +21 -10
- package/src/components/Table/value.tsx +27 -0
- package/src/components/Tabs/list.tsx +1 -1
- package/src/components/Tree/index.tsx +82 -75
- package/src/helpers/utils.ts +10 -2
- package/src/hooks/useAutoFocus.ts +1 -1
- package/src/index.tsx +2 -0
- package/src/mock/tableData.ts +12 -0
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +11 -23
- package/src/stories/Button/Button.stories.tsx +83 -47
- package/src/stories/Checkbox/Checkbox.stories.tsx +19 -9
- package/src/stories/Collection/Collection.stories.tsx +195 -171
- package/src/stories/Columns/Columns.stories.tsx +38 -24
- package/src/stories/Comment/Comment.stories.tsx +15 -6
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +102 -48
- package/src/stories/Drawer/Drawer.stories.tsx +52 -17
- package/src/stories/Dropdown/Dropdown.stories.tsx +184 -152
- package/src/stories/ExportModal/ExportModal.stories.tsx +18 -0
- package/src/stories/Header/Header.stories.tsx +65 -31
- package/src/stories/Icon/Icon.stories.tsx +139 -133
- package/src/stories/Input/Input.stories.tsx +68 -31
- package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +224 -0
- package/src/stories/Menu/Menu.stories.tsx +56 -20
- package/src/stories/Message/Message.stories.tsx +71 -37
- package/src/stories/Modal/Modal.stories.tsx +28 -8
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +66 -35
- package/src/stories/Navbar/Navbar.stories.tsx +15 -5
- package/src/stories/Notifications/Interactive.stories.tsx +40 -28
- package/src/stories/Notifications/Notification.stories.tsx +55 -41
- package/src/stories/Notifications/Notifications.stories.tsx +45 -29
- package/src/stories/Paging/Paging.stories.tsx +206 -177
- package/src/stories/Panel/Panel.stories.tsx +238 -168
- package/src/stories/Paragraph/Paragraph.stories.tsx +66 -31
- package/src/stories/Popover/Popover.stories.tsx +62 -40
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +41 -19
- package/src/stories/Sidebar/Sidebar.stories.tsx +29 -10
- package/src/stories/Spacer/Spacer.stories.tsx +13 -5
- package/src/stories/Spinner/Spinner.stories.tsx +26 -12
- package/src/stories/Table/Table.stories.tsx +200 -144
- package/src/stories/Table/Tests.stories.tsx +9 -0
- package/src/stories/Tabs/Tabs.stories.tsx +82 -46
- package/src/stories/Tag/Tag.stories.tsx +56 -37
- package/src/stories/Tag/TagGroup.stories.tsx +297 -0
- package/src/stories/TextArea/TextArea.stories.tsx +82 -40
- package/src/stories/Tree/Tree.stories.tsx +84 -22
- package/src/stories/utils.ts +22 -1
- package/src/styles.ts +55 -2
- package/tests.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { cloneDeep, size as lodashSize } from 'lodash';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { ReqoreMessage, ReqorePanel,
|
|
4
|
+
import { ReqoreMessage, ReqorePanel, useReqoreProperty } from '../..';
|
|
5
5
|
import { IReqoreTheme } from '../../constants/theme';
|
|
6
6
|
import { getTypeFromValue } from '../../helpers/utils';
|
|
7
7
|
import { IWithReqoreSize } from '../../types/global';
|
|
8
8
|
import ReqoreButton from '../Button';
|
|
9
9
|
import ReqoreControlGroup from '../ControlGroup';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { ReqoreExportModal } from '../ExportModal';
|
|
11
|
+
import { IReqorePanelAction, IReqorePanelProps } from '../Panel';
|
|
12
|
+
import { getExportActions, getZoomActions, sizeToZoom, zoomToSize } from '../Table/helpers';
|
|
12
13
|
import ReqoreTag from '../Tag';
|
|
13
14
|
|
|
14
15
|
export interface IReqoreTreeProps extends IReqorePanelProps, IWithReqoreSize {
|
|
@@ -20,6 +21,7 @@ export interface IReqoreTreeProps extends IReqorePanelProps, IWithReqoreSize {
|
|
|
20
21
|
withLabelCopy?: boolean;
|
|
21
22
|
showControls?: boolean;
|
|
22
23
|
zoomable?: boolean;
|
|
24
|
+
exportable?: boolean;
|
|
23
25
|
defaultZoom?: 0 | 0.5 | 1 | 1.5 | 2;
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -41,29 +43,23 @@ export const ReqoreTree = ({
|
|
|
41
43
|
onItemClick,
|
|
42
44
|
withLabelCopy,
|
|
43
45
|
showControls = true,
|
|
46
|
+
|
|
47
|
+
exportable,
|
|
44
48
|
zoomable,
|
|
45
49
|
defaultZoom,
|
|
46
50
|
...rest
|
|
47
51
|
}: IReqoreTreeProps) => {
|
|
48
|
-
const [_mode, setMode] = useState<'tree' | 'copy'>(mode);
|
|
49
52
|
const [items, setItems] = useState({});
|
|
50
53
|
const [allExpanded, setAllExpanded] = useState(expanded || !showControls);
|
|
51
54
|
const [_showTypes, setShowTypes] = useState(showTypes);
|
|
52
55
|
const addNotification = useReqoreProperty('addNotification');
|
|
53
56
|
const [zoom, setZoom] = useState(defaultZoom || sizeToZoom[size]);
|
|
54
|
-
|
|
55
|
-
const handleCopyClick = () => {
|
|
56
|
-
setMode('copy');
|
|
57
|
-
};
|
|
57
|
+
const [showExportModal, setShowExportModal] = useState<'full' | 'current' | undefined>(undefined);
|
|
58
58
|
|
|
59
59
|
const handleTypesClick = () => {
|
|
60
60
|
setShowTypes(!_showTypes);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const handleTreeClick = () => {
|
|
64
|
-
setMode('tree');
|
|
65
|
-
};
|
|
66
|
-
|
|
67
63
|
const handleExpandClick = () => {
|
|
68
64
|
setItems({});
|
|
69
65
|
setAllExpanded(true);
|
|
@@ -173,73 +169,84 @@ export const ReqoreTree = ({
|
|
|
173
169
|
return text;
|
|
174
170
|
};
|
|
175
171
|
|
|
172
|
+
const actions = useMemo(() => {
|
|
173
|
+
let _actions: IReqorePanelAction[] = [];
|
|
174
|
+
|
|
175
|
+
if (showControls) {
|
|
176
|
+
_actions = [
|
|
177
|
+
{
|
|
178
|
+
className: 'reqore-tree-expand-all',
|
|
179
|
+
icon: 'ArrowDownFill',
|
|
180
|
+
onClick: handleExpandClick,
|
|
181
|
+
show: !!(isDeep() && !allExpanded),
|
|
182
|
+
label: 'Expand all',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
show: !!(isDeep() && (allExpanded || lodashSize(items) > 0)),
|
|
186
|
+
className: 'reqore-tree-collapse-all',
|
|
187
|
+
icon: 'ArrowUpFill',
|
|
188
|
+
onClick: handleCollapseClick,
|
|
189
|
+
|
|
190
|
+
label: 'Collapse all',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
className: 'reqore-tree-show-types',
|
|
194
|
+
icon: 'CodeBoxFill',
|
|
195
|
+
active: _showTypes,
|
|
196
|
+
onClick: handleTypesClick,
|
|
197
|
+
label: 'Show types',
|
|
198
|
+
},
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (zoomable || exportable) {
|
|
203
|
+
const moreActions: IReqorePanelAction = {
|
|
204
|
+
className: 'reqore-tree-more',
|
|
205
|
+
icon: 'MoreLine',
|
|
206
|
+
actions: [],
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
if (zoomable) {
|
|
210
|
+
moreActions.actions = [
|
|
211
|
+
...moreActions.actions,
|
|
212
|
+
...getZoomActions('reqore-tree', zoom, setZoom, true),
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (exportable) {
|
|
217
|
+
moreActions.actions = [
|
|
218
|
+
...moreActions.actions,
|
|
219
|
+
{ divider: true, line: true },
|
|
220
|
+
...getExportActions((type) => setShowExportModal(type)),
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
_actions = [..._actions, moreActions];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return _actions;
|
|
228
|
+
}, [allExpanded, items, showControls, _showTypes, isDeep(), zoom]);
|
|
229
|
+
|
|
176
230
|
if (!data || !Object.keys(data).length) {
|
|
177
231
|
return <p>No data</p>;
|
|
178
232
|
}
|
|
179
233
|
|
|
180
|
-
const textData: string = renderText(data);
|
|
181
|
-
|
|
182
234
|
return (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
flat
|
|
187
|
-
transparent
|
|
188
|
-
size={size}
|
|
189
|
-
{...rest}
|
|
190
|
-
actions={
|
|
191
|
-
showControls
|
|
192
|
-
? [
|
|
193
|
-
{
|
|
194
|
-
fluid: false,
|
|
195
|
-
group: getZoomActions('reqore-tree', zoom, setZoom),
|
|
196
|
-
show: !!zoomable,
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
className: 'reqore-tree-expand-all',
|
|
200
|
-
icon: 'ArrowDownFill',
|
|
201
|
-
onClick: handleExpandClick,
|
|
202
|
-
show: !!(isDeep() && !allExpanded),
|
|
203
|
-
label: 'Expand all',
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
show: !!(isDeep() && (allExpanded || lodashSize(items) > 0)),
|
|
207
|
-
className: 'reqore-tree-collapse-all',
|
|
208
|
-
icon: 'ArrowUpFill',
|
|
209
|
-
onClick: handleCollapseClick,
|
|
210
|
-
|
|
211
|
-
label: 'Collapse all',
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
className: 'reqore-tree-show-types',
|
|
215
|
-
icon: 'CodeBoxFill',
|
|
216
|
-
active: _showTypes,
|
|
217
|
-
onClick: handleTypesClick,
|
|
218
|
-
label: 'Show types',
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
className: _mode === 'tree' ? 'reqore-tree-as-text' : 'reqore-tree-as-tree',
|
|
222
|
-
onClick: _mode === 'tree' ? handleCopyClick : handleTreeClick,
|
|
223
|
-
icon: _mode === 'tree' ? 'Menu2Fill' : 'ClipboardFill',
|
|
224
|
-
label: _mode === 'tree' ? 'Text View' : 'Tree View',
|
|
225
|
-
},
|
|
226
|
-
]
|
|
227
|
-
: undefined
|
|
228
|
-
}
|
|
229
|
-
>
|
|
230
|
-
{_mode === 'tree' && renderTree(data, true)}
|
|
231
|
-
|
|
232
|
-
{_mode === 'copy' && (
|
|
233
|
-
<ReqoreTextarea
|
|
234
|
-
className='reqore-tree-textarea'
|
|
235
|
-
id='tree-content'
|
|
236
|
-
value={textData}
|
|
237
|
-
scaleWithContent
|
|
238
|
-
size={size}
|
|
239
|
-
fluid
|
|
240
|
-
readOnly
|
|
241
|
-
/>
|
|
235
|
+
<>
|
|
236
|
+
{showExportModal && (
|
|
237
|
+
<ReqoreExportModal data={data} onClose={() => setShowExportModal(undefined)} />
|
|
242
238
|
)}
|
|
243
|
-
|
|
239
|
+
<ReqorePanel
|
|
240
|
+
className='reqore-tree'
|
|
241
|
+
minimal
|
|
242
|
+
flat
|
|
243
|
+
transparent
|
|
244
|
+
size={size}
|
|
245
|
+
{...rest}
|
|
246
|
+
actions={actions}
|
|
247
|
+
>
|
|
248
|
+
{renderTree(data, true)}
|
|
249
|
+
</ReqorePanel>
|
|
250
|
+
</>
|
|
244
251
|
);
|
|
245
252
|
};
|
package/src/helpers/utils.ts
CHANGED
|
@@ -45,14 +45,22 @@ export const getTypeFromValue: Function = (item: any): string => {
|
|
|
45
45
|
return 'null';
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export const getLineCount = (value: string): number => {
|
|
48
|
+
export const getLineCount = (value: string | null): number => {
|
|
49
49
|
try {
|
|
50
|
-
return value
|
|
50
|
+
return value?.match(/[^\n]*\n[^\n]*/gi)?.length ?? 0;
|
|
51
51
|
} catch (e) {
|
|
52
52
|
return 0;
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
// A function that takes list of objects and transforms it
|
|
57
|
+
// to a CSV string
|
|
58
|
+
export const convertToCSV = (objArray: any[]): string => {
|
|
59
|
+
const header = Object.keys(objArray[0]).join(',');
|
|
60
|
+
const rows = objArray.map((obj) => Object.values(obj).join(','));
|
|
61
|
+
return [header, ...rows].join('\n');
|
|
62
|
+
};
|
|
63
|
+
|
|
56
64
|
export const calculateStringSizeInPixels = (value: string = '', fontSize: number): number => {
|
|
57
65
|
const widths = [
|
|
58
66
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
@@ -15,7 +15,7 @@ export interface IReqoreAutoFocusRules {
|
|
|
15
15
|
export const useAutoFocus = (
|
|
16
16
|
element: HTMLInputElement | HTMLTextAreaElement,
|
|
17
17
|
rules?: IReqoreAutoFocusRules,
|
|
18
|
-
onChange?: (
|
|
18
|
+
onChange?: (event: any) => void
|
|
19
19
|
) => {
|
|
20
20
|
const isInViewport = useRef<boolean>(false);
|
|
21
21
|
const observer = useRef<IntersectionObserver>(null);
|
package/src/index.tsx
CHANGED
|
@@ -24,6 +24,7 @@ export {
|
|
|
24
24
|
} from './components/Header';
|
|
25
25
|
export { default as ReqoreIcon } from './components/Icon';
|
|
26
26
|
export { default as ReqoreInput } from './components/Input';
|
|
27
|
+
export { ReqoreKeyValueTable } from './components/KeyValueTable';
|
|
27
28
|
export { default as ReqoreLayoutContent } from './components/Layout/content';
|
|
28
29
|
export { default as ReqoreMenu } from './components/Menu';
|
|
29
30
|
export { default as ReqoreMenuDivider } from './components/Menu/divider';
|
|
@@ -49,6 +50,7 @@ export { default as ReqoreTable } from './components/Table';
|
|
|
49
50
|
export { ReqoreTableBodyCell } from './components/Table/cell';
|
|
50
51
|
export { ReqoreTableHeaderCell } from './components/Table/headerCell';
|
|
51
52
|
export { default as ReqoreTableRow } from './components/Table/row';
|
|
53
|
+
export { ReqoreTableValue } from './components/Table/value';
|
|
52
54
|
export { default as ReqoreTabs } from './components/Tabs';
|
|
53
55
|
export { default as ReqoreTabsContent } from './components/Tabs/content';
|
|
54
56
|
export { default as ReqoreTabsListItem } from './components/Tabs/item';
|
package/src/mock/tableData.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { IReqoreTableProps } from '../components/Table';
|
|
2
2
|
import data from './data.json';
|
|
3
3
|
|
|
4
|
+
export type TestTableItem = {
|
|
5
|
+
id: number;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
address: string;
|
|
9
|
+
age: number;
|
|
10
|
+
occupation: string;
|
|
11
|
+
group: string;
|
|
12
|
+
_selectId: number;
|
|
13
|
+
_disabled: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
4
16
|
export const tableData = data;
|
|
5
17
|
export const testColumns: IReqoreTableProps['columns'] = [
|
|
6
18
|
{
|
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IReqoreBreadcrumbItem, IReqoreBreadcrumbsProps } from '../../components/Breadcrumbs';
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
3
2
|
import { ReqoreBreadcrumbs } from '../../index';
|
|
4
3
|
import breadcrumbs, { breadcrumbsTabs } from '../../mock/breadcrumbs';
|
|
5
|
-
import {
|
|
4
|
+
import { StoryMeta } from '../utils';
|
|
6
5
|
import { SizeArg } from '../utils/args';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
const meta = {
|
|
9
8
|
title: 'Navigation/Breadcrumbs/Stories',
|
|
9
|
+
component: ReqoreBreadcrumbs,
|
|
10
10
|
argTypes: {
|
|
11
11
|
withTabs: {
|
|
12
12
|
name: 'With tabs',
|
|
13
|
-
defaultValue: false,
|
|
14
13
|
description: 'Whether tabs should be shown alongside the breadcrumbs',
|
|
15
14
|
control: 'boolean',
|
|
16
15
|
},
|
|
17
16
|
...SizeArg,
|
|
18
17
|
},
|
|
19
|
-
|
|
18
|
+
args: { items: breadcrumbs },
|
|
19
|
+
} as StoryMeta<typeof ReqoreBreadcrumbs>;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
) => {
|
|
24
|
-
const items = args.withTabs ? [...breadcrumbs, breadcrumbsTabs] : breadcrumbs;
|
|
25
|
-
const customTheme = args.customTheme ? { main: args.customTheme } : undefined;
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
items={items as IReqoreBreadcrumbItem[]}
|
|
31
|
-
customTheme={customTheme as any}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const Default = buildTemplate(Template);
|
|
37
|
-
export const WithTabs = buildTemplate(Template, { withTabs: true });
|
|
38
|
-
export const Flat = buildTemplate(Template, { flat: true });
|
|
24
|
+
export const Default: Story = {};
|
|
25
|
+
export const WithTabs: Story = { args: { items: [...breadcrumbs, breadcrumbsTabs] } };
|
|
26
|
+
export const Flat: Story = { args: { flat: true } };
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StoryFn, StoryObj } from '@storybook/react';
|
|
2
2
|
import { noop } from 'lodash';
|
|
3
3
|
import ReqoreButton from '../../components/Button';
|
|
4
|
-
import { IReqoreTheme } from '../../constants/theme';
|
|
5
4
|
import { ReqoreControlGroup } from '../../index';
|
|
5
|
+
import { StoryMeta } from '../utils';
|
|
6
6
|
import { IconArg, SizeArg } from '../utils/args';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const meta = {
|
|
9
9
|
title: 'Form/Button/Stories',
|
|
10
|
-
|
|
11
|
-
jest: ['button.test.tsx'],
|
|
12
|
-
},
|
|
10
|
+
component: ReqoreButton,
|
|
13
11
|
argTypes: {
|
|
14
12
|
...IconArg('icon', 'Icon'),
|
|
15
13
|
...IconArg('rightIcon', 'Right Icon'),
|
|
16
14
|
...SizeArg,
|
|
17
15
|
},
|
|
18
|
-
|
|
16
|
+
args: {
|
|
17
|
+
icon: '24HoursFill',
|
|
18
|
+
rightIcon: '24HoursFill',
|
|
19
|
+
},
|
|
20
|
+
} as StoryMeta<typeof ReqoreButton>;
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
const Template: StoryFn<typeof ReqoreButton> = (buttonProps) => {
|
|
21
26
|
return (
|
|
22
27
|
<ReqoreControlGroup vertical gapSize='big'>
|
|
23
28
|
<ReqoreControlGroup size={buttonProps.size} wrap>
|
|
@@ -246,54 +251,85 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
|
|
|
246
251
|
);
|
|
247
252
|
};
|
|
248
253
|
|
|
249
|
-
export const Default =
|
|
250
|
-
|
|
251
|
-
Info.args = {
|
|
252
|
-
intent: 'info',
|
|
254
|
+
export const Default: Story = {
|
|
255
|
+
render: Template,
|
|
253
256
|
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
|
|
258
|
+
export const Info: Story = {
|
|
259
|
+
render: Template,
|
|
260
|
+
|
|
261
|
+
args: {
|
|
262
|
+
intent: 'info',
|
|
263
|
+
},
|
|
257
264
|
};
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
265
|
+
|
|
266
|
+
export const Success: Story = {
|
|
267
|
+
render: Template,
|
|
268
|
+
|
|
269
|
+
args: {
|
|
270
|
+
intent: 'success',
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export const Warning: Story = {
|
|
275
|
+
render: Template,
|
|
276
|
+
|
|
277
|
+
args: {
|
|
278
|
+
intent: 'warning',
|
|
279
|
+
},
|
|
261
280
|
};
|
|
262
|
-
|
|
263
|
-
Pending
|
|
264
|
-
|
|
281
|
+
|
|
282
|
+
export const Pending: Story = {
|
|
283
|
+
render: Template,
|
|
284
|
+
|
|
285
|
+
args: {
|
|
286
|
+
intent: 'pending',
|
|
287
|
+
},
|
|
265
288
|
};
|
|
266
|
-
|
|
267
|
-
Danger
|
|
268
|
-
|
|
289
|
+
|
|
290
|
+
export const Danger: Story = {
|
|
291
|
+
render: Template,
|
|
292
|
+
|
|
293
|
+
args: {
|
|
294
|
+
intent: 'danger',
|
|
295
|
+
},
|
|
269
296
|
};
|
|
270
|
-
|
|
271
|
-
Muted
|
|
272
|
-
|
|
297
|
+
|
|
298
|
+
export const Muted: Story = {
|
|
299
|
+
render: Template,
|
|
300
|
+
|
|
301
|
+
args: {
|
|
302
|
+
intent: 'muted',
|
|
303
|
+
},
|
|
273
304
|
};
|
|
274
|
-
|
|
275
|
-
Effect
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
305
|
+
|
|
306
|
+
export const Effect: Story = {
|
|
307
|
+
render: Template,
|
|
308
|
+
|
|
309
|
+
args: {
|
|
310
|
+
effect: {
|
|
311
|
+
gradient: {
|
|
312
|
+
direction: 'to right bottom',
|
|
313
|
+
colors: { 0: '#33023c', 100: '#0a487b' },
|
|
314
|
+
animate: 'active',
|
|
315
|
+
},
|
|
316
|
+
spaced: 2,
|
|
317
|
+
uppercase: true,
|
|
318
|
+
weight: 'thick',
|
|
319
|
+
textSize: 'small',
|
|
281
320
|
},
|
|
282
|
-
spaced: 2,
|
|
283
|
-
uppercase: true,
|
|
284
|
-
weight: 'thick',
|
|
285
|
-
textSize: 'small',
|
|
286
321
|
},
|
|
287
322
|
};
|
|
288
323
|
|
|
289
|
-
export const GlobalEffect:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
324
|
+
export const GlobalEffect: Story = {
|
|
325
|
+
render: Template,
|
|
326
|
+
|
|
327
|
+
args: {
|
|
328
|
+
otherThemeOptions: {
|
|
329
|
+
buttons: {
|
|
330
|
+
gradient: true,
|
|
331
|
+
animate: 'active',
|
|
332
|
+
},
|
|
297
333
|
},
|
|
298
334
|
},
|
|
299
|
-
}
|
|
335
|
+
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StoryFn, StoryObj } from '@storybook/react';
|
|
2
2
|
import Checkbox from '../../components/Checkbox';
|
|
3
3
|
import { ReqoreCheckbox, ReqoreControlGroup, ReqoreVerticalSpacer } from '../../index';
|
|
4
|
+
import { StoryMeta } from '../utils';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const meta = {
|
|
6
7
|
title: 'Form/Checkbox/Stories',
|
|
7
|
-
|
|
8
|
-
} as
|
|
8
|
+
component: ReqoreCheckbox,
|
|
9
|
+
} as StoryMeta<typeof ReqoreCheckbox>;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
const Template: StoryFn<typeof Checkbox> = (args) => {
|
|
11
15
|
return (
|
|
12
16
|
<ReqoreControlGroup vertical>
|
|
13
17
|
<ReqoreControlGroup wrap>
|
|
@@ -58,8 +62,14 @@ const Template: ComponentStory<typeof Checkbox> = (args) => {
|
|
|
58
62
|
);
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
export const Basic =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
export const Basic: Story = {
|
|
66
|
+
render: Template,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const Switch: Story = {
|
|
70
|
+
render: Template,
|
|
71
|
+
|
|
72
|
+
args: {
|
|
73
|
+
asSwitch: true,
|
|
74
|
+
},
|
|
65
75
|
};
|