@scality/core-ui 0.128.0 → 0.130.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/dist/components/UnsuccessfulResult.component.d.ts +24 -0
- package/dist/components/UnsuccessfulResult.component.d.ts.map +1 -0
- package/dist/components/UnsuccessfulResult.component.js +21 -0
- package/dist/components/icon/Icon.component.d.ts +2 -0
- package/dist/components/icon/Icon.component.d.ts.map +1 -1
- package/dist/components/icon/Icon.component.js +2 -0
- package/dist/components/inputv2/inputv2.d.ts +2 -2
- package/dist/components/tablev2/TableCommon.d.ts.map +1 -1
- package/dist/components/tablev2/TableCommon.js +6 -12
- package/dist/components/tablev2/TableUtils.d.ts +1 -1
- package/dist/components/tablev2/TableUtils.d.ts.map +1 -1
- package/dist/components/tablev2/TableUtils.js +1 -1
- package/dist/components/tablev2/Tablestyle.d.ts +0 -5
- package/dist/components/tablev2/Tablestyle.d.ts.map +1 -1
- package/dist/components/tablev2/Tablestyle.js +0 -9
- package/package.json +1 -1
- package/src/lib/components/UnsuccessfulResult.component.tsx +50 -0
- package/src/lib/components/icon/Icon.component.tsx +2 -0
- package/src/lib/components/tablev2/TableCommon.tsx +10 -27
- package/src/lib/components/tablev2/TableUtils.ts +2 -2
- package/src/lib/components/tablev2/Tablestyle.tsx +0 -9
- package/stories/noresult.stories.tsx +33 -0
- package/stories/tablev2.stories.tsx +38 -32
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableHeightKeyType, TableLocalType } from './tablev2/TableUtils';
|
|
3
|
+
export type UnsuccessfulResultProps = {
|
|
4
|
+
name?: {
|
|
5
|
+
en: {
|
|
6
|
+
singular: string;
|
|
7
|
+
plural: string;
|
|
8
|
+
};
|
|
9
|
+
fr?: {
|
|
10
|
+
singular: string;
|
|
11
|
+
plural: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
locale?: TableLocalType;
|
|
15
|
+
status: 'error' | 'loading' | 'idle' | 'noResult';
|
|
16
|
+
} & ({
|
|
17
|
+
rowHeight: TableHeightKeyType;
|
|
18
|
+
heightInRem?: never;
|
|
19
|
+
} | {
|
|
20
|
+
rowHeight?: never;
|
|
21
|
+
heightInRem?: number | string;
|
|
22
|
+
});
|
|
23
|
+
export declare const UnsuccessfulResult: (props: UnsuccessfulResultProps) => JSX.Element;
|
|
24
|
+
//# sourceMappingURL=UnsuccessfulResult.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnsuccessfulResult.component.d.ts","sourceRoot":"","sources":["../../src/lib/components/UnsuccessfulResult.component.tsx"],"names":[],"mappings":";AAGA,OAAO,EACL,kBAAkB,EAClB,cAAc,EAGf,MAAM,sBAAsB,CAAC;AAc9B,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,EAAE;QACL,EAAE,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,EAAE,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3C,CAAC;IACF,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;CACnD,GAAG,CACA;IAAE,SAAS,EAAE,kBAAkB,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,GACtD;IAAE,SAAS,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CACvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,uBAAuB,gBAehE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Icon } from './icon/Icon.component';
|
|
4
|
+
import { Loader } from './loader/Loader.component';
|
|
5
|
+
import { tableRowHeight, translatedMessages, } from './tablev2/TableUtils';
|
|
6
|
+
import { Text } from './text/Text.component';
|
|
7
|
+
import { Box } from './box/Box';
|
|
8
|
+
import { spacing } from '../spacing';
|
|
9
|
+
const NoResult = styled(Box) `
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
color: ${(props) => props.theme.textSecondary};
|
|
14
|
+
height: ${(props) => props.height}rem;
|
|
15
|
+
gap: ${spacing.r8};
|
|
16
|
+
`;
|
|
17
|
+
export const UnsuccessfulResult = (props) => {
|
|
18
|
+
const { heightInRem = 5, name, locale, status, rowHeight } = props;
|
|
19
|
+
const height = rowHeight ? tableRowHeight[rowHeight] : heightInRem;
|
|
20
|
+
return (_jsxs(NoResult, { height: height, children: [(status === 'loading' || status === 'idle') && _jsx(Loader, {}), status === 'error' && (_jsx(Icon, { name: "Exclamation-circle", color: "statusWarning" })), _jsx(Text, { color: "textSecondary", children: translatedMessages(status, name, locale) })] }));
|
|
21
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/Icon.component.tsx"],"names":[],"mappings":"AAAA,OAAc,EACZ,aAAa,EAKd,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"Icon.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon/Icon.component.tsx"],"names":[],"mappings":"AAAA,OAAc,EACZ,aAAa,EAKd,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwHrB,CAAC;AAaF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC;AAC1C,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAiBF,eAAO,MAAM,WAAW;UAAsB,QAAQ;SAiCrD,CAAC;AAkEF,iBAAS,IAAI,CAAC,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,eAU7C;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -12,8 +12,8 @@ export type InputProps = {
|
|
|
12
12
|
export declare const Input: import("react").ForwardRefExoticComponent<{
|
|
13
13
|
error?: string | undefined;
|
|
14
14
|
id: string;
|
|
15
|
-
leftIcon?: "Account" | "Backend" | "Tape" | "Node-backend" | "Volume-backend" | "Node-pdf" | "Volume-pdf" | "Network" | "Bucket" | "Cloud-backend" | "Datacenter" | "Simple-user" | "User" | "Group" | "Alert" | "Bell" | "Lat-menu" | "Dashboard" | "Workflow" | "Expiration" | "Replication" | "Transition" | "Discovery" | "Metrics" | "Edit" | "Logs" | "Lock" | "Lock-open" | "Create-add" | "Delete" | "Save" | "External-link" | "Link" | "Unlink" | "Close" | "Dropdown-down" | "Dropdown-up" | "Search" | "More" | "Info" | "Sync" | "Export" | "Copy" | "Simple-upload" | "Upload" | "Add-plus" | "Minus" | "Remove-minus" | "Sort" | "Sort-up" | "Sort-down" | "Calendar" | "Calendar-minus" | "Arrow-up" | "Arrow-down" | "Arrow-right" | "Arrow-left" | "Arrow-alt-circle-up" | "Folder" | "File" | "File-invoice" | "Deletion-marker" | "Map-marker" | "Location" | "Info-circle" | "Exclamation-triangle" | "Exclamation-circle" | "Exclamation" | "Check" | "Protected" | "Chevron-left" | "Chevron-right" | "Chevron-down" | "Chevron-up" | "Angle-right" | "Angle-double-right" | "Language" | "Theme" | "Documentation" | "Support" | "EULA" | "Log-out" | "Hourglass" | "Pause" | "Pause-circle" | "Play-circle" | "Upgrade" | "Expansion" | "Rebalance" | "Maintenance" | "Role" | "Change-erasure" | "Circle-health" | "Circle-empty" | "Dot-circle" | "Check-circle" | "Times-circle" | "Toolbox" | "Cubes" | "File-alt" | "Policy" | "Pen" | "Pencil" | "Eye" | "EyeSlash" | "Snowflake" | "Key" | "Filter" | "Download" | "Certificate" | "Redo" | "Eraser" | "ID-card" | "Setting" | "Desktop" | "Globe" | "Satellite" | undefined;
|
|
16
|
-
rightIcon?: "Account" | "Backend" | "Tape" | "Node-backend" | "Volume-backend" | "Node-pdf" | "Volume-pdf" | "Network" | "Bucket" | "Cloud-backend" | "Datacenter" | "Simple-user" | "User" | "Group" | "Alert" | "Bell" | "Lat-menu" | "Dashboard" | "Workflow" | "Expiration" | "Replication" | "Transition" | "Discovery" | "Metrics" | "Edit" | "Logs" | "Lock" | "Lock-open" | "Create-add" | "Delete" | "Save" | "External-link" | "Link" | "Unlink" | "Close" | "Dropdown-down" | "Dropdown-up" | "Search" | "More" | "Info" | "Sync" | "Export" | "Copy" | "Simple-upload" | "Upload" | "Add-plus" | "Minus" | "Remove-minus" | "Sort" | "Sort-up" | "Sort-down" | "Calendar" | "Calendar-minus" | "Arrow-up" | "Arrow-down" | "Arrow-right" | "Arrow-left" | "Arrow-alt-circle-up" | "Folder" | "File" | "File-invoice" | "Deletion-marker" | "Map-marker" | "Location" | "Info-circle" | "Exclamation-triangle" | "Exclamation-circle" | "Exclamation" | "Check" | "Protected" | "Chevron-left" | "Chevron-right" | "Chevron-down" | "Chevron-up" | "Angle-right" | "Angle-double-right" | "Language" | "Theme" | "Documentation" | "Support" | "EULA" | "Log-out" | "Hourglass" | "Pause" | "Pause-circle" | "Play-circle" | "Upgrade" | "Expansion" | "Rebalance" | "Maintenance" | "Role" | "Change-erasure" | "Circle-health" | "Circle-empty" | "Dot-circle" | "Check-circle" | "Times-circle" | "Toolbox" | "Cubes" | "File-alt" | "Policy" | "Pen" | "Pencil" | "Eye" | "EyeSlash" | "Snowflake" | "Key" | "Filter" | "Download" | "Certificate" | "Redo" | "Eraser" | "ID-card" | "Setting" | "Desktop" | "Globe" | "Satellite" | undefined;
|
|
15
|
+
leftIcon?: "Account" | "Backend" | "Tape" | "Node-backend" | "Volume-backend" | "Node-pdf" | "Volume-pdf" | "Network" | "Bucket" | "Cloud-backend" | "Datacenter" | "Simple-user" | "User" | "Group" | "Alert" | "Bell" | "Lat-menu" | "Dashboard" | "Workflow" | "Expiration" | "Replication" | "Transition" | "Discovery" | "Metrics" | "Edit" | "Logs" | "Lock" | "Lock-open" | "Create-add" | "Delete" | "Save" | "External-link" | "Link" | "Unlink" | "Close" | "Dropdown-down" | "Dropdown-up" | "Search" | "More" | "Info" | "Sync" | "Export" | "Copy" | "Simple-upload" | "Upload" | "Add-plus" | "Minus" | "Remove-minus" | "Sort" | "Sort-up" | "Sort-down" | "Calendar" | "Calendar-minus" | "Arrow-up" | "Arrow-down" | "Arrow-right" | "Arrow-left" | "Arrow-alt-circle-up" | "Folder" | "File" | "File-invoice" | "Deletion-marker" | "Map-marker" | "Location" | "Info-circle" | "Exclamation-triangle" | "Exclamation-circle" | "Exclamation" | "Check" | "Protected" | "Chevron-left" | "Chevron-right" | "Chevron-down" | "Chevron-up" | "Angle-right" | "Angle-double-right" | "Language" | "Theme" | "Documentation" | "Support" | "EULA" | "Log-out" | "Hourglass" | "Pause" | "Pause-circle" | "Play-circle" | "Upgrade" | "Expansion" | "Rebalance" | "Maintenance" | "Role" | "Change-erasure" | "Circle-health" | "Circle-empty" | "Dot-circle" | "Check-circle" | "Times-circle" | "Toolbox" | "Cubes" | "File-alt" | "Policy" | "Pen" | "Pencil" | "Eye" | "EyeSlash" | "Snowflake" | "Key" | "Filter" | "Download" | "Certificate" | "Redo" | "Eraser" | "ID-card" | "Setting" | "Desktop" | "Globe" | "Satellite" | "LightMode" | "DarkMode" | undefined;
|
|
16
|
+
rightIcon?: "Account" | "Backend" | "Tape" | "Node-backend" | "Volume-backend" | "Node-pdf" | "Volume-pdf" | "Network" | "Bucket" | "Cloud-backend" | "Datacenter" | "Simple-user" | "User" | "Group" | "Alert" | "Bell" | "Lat-menu" | "Dashboard" | "Workflow" | "Expiration" | "Replication" | "Transition" | "Discovery" | "Metrics" | "Edit" | "Logs" | "Lock" | "Lock-open" | "Create-add" | "Delete" | "Save" | "External-link" | "Link" | "Unlink" | "Close" | "Dropdown-down" | "Dropdown-up" | "Search" | "More" | "Info" | "Sync" | "Export" | "Copy" | "Simple-upload" | "Upload" | "Add-plus" | "Minus" | "Remove-minus" | "Sort" | "Sort-up" | "Sort-down" | "Calendar" | "Calendar-minus" | "Arrow-up" | "Arrow-down" | "Arrow-right" | "Arrow-left" | "Arrow-alt-circle-up" | "Folder" | "File" | "File-invoice" | "Deletion-marker" | "Map-marker" | "Location" | "Info-circle" | "Exclamation-triangle" | "Exclamation-circle" | "Exclamation" | "Check" | "Protected" | "Chevron-left" | "Chevron-right" | "Chevron-down" | "Chevron-up" | "Angle-right" | "Angle-double-right" | "Language" | "Theme" | "Documentation" | "Support" | "EULA" | "Log-out" | "Hourglass" | "Pause" | "Pause-circle" | "Play-circle" | "Upgrade" | "Expansion" | "Rebalance" | "Maintenance" | "Role" | "Change-erasure" | "Circle-health" | "Circle-empty" | "Dot-circle" | "Check-circle" | "Times-circle" | "Toolbox" | "Cubes" | "File-alt" | "Policy" | "Pen" | "Pencil" | "Eye" | "EyeSlash" | "Snowflake" | "Key" | "Filter" | "Download" | "Certificate" | "Redo" | "Eraser" | "ID-card" | "Setting" | "Desktop" | "Globe" | "Satellite" | "LightMode" | "DarkMode" | undefined;
|
|
17
17
|
size?: InputSize | undefined;
|
|
18
18
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
19
|
//# sourceMappingURL=inputv2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCommon.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/TableCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EACL,aAAa,EAEb,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"TableCommon.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/TableCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EACL,aAAa,EAEb,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,kBAAkB,EAClB,cAAc,EAEf,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,KAAK,mBAAmB,CACtB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAChE;IACF,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtB,SAAS,EAAE,aAAa,CAAC,uBAAuB,CAAC,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,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,sBA0DzE"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from 'react';
|
|
3
3
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
4
4
|
import { FixedSizeList as List, } from 'react-window';
|
|
5
|
-
import { convertRemToPixels,
|
|
5
|
+
import { convertRemToPixels, tableRowHeight, } from './TableUtils';
|
|
6
6
|
import { useTableContext } from './Tablev2.component';
|
|
7
|
-
import { NoResult } from './Tablestyle';
|
|
8
|
-
import { Loader } from '../loader/Loader.component';
|
|
9
|
-
import { Text } from '../text/Text.component';
|
|
10
|
-
import { Icon } from '../icon/Icon.component';
|
|
11
7
|
import useSyncedScroll from './useSyncedScroll';
|
|
8
|
+
import { UnsuccessfulResult } from '../UnsuccessfulResult.component';
|
|
12
9
|
export const VirtualizedRows = ({ rows, rowHeight, setHasScrollbar, onBottom, onBottomOffset, RenderRow, listRef, itemKey, }) => (_jsx(AutoSizer, { children: ({ height, width }) => {
|
|
13
10
|
return (_jsx(List, { height: height, itemCount: rows.length, itemSize: convertRemToPixels(tableRowHeight[rowHeight]), width: width, itemKey: itemKey, itemData: rows, ref: listRef, onItemsRendered: ({ visibleStartIndex, visibleStopIndex, overscanStopIndex, }) => {
|
|
14
11
|
setHasScrollbar(visibleStopIndex - visibleStartIndex < overscanStopIndex);
|
|
@@ -49,11 +46,8 @@ export function TableRows({ locale, children, customItemKey, RenderRow }) {
|
|
|
49
46
|
}
|
|
50
47
|
return index;
|
|
51
48
|
}
|
|
52
|
-
if (status === 'idle' || status === 'loading') {
|
|
53
|
-
return (
|
|
54
|
-
}
|
|
55
|
-
if (status === 'error') {
|
|
56
|
-
return (_jsxs(NoResult, { rowHeight: rowHeight, children: [_jsx(Icon, { name: "Exclamation-circle", color: "statusWarning" }), _jsx(Text, { color: "textSecondary", children: translatedMessages('error', entityName, locale) })] }));
|
|
49
|
+
if (status === 'idle' || status === 'loading' || status === 'error') {
|
|
50
|
+
return (_jsx(UnsuccessfulResult, { name: entityName, status: status, locale: locale, rowHeight: rowHeight }));
|
|
57
51
|
}
|
|
58
52
|
if (status === 'success' || status === undefined) {
|
|
59
53
|
if (typeof children === 'function') {
|
|
@@ -63,7 +57,7 @@ export function TableRows({ locale, children, customItemKey, RenderRow }) {
|
|
|
63
57
|
return (_jsx(VirtualizedRows, { rows: rows, listRef: bodyRef, setHasScrollbar: setHasScrollbar, onBottom: onBottom, onBottomOffset: onBottomOffset, itemKey: itemKey, rowHeight: rowHeight, RenderRow: RenderRow }));
|
|
64
58
|
}
|
|
65
59
|
else {
|
|
66
|
-
return
|
|
60
|
+
return _jsx(UnsuccessfulResult, { name: entityName, status: "noResult" });
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
63
|
return null;
|
|
@@ -14,7 +14,7 @@ export declare const tableRowHeight: {
|
|
|
14
14
|
h48: string;
|
|
15
15
|
h64: string;
|
|
16
16
|
};
|
|
17
|
-
type TableMessagesType = 'error' | 'loading' | 'noResult';
|
|
17
|
+
type TableMessagesType = 'error' | 'loading' | 'idle' | 'noResult';
|
|
18
18
|
export declare const translatedMessages: (type: TableMessagesType, entityName?: {
|
|
19
19
|
en: {
|
|
20
20
|
singular: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableUtils.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/TableUtils.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,eAAe,aAAa,CAAC;AACnC,QAAA,MAAM,cAAc,YAAY,CAAC;AACjC,QAAA,MAAM,WAAW,SAAS,CAAC;AAC3B,QAAA,MAAM,aAAa,YAAY,CAAC;AAEhC,KAAK,UAAU,G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AkB,GAClB,kBAAkB,GAClB,kBAAkB,CAAC;AAGvB,eAAO,MAAM,cAAc;;;;;CAK1B,CAAC;AAEF,KAAK,iBAAiB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAEnE,eAAO,MAAM,kBAAkB,SACvB,iBAAiB,eACV;IACX,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,EAAE,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,WACQ,cAAc,WA2BxB,CAAC"}
|
|
@@ -39,7 +39,7 @@ export const translatedMessages = (type, entityName, locale) => {
|
|
|
39
39
|
return `An error occurred while loading ${entityName ? `the ${entityName.en.plural}` : 'data'}, please refresh the
|
|
40
40
|
page.`;
|
|
41
41
|
}
|
|
42
|
-
if (type === 'loading') {
|
|
42
|
+
if (type === 'loading' || type === 'idle') {
|
|
43
43
|
if (locale === 'fr') {
|
|
44
44
|
return `Chargement des ${((_b = entityName === null || entityName === void 0 ? void 0 : entityName.fr) === null || _b === void 0 ? void 0 : _b.plural) || 'données'}...`;
|
|
45
45
|
}
|
|
@@ -28,11 +28,6 @@ export declare const TableRowMultiSelectable: import("styled-components").Styled
|
|
|
28
28
|
export declare const TableBody: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
29
29
|
export declare const TableWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
30
30
|
export declare const TooltipContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
31
|
-
export declare const NoResult: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").GridProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> & import("styled-system").BordersProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").TypographyProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ShadowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
|
|
32
|
-
gap?: string | number | undefined;
|
|
33
|
-
} & {
|
|
34
|
-
rowHeight: TableHeightKeyType;
|
|
35
|
-
}, never>;
|
|
36
31
|
export declare const SortCaret: <DATA_ROW extends Record<string, unknown> = Record<string, unknown>>({ column, }: {
|
|
37
32
|
column: HeaderGroup<DATA_ROW>;
|
|
38
33
|
}) => JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tablestyle.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/Tablestyle.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,kBAAkB,EAElB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,eAAO,MAAM,aAAa,0GAGzB,CAAC;AACF,eAAO,MAAM,gBAAgB,0GAG5B,CAAC;AACF,eAAO,MAAM,WAAW;;cAEZ,MAAM,GAAG,SAAS;SAkB7B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EA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AgB,CAAC;CACzC,CAAC;AACF,eAAO,MAAM,QAAQ,mHAmCpB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB,EAAE,gBAAgB,CAAC;CACzC,CAAC;AACF,eAAO,MAAM,uBAAuB,kIAqBnC,CAAC;AAEF,eAAO,MAAM,SAAS,yGAKrB,CAAC;AACF,eAAO,MAAM,YAAY,yGAKxB,CAAC;AACF,eAAO,MAAM,cAAc,yGAI1B,CAAC;AAEF,eAAO,MAAM,SAAS;;wBAsBrB,CAAC"}
|
|
@@ -4,7 +4,6 @@ import { tableRowHeight, } from './TableUtils';
|
|
|
4
4
|
import { Icon } from '../icon/Icon.component';
|
|
5
5
|
import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
|
|
6
6
|
import { spacing } from '../../spacing';
|
|
7
|
-
import { Box } from '../box/Box';
|
|
8
7
|
const borderSize = '4px';
|
|
9
8
|
export const SortIncentive = styled.span `
|
|
10
9
|
position: absolute;
|
|
@@ -125,14 +124,6 @@ export const TooltipContent = styled.div `
|
|
|
125
124
|
font-weight: bold;
|
|
126
125
|
min-width: 60px;
|
|
127
126
|
`;
|
|
128
|
-
export const NoResult = styled(Box) `
|
|
129
|
-
display: flex;
|
|
130
|
-
justify-content: center;
|
|
131
|
-
align-items: center;
|
|
132
|
-
color: ${(props) => props.theme.textSecondary};
|
|
133
|
-
height: ${(props) => tableRowHeight[props.rowHeight]}rem;
|
|
134
|
-
gap: ${spacing.r8};
|
|
135
|
-
`;
|
|
136
127
|
export const SortCaret = ({ column, }) => {
|
|
137
128
|
return !column.disableSortBy ? (_jsx(SortCaretWrapper, { children: column.isSorted ? (column.isSortedDesc ? (_jsx(Icon, { name: "Sort-down" })) : (_jsx(Icon, { name: "Sort-up" }))) : (_jsx(SortIncentive, { children: _jsx(Icon, { name: "Sort" }) })) })) : null;
|
|
138
129
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Icon } from './icon/Icon.component';
|
|
3
|
+
import { Loader } from './loader/Loader.component';
|
|
4
|
+
import {
|
|
5
|
+
TableHeightKeyType,
|
|
6
|
+
TableLocalType,
|
|
7
|
+
tableRowHeight,
|
|
8
|
+
translatedMessages,
|
|
9
|
+
} from './tablev2/TableUtils';
|
|
10
|
+
import { Text } from './text/Text.component';
|
|
11
|
+
import { Box } from './box/Box';
|
|
12
|
+
import { spacing } from '../spacing';
|
|
13
|
+
|
|
14
|
+
const NoResult = styled(Box)<{ height: number | string }>`
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
color: ${(props) => props.theme.textSecondary};
|
|
19
|
+
height: ${(props) => props.height}rem;
|
|
20
|
+
gap: ${spacing.r8};
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export type UnsuccessfulResultProps = {
|
|
24
|
+
name?: {
|
|
25
|
+
en: { singular: string; plural: string };
|
|
26
|
+
fr?: { singular: string; plural: string };
|
|
27
|
+
};
|
|
28
|
+
locale?: TableLocalType;
|
|
29
|
+
status: 'error' | 'loading' | 'idle' | 'noResult';
|
|
30
|
+
} & (
|
|
31
|
+
| { rowHeight: TableHeightKeyType; heightInRem?: never }
|
|
32
|
+
| { rowHeight?: never; heightInRem?: number | string }
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const UnsuccessfulResult = (props: UnsuccessfulResultProps) => {
|
|
36
|
+
const { heightInRem = 5, name, locale, status, rowHeight } = props;
|
|
37
|
+
const height = rowHeight ? tableRowHeight[rowHeight] : heightInRem;
|
|
38
|
+
return (
|
|
39
|
+
<NoResult height={height}>
|
|
40
|
+
{(status === 'loading' || status === 'idle') && <Loader />}
|
|
41
|
+
{status === 'error' && (
|
|
42
|
+
<Icon name="Exclamation-circle" color="statusWarning" />
|
|
43
|
+
)}
|
|
44
|
+
|
|
45
|
+
<Text color="textSecondary">
|
|
46
|
+
{translatedMessages(status, name, locale)}
|
|
47
|
+
</Text>
|
|
48
|
+
</NoResult>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -9,18 +9,14 @@ import {
|
|
|
9
9
|
} from 'react-window';
|
|
10
10
|
import {
|
|
11
11
|
convertRemToPixels,
|
|
12
|
-
translatedMessages,
|
|
13
12
|
TableHeightKeyType,
|
|
14
13
|
TableLocalType,
|
|
15
14
|
tableRowHeight,
|
|
16
15
|
} from './TableUtils';
|
|
17
16
|
import { useTableContext } from './Tablev2.component';
|
|
18
|
-
import { NoResult } from './Tablestyle';
|
|
19
|
-
import { Loader } from '../loader/Loader.component';
|
|
20
|
-
import { Text } from '../text/Text.component';
|
|
21
|
-
import { Icon } from '../icon/Icon.component';
|
|
22
17
|
import useSyncedScroll from './useSyncedScroll';
|
|
23
18
|
import { CSSProperties } from 'styled-components';
|
|
19
|
+
import { UnsuccessfulResult } from '../UnsuccessfulResult.component';
|
|
24
20
|
|
|
25
21
|
type VirtualizedRowsType<
|
|
26
22
|
DATA_ROW extends Record<string, unknown> = Record<string, unknown>,
|
|
@@ -141,26 +137,17 @@ export function TableRows<
|
|
|
141
137
|
return index;
|
|
142
138
|
}
|
|
143
139
|
|
|
144
|
-
if (status === 'idle' || status === 'loading') {
|
|
140
|
+
if (status === 'idle' || status === 'loading' || status === 'error') {
|
|
145
141
|
return (
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
if (status === 'error') {
|
|
155
|
-
return (
|
|
156
|
-
<NoResult rowHeight={rowHeight}>
|
|
157
|
-
<Icon name="Exclamation-circle" color="statusWarning" />
|
|
158
|
-
<Text color="textSecondary">
|
|
159
|
-
{translatedMessages('error', entityName, locale)}
|
|
160
|
-
</Text>
|
|
161
|
-
</NoResult>
|
|
142
|
+
<UnsuccessfulResult
|
|
143
|
+
name={entityName}
|
|
144
|
+
status={status}
|
|
145
|
+
locale={locale}
|
|
146
|
+
rowHeight={rowHeight}
|
|
147
|
+
/>
|
|
162
148
|
);
|
|
163
149
|
}
|
|
150
|
+
|
|
164
151
|
if (status === 'success' || status === undefined) {
|
|
165
152
|
if (typeof children === 'function') {
|
|
166
153
|
return children(
|
|
@@ -189,11 +176,7 @@ export function TableRows<
|
|
|
189
176
|
/>
|
|
190
177
|
);
|
|
191
178
|
} else {
|
|
192
|
-
return
|
|
193
|
-
<NoResult rowHeight={rowHeight}>
|
|
194
|
-
{translatedMessages('noResult', entityName, locale)}
|
|
195
|
-
</NoResult>
|
|
196
|
-
);
|
|
179
|
+
return <UnsuccessfulResult name={entityName} status="noResult" />;
|
|
197
180
|
}
|
|
198
181
|
}
|
|
199
182
|
|
|
@@ -59,7 +59,7 @@ export const tableRowHeight = {
|
|
|
59
59
|
h64: '4.572', //3 line
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
type TableMessagesType = 'error' | 'loading' | 'noResult';
|
|
62
|
+
type TableMessagesType = 'error' | 'loading' | 'idle' | 'noResult';
|
|
63
63
|
|
|
64
64
|
export const translatedMessages = (
|
|
65
65
|
type: TableMessagesType,
|
|
@@ -80,7 +80,7 @@ export const translatedMessages = (
|
|
|
80
80
|
}, please refresh the
|
|
81
81
|
page.`;
|
|
82
82
|
}
|
|
83
|
-
if (type === 'loading') {
|
|
83
|
+
if (type === 'loading' || type === 'idle') {
|
|
84
84
|
if (locale === 'fr') {
|
|
85
85
|
return `Chargement des ${entityName?.fr?.plural || 'données'}...`;
|
|
86
86
|
}
|
|
@@ -156,15 +156,6 @@ export const TooltipContent = styled.div`
|
|
|
156
156
|
min-width: 60px;
|
|
157
157
|
`;
|
|
158
158
|
|
|
159
|
-
export const NoResult = styled(Box)<{ rowHeight: TableHeightKeyType }>`
|
|
160
|
-
display: flex;
|
|
161
|
-
justify-content: center;
|
|
162
|
-
align-items: center;
|
|
163
|
-
color: ${(props) => props.theme.textSecondary};
|
|
164
|
-
height: ${(props) => tableRowHeight[props.rowHeight]}rem;
|
|
165
|
-
gap: ${spacing.r8};
|
|
166
|
-
`;
|
|
167
|
-
|
|
168
159
|
export const SortCaret = <
|
|
169
160
|
DATA_ROW extends Record<string, unknown> = Record<string, unknown>,
|
|
170
161
|
>({
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import {
|
|
4
|
+
UnsuccessfulResult,
|
|
5
|
+
UnsuccessfulResultProps,
|
|
6
|
+
} from '../src/lib/components/UnsuccessfulResult.component.tsx';
|
|
7
|
+
|
|
8
|
+
type Story = StoryObj<UnsuccessfulResultProps>;
|
|
9
|
+
|
|
10
|
+
const meta: Meta<UnsuccessfulResultProps> = {
|
|
11
|
+
title: 'Components/NoResult',
|
|
12
|
+
component: UnsuccessfulResult,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
export const Loading: Story = {
|
|
18
|
+
render: () => {
|
|
19
|
+
return <UnsuccessfulResult status="loading" />;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Error: Story = {
|
|
24
|
+
render: () => {
|
|
25
|
+
return <UnsuccessfulResult status="error" />;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const NoResult: Story = {
|
|
30
|
+
render: () => {
|
|
31
|
+
return <UnsuccessfulResult status="noResult" />;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -70,6 +70,8 @@ const columns: Column<Entry>[] = [
|
|
|
70
70
|
Header: 'First Name',
|
|
71
71
|
accessor: 'firstName',
|
|
72
72
|
cellStyle: {
|
|
73
|
+
width: 'unset',
|
|
74
|
+
flex: 2,
|
|
73
75
|
textAlign: 'left',
|
|
74
76
|
},
|
|
75
77
|
Cell: ({ value }) => {
|
|
@@ -81,6 +83,8 @@ const columns: Column<Entry>[] = [
|
|
|
81
83
|
Header: 'Last Name',
|
|
82
84
|
accessor: 'lastName',
|
|
83
85
|
cellStyle: {
|
|
86
|
+
width: 'unset',
|
|
87
|
+
flex: 2,
|
|
84
88
|
textAlign: 'left',
|
|
85
89
|
},
|
|
86
90
|
// disable the sorting on this column
|
|
@@ -90,7 +94,8 @@ const columns: Column<Entry>[] = [
|
|
|
90
94
|
Header: 'Age',
|
|
91
95
|
accessor: 'age',
|
|
92
96
|
cellStyle: {
|
|
93
|
-
width: '
|
|
97
|
+
width: 'unset',
|
|
98
|
+
flex: 1,
|
|
94
99
|
textAlign: 'left',
|
|
95
100
|
},
|
|
96
101
|
},
|
|
@@ -99,6 +104,8 @@ const columns: Column<Entry>[] = [
|
|
|
99
104
|
accessor: 'health',
|
|
100
105
|
sortType: 'health',
|
|
101
106
|
cellStyle: {
|
|
107
|
+
width: 'unset',
|
|
108
|
+
flex: 1,
|
|
102
109
|
textAlign: 'left',
|
|
103
110
|
},
|
|
104
111
|
},
|
|
@@ -119,26 +126,27 @@ export const SimpleContentTable = {
|
|
|
119
126
|
>
|
|
120
127
|
{location.search}
|
|
121
128
|
</span>
|
|
122
|
-
<Table
|
|
129
|
+
<Table
|
|
130
|
+
columns={columns}
|
|
131
|
+
data={data}
|
|
132
|
+
defaultSortingKey={'health'}
|
|
133
|
+
entityName={{
|
|
134
|
+
en: {
|
|
135
|
+
singular: 'user',
|
|
136
|
+
plural: 'users',
|
|
137
|
+
},
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
123
140
|
<div
|
|
124
141
|
style={{
|
|
125
142
|
margin: '16px 0',
|
|
126
143
|
}}
|
|
127
144
|
>
|
|
128
|
-
<Table.SearchWithQueryParams
|
|
129
|
-
displayedName={{
|
|
130
|
-
singular: 'person',
|
|
131
|
-
plural: 'persons',
|
|
132
|
-
}}
|
|
133
|
-
/>
|
|
145
|
+
<Table.SearchWithQueryParams />
|
|
134
146
|
</div>
|
|
135
147
|
<Table.SingleSelectableContent
|
|
136
148
|
rowHeight="h40"
|
|
137
149
|
separationLineVariant="backgroundLevel3"
|
|
138
|
-
backgroundVariant="backgroundLevel1"
|
|
139
|
-
children={(Rows) => {
|
|
140
|
-
return <>{Rows}</>;
|
|
141
|
-
}}
|
|
142
150
|
></Table.SingleSelectableContent>
|
|
143
151
|
</Table>
|
|
144
152
|
</>
|
|
@@ -158,7 +166,6 @@ export const SimpleContentTable = {
|
|
|
158
166
|
<Table.SingleSelectableContent
|
|
159
167
|
rowHeight="h32"
|
|
160
168
|
separationLineVariant="backgroundLevel3"
|
|
161
|
-
backgroundVariant="backgroundLevel1"
|
|
162
169
|
/>
|
|
163
170
|
</Table>
|
|
164
171
|
</div>
|
|
@@ -178,7 +185,6 @@ export const SimpleContentTable = {
|
|
|
178
185
|
<Table.SingleSelectableContent
|
|
179
186
|
rowHeight="h40"
|
|
180
187
|
separationLineVariant="backgroundLevel3"
|
|
181
|
-
backgroundVariant="backgroundLevel1"
|
|
182
188
|
selectedId={'Rodolph Yohann'}
|
|
183
189
|
onRowSelected={action('Table Row Clicked')}
|
|
184
190
|
/>
|
|
@@ -211,7 +217,6 @@ export const SimpleContentTable = {
|
|
|
211
217
|
<Table.SingleSelectableContent
|
|
212
218
|
rowHeight="h40"
|
|
213
219
|
separationLineVariant="backgroundLevel3"
|
|
214
|
-
backgroundVariant="backgroundLevel1"
|
|
215
220
|
onRowSelected={action('Table Row Clicked')}
|
|
216
221
|
/>
|
|
217
222
|
</Table>
|
|
@@ -233,7 +238,6 @@ export const SimpleContentTable = {
|
|
|
233
238
|
<Table.MultiSelectableContent
|
|
234
239
|
rowHeight="h40"
|
|
235
240
|
separationLineVariant="backgroundLevel3"
|
|
236
|
-
backgroundVariant="backgroundLevel1"
|
|
237
241
|
onMultiSelectionChanged={(rows) => {
|
|
238
242
|
console.log('Table.MultiSelectableContent selected row', rows);
|
|
239
243
|
}}
|
|
@@ -290,6 +294,8 @@ export const asyncTable = {
|
|
|
290
294
|
accessor: 'firstName',
|
|
291
295
|
cellStyle: {
|
|
292
296
|
textAlign: 'left',
|
|
297
|
+
width: 'unset',
|
|
298
|
+
flex: 1,
|
|
293
299
|
},
|
|
294
300
|
Cell: renderRowSubComponent,
|
|
295
301
|
},
|
|
@@ -298,14 +304,17 @@ export const asyncTable = {
|
|
|
298
304
|
accessor: 'lastName',
|
|
299
305
|
cellStyle: {
|
|
300
306
|
textAlign: 'left',
|
|
307
|
+
width: 'unset',
|
|
308
|
+
flex: 1,
|
|
301
309
|
},
|
|
302
310
|
},
|
|
303
311
|
{
|
|
304
312
|
Header: 'Age',
|
|
305
313
|
accessor: 'age',
|
|
306
314
|
cellStyle: {
|
|
307
|
-
width: '50px',
|
|
308
315
|
textAlign: 'left',
|
|
316
|
+
width: 'unset',
|
|
317
|
+
flex: 0.5,
|
|
309
318
|
},
|
|
310
319
|
},
|
|
311
320
|
{
|
|
@@ -314,6 +323,8 @@ export const asyncTable = {
|
|
|
314
323
|
sortType: 'health',
|
|
315
324
|
cellStyle: {
|
|
316
325
|
textAlign: 'left',
|
|
326
|
+
width: 'unset',
|
|
327
|
+
flex: 1,
|
|
317
328
|
},
|
|
318
329
|
},
|
|
319
330
|
];
|
|
@@ -333,13 +344,10 @@ export const asyncTable = {
|
|
|
333
344
|
data={data}
|
|
334
345
|
defaultSortingKey={'health'}
|
|
335
346
|
>
|
|
336
|
-
<Table.SearchWithQueryParams
|
|
337
|
-
displayedName={{ singular: 'user', plural: 'users' }}
|
|
338
|
-
></Table.SearchWithQueryParams>
|
|
347
|
+
<Table.SearchWithQueryParams></Table.SearchWithQueryParams>
|
|
339
348
|
<Table.SingleSelectableContent
|
|
340
349
|
rowHeight="h40"
|
|
341
350
|
separationLineVariant="backgroundLevel3"
|
|
342
|
-
backgroundVariant="backgroundLevel1"
|
|
343
351
|
selectedId={'Rodolph Yohann'}
|
|
344
352
|
onRowSelected={action('Table Row Clicked')}
|
|
345
353
|
/>
|
|
@@ -401,7 +409,6 @@ export const OnBottomCallback = {
|
|
|
401
409
|
<Table.SingleSelectableContent
|
|
402
410
|
rowHeight="h40"
|
|
403
411
|
separationLineVariant="backgroundLevel3"
|
|
404
|
-
backgroundVariant="backgroundLevel1"
|
|
405
412
|
/>
|
|
406
413
|
</Table>
|
|
407
414
|
</div>
|
|
@@ -554,14 +561,15 @@ export const EmptyTable = {
|
|
|
554
561
|
render: (args) => {
|
|
555
562
|
const { background } = args;
|
|
556
563
|
return (
|
|
557
|
-
<
|
|
558
|
-
<Table
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
564
|
+
<Box width="500px" height="200px">
|
|
565
|
+
<Table columns={columns} data={[]} defaultSortingKey={'firstName'}>
|
|
566
|
+
<Table.SingleSelectableContent
|
|
567
|
+
rowHeight="h40"
|
|
568
|
+
separationLineVariant={background}
|
|
569
|
+
onRowSelected={action('Table Row Clicked')}
|
|
570
|
+
/>
|
|
571
|
+
</Table>
|
|
572
|
+
</Box>
|
|
565
573
|
);
|
|
566
574
|
},
|
|
567
575
|
argTypes: {
|
|
@@ -595,7 +603,6 @@ export const LoadingTable = {
|
|
|
595
603
|
<Table.SingleSelectableContent
|
|
596
604
|
rowHeight="h40"
|
|
597
605
|
separationLineVariant="backgroundLevel3"
|
|
598
|
-
backgroundVariant="backgroundLevel1"
|
|
599
606
|
/>
|
|
600
607
|
</Table>
|
|
601
608
|
</Box>
|
|
@@ -621,7 +628,6 @@ export const ErrorTable = {
|
|
|
621
628
|
<Table.SingleSelectableContent
|
|
622
629
|
rowHeight="h40"
|
|
623
630
|
separationLineVariant="backgroundLevel4"
|
|
624
|
-
backgroundVariant="backgroundLevel1"
|
|
625
631
|
locale="en"
|
|
626
632
|
/>
|
|
627
633
|
</Table>
|