@taiv/ui 1.6.1 → 1.7.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/Inputs/Buttons/Button/Button.js +1 -1
- package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/Button/Button.stories.js +0 -9
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/constants/colors.d.ts +0 -2
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +0 -2
- package/package.json +2 -2
- package/dist/components/Layout/Table/Table.d.ts +0 -15
- package/dist/components/Layout/Table/Table.d.ts.map +0 -1
- package/dist/components/Layout/Table/Table.js +0 -48
- package/dist/components/Layout/Table/Table.stories.d.ts +0 -10
- package/dist/components/Layout/Table/Table.stories.d.ts.map +0 -1
- package/dist/components/Layout/Table/Table.stories.js +0 -257
|
@@ -25,7 +25,7 @@ export const Button = ({ onClick, size = 'md', variant = 'primary', fullWidth =
|
|
|
25
25
|
padding: selectedSize.padding,
|
|
26
26
|
minWidth: `${selectedSize.minWidth}rem`,
|
|
27
27
|
fontSize: selectedSize.fontSize,
|
|
28
|
-
boxShadow: shadow ? '0px
|
|
28
|
+
boxShadow: shadow ? '0px 1px 3px 0px rgba(0, 0, 0, 0.1)' : 'none',
|
|
29
29
|
...getVariantStyles(),
|
|
30
30
|
},
|
|
31
31
|
label: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CA2F7B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAsE1B,CAAC"}
|
|
@@ -90,14 +90,6 @@ const meta = {
|
|
|
90
90
|
type: { summary: '() => void' },
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
|
-
shadow: {
|
|
94
|
-
control: { type: 'boolean' },
|
|
95
|
-
description: 'Adds shadow to the button',
|
|
96
|
-
table: {
|
|
97
|
-
type: { summary: 'boolean' },
|
|
98
|
-
defaultValue: { summary: 'false' },
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
93
|
},
|
|
102
94
|
};
|
|
103
95
|
export default meta;
|
|
@@ -109,7 +101,6 @@ export const Default = {
|
|
|
109
101
|
disabled: false,
|
|
110
102
|
loading: false,
|
|
111
103
|
fullWidth: false,
|
|
112
|
-
shadow: false,
|
|
113
104
|
leftIcon: undefined,
|
|
114
105
|
rightIcon: undefined,
|
|
115
106
|
styles: {},
|
|
@@ -43,8 +43,6 @@ export { Loader } from './Layout/Loader/Loader';
|
|
|
43
43
|
export { Stack } from './Layout/Stack/Stack';
|
|
44
44
|
export { Card } from './Layout/Card/Card';
|
|
45
45
|
export { SectionCard } from './Layout/SectionCard/SectionCard';
|
|
46
|
-
export { Table } from './Layout/Table/Table';
|
|
47
|
-
export type { ColumnConfig } from './Layout/Table/Table';
|
|
48
46
|
export { Tabs } from './Layout/Tabs/Tabs';
|
|
49
47
|
export { CollapsibleText } from './Typography/CollapsibleText/CollapsibleText';
|
|
50
48
|
export { Text } from './Typography/Text/Text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAC;AACtG,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAC7E,OAAO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E,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -47,7 +47,6 @@ export { Loader } from './Layout/Loader/Loader';
|
|
|
47
47
|
export { Stack } from './Layout/Stack/Stack';
|
|
48
48
|
export { Card } from './Layout/Card/Card';
|
|
49
49
|
export { SectionCard } from './Layout/SectionCard/SectionCard';
|
|
50
|
-
export { Table } from './Layout/Table/Table';
|
|
51
50
|
export { Tabs } from './Layout/Tabs/Tabs';
|
|
52
51
|
//Typography
|
|
53
52
|
export { CollapsibleText } from './Typography/CollapsibleText/CollapsibleText';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const white = "#FFFFFF";
|
|
2
1
|
export declare const gray: {
|
|
3
2
|
readonly 25: "#F8FAFC";
|
|
4
3
|
readonly 50: "#EDEDED";
|
|
@@ -80,7 +79,6 @@ export declare const salmon: {
|
|
|
80
79
|
readonly 200: "#FF806F";
|
|
81
80
|
};
|
|
82
81
|
export declare const colors: {
|
|
83
|
-
readonly white: "#FFFFFF";
|
|
84
82
|
readonly neutral: {
|
|
85
83
|
readonly 25: "#F8FAFC";
|
|
86
84
|
readonly 50: "#EDEDED";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/constants/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/constants/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;CAMP,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAO,CAAC;AAE5B,eAAO,MAAM,IAAI;;;;;;CAMP,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAO,CAAC;AAE5B,eAAO,MAAM,KAAK;;;;;;CAMR,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAQ,CAAC;AAE7B,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAS,CAAC;AAE9B,eAAO,MAAM,GAAG;;;;;;CAMN,CAAC;AACX,eAAO,MAAM,KAAK;;;;;;CAAM,CAAC;AAGzB,eAAO,MAAM,MAAM;;;;CAIT,CAAC;AAEX,eAAO,MAAM,MAAM;;;;CAIT,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMT,CAAC;AAGX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQb,CAAC"}
|
package/dist/constants/colors.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export const white = '#FFFFFF';
|
|
2
1
|
export const gray = {
|
|
3
2
|
25: '#F8FAFC',
|
|
4
3
|
50: '#EDEDED',
|
|
@@ -52,7 +51,6 @@ export const salmon = {
|
|
|
52
51
|
};
|
|
53
52
|
// Primary semantic/functional color exports - for use in UI, actions, states, etc. anything that would be affected by theme changes down the line
|
|
54
53
|
export const colors = {
|
|
55
|
-
white,
|
|
56
54
|
neutral,
|
|
57
55
|
primary,
|
|
58
56
|
success,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiv/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"author": "Taiv",
|
|
5
5
|
"description": "Taiv's web UI Toolkit built on Mantine v6",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsc",
|
|
13
|
-
"dev": "tsc --watch",
|
|
13
|
+
"dev": "npm link && tsc --watch",
|
|
14
14
|
"clean": "rm -rf dist",
|
|
15
15
|
"storybook": "storybook dev -p 6006",
|
|
16
16
|
"build-storybook": "storybook build",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
interface ColumnConfig {
|
|
3
|
-
heading?: string;
|
|
4
|
-
style?: CSSProperties;
|
|
5
|
-
}
|
|
6
|
-
interface TableProps<T> {
|
|
7
|
-
columnConfigs: ColumnConfig[];
|
|
8
|
-
data: T[];
|
|
9
|
-
ListItem: React.ComponentType<{
|
|
10
|
-
data: T;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
declare const Table: <T>({ columnConfigs, data, ListItem }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export { Table, type ColumnConfig, type TableProps };
|
|
15
|
-
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAC;AAIhE,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,UAAU,CAAC,CAAC;IACpB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;CAC5C;AAED,QAAA,MAAM,KAAK,GAAI,CAAC,EAAG,mCAAmC,UAAU,CAAC,CAAC,CAAC,4CAsElE,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
3
|
-
import { Box } from '../Box/Box';
|
|
4
|
-
import { fontWeight, neutral } from '../../../constants';
|
|
5
|
-
const Table = ({ columnConfigs, data, ListItem }) => {
|
|
6
|
-
const tableRef = useRef(null);
|
|
7
|
-
/**
|
|
8
|
-
* Apply column styles to the table cells.
|
|
9
|
-
*/
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const table = tableRef.current;
|
|
12
|
-
if (!table)
|
|
13
|
-
return;
|
|
14
|
-
const tbody = table.querySelector('tbody');
|
|
15
|
-
if (!tbody)
|
|
16
|
-
return;
|
|
17
|
-
const rows = tbody.querySelectorAll('tr');
|
|
18
|
-
if (!rows || !rows.length)
|
|
19
|
-
return;
|
|
20
|
-
rows.forEach((row) => {
|
|
21
|
-
const cells = row.querySelectorAll('td');
|
|
22
|
-
cells.forEach((cell, columnIndex) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const columnStyle = (_a = columnConfigs[columnIndex]) === null || _a === void 0 ? void 0 : _a.style;
|
|
25
|
-
if (columnStyle) {
|
|
26
|
-
Object.assign(cell.style, columnStyle);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}, [columnConfigs, data]);
|
|
31
|
-
return (_jsx(Box, { sx: {
|
|
32
|
-
borderTopLeftRadius: '8px',
|
|
33
|
-
borderTopRightRadius: '8px',
|
|
34
|
-
boxShadow: '0px 2px 6px -3px #AFAFAF',
|
|
35
|
-
overflow: 'hidden',
|
|
36
|
-
}, children: _jsxs("table", { ref: tableRef, style: {
|
|
37
|
-
width: '100%',
|
|
38
|
-
}, children: [_jsx("thead", { children: _jsx("tr", { children: columnConfigs.map((column, index) => (_jsx("th", { style: {
|
|
39
|
-
backgroundColor: neutral[50],
|
|
40
|
-
color: neutral[300],
|
|
41
|
-
fontSize: '14px',
|
|
42
|
-
fontWeight: fontWeight.bold,
|
|
43
|
-
paddingBottom: '9px',
|
|
44
|
-
paddingTop: '9px',
|
|
45
|
-
...column.style,
|
|
46
|
-
}, children: column.heading }, column.heading || `column-${index}`))) }) }), _jsx("tbody", { children: data.map((item) => (_jsx(ListItem, { data: item }, String(item).slice(0, 10)))) })] }) }));
|
|
47
|
-
};
|
|
48
|
-
export { Table };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { Table } from './Table';
|
|
3
|
-
declare const meta: Meta<typeof Table>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const BasicTable: Story;
|
|
7
|
-
export declare const TableWithCustomComponents: Story;
|
|
8
|
-
export declare const TableWithProgressBars: Story;
|
|
9
|
-
export declare const StyledColumns: Story;
|
|
10
|
-
//# sourceMappingURL=Table.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Table/Table.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAiB5B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAyPnC,eAAO,MAAM,UAAU,EAAE,KAmBxB,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KAqBvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAoBnC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAmB3B,CAAC"}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Table } from './Table';
|
|
3
|
-
import { Badge } from '../../Info/Badge/Badge';
|
|
4
|
-
import { Button } from '../../Inputs/Buttons/Button/Button';
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'Layouts/Table',
|
|
7
|
-
component: Table,
|
|
8
|
-
argTypes: {
|
|
9
|
-
columnConfigs: {
|
|
10
|
-
control: { type: 'object' },
|
|
11
|
-
description: 'Array of column configurations with headings and styles',
|
|
12
|
-
},
|
|
13
|
-
data: {
|
|
14
|
-
control: { type: 'object' },
|
|
15
|
-
description: 'Array of data items to display',
|
|
16
|
-
},
|
|
17
|
-
ListItem: {
|
|
18
|
-
control: false,
|
|
19
|
-
description: 'Component that renders each table row',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
export default meta;
|
|
24
|
-
// Mock data
|
|
25
|
-
const userData = [
|
|
26
|
-
{
|
|
27
|
-
id: '1',
|
|
28
|
-
name: 'John Doe',
|
|
29
|
-
email: 'john.doe@example.com',
|
|
30
|
-
role: 'Administrator',
|
|
31
|
-
status: 'active',
|
|
32
|
-
lastLogin: '2024-01-15',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: '2',
|
|
36
|
-
name: 'Jane Smith',
|
|
37
|
-
email: 'jane.smith@example.com',
|
|
38
|
-
role: 'Editor',
|
|
39
|
-
status: 'active',
|
|
40
|
-
lastLogin: '2024-01-14',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: '3',
|
|
44
|
-
name: 'Bob Johnson',
|
|
45
|
-
email: 'bob.johnson@example.com',
|
|
46
|
-
role: 'Viewer',
|
|
47
|
-
status: 'inactive',
|
|
48
|
-
lastLogin: '2024-01-10',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: '4',
|
|
52
|
-
name: 'Alice Williams',
|
|
53
|
-
email: 'alice.williams@example.com',
|
|
54
|
-
role: 'Editor',
|
|
55
|
-
status: 'active',
|
|
56
|
-
lastLogin: '2024-01-15',
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
const productData = [
|
|
60
|
-
{
|
|
61
|
-
id: '1',
|
|
62
|
-
name: 'Premium Widget',
|
|
63
|
-
category: 'Electronics',
|
|
64
|
-
price: 99.99,
|
|
65
|
-
stock: 150,
|
|
66
|
-
status: 'in-stock',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: '2',
|
|
70
|
-
name: 'Standard Widget',
|
|
71
|
-
category: 'Electronics',
|
|
72
|
-
price: 49.99,
|
|
73
|
-
stock: 3,
|
|
74
|
-
status: 'low-stock',
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: '3',
|
|
78
|
-
name: 'Basic Widget',
|
|
79
|
-
category: 'Accessories',
|
|
80
|
-
price: 19.99,
|
|
81
|
-
stock: 0,
|
|
82
|
-
status: 'out-of-stock',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
id: '4',
|
|
86
|
-
name: 'Deluxe Widget',
|
|
87
|
-
category: 'Electronics',
|
|
88
|
-
price: 149.99,
|
|
89
|
-
stock: 45,
|
|
90
|
-
status: 'in-stock',
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
const projectData = [
|
|
94
|
-
{
|
|
95
|
-
id: '1',
|
|
96
|
-
title: 'Website Redesign',
|
|
97
|
-
team: ['Alice', 'Bob', 'Charlie'],
|
|
98
|
-
progress: 75,
|
|
99
|
-
deadline: '2024-02-15',
|
|
100
|
-
priority: 'high',
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: '2',
|
|
104
|
-
title: 'Mobile App Update',
|
|
105
|
-
team: ['David', 'Eve'],
|
|
106
|
-
progress: 45,
|
|
107
|
-
deadline: '2024-03-01',
|
|
108
|
-
priority: 'medium',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: '3',
|
|
112
|
-
title: 'API Documentation',
|
|
113
|
-
team: ['Frank', 'Grace'],
|
|
114
|
-
progress: 90,
|
|
115
|
-
deadline: '2024-01-20',
|
|
116
|
-
priority: 'low',
|
|
117
|
-
},
|
|
118
|
-
];
|
|
119
|
-
// ListItem Components
|
|
120
|
-
const UserListItem = ({ data }) => {
|
|
121
|
-
return (_jsxs("tr", { children: [_jsx("td", { children: data.name }), _jsx("td", { children: data.email }), _jsx("td", { children: data.role }), _jsx("td", { children: _jsx(Badge, { color: data.status === 'active' ? 'success' : 'neutral', variant: "filled", size: "sm", children: data.status === 'active' ? 'Active' : 'Inactive' }) }), _jsx("td", { children: data.lastLogin })] }));
|
|
122
|
-
};
|
|
123
|
-
const ProductListItem = ({ data }) => {
|
|
124
|
-
const getStatusColor = (status) => {
|
|
125
|
-
switch (status) {
|
|
126
|
-
case 'in-stock':
|
|
127
|
-
return 'success';
|
|
128
|
-
case 'low-stock':
|
|
129
|
-
return 'warning';
|
|
130
|
-
case 'out-of-stock':
|
|
131
|
-
return 'error';
|
|
132
|
-
default:
|
|
133
|
-
return 'neutral';
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const getStatusLabel = (status) => {
|
|
137
|
-
switch (status) {
|
|
138
|
-
case 'in-stock':
|
|
139
|
-
return 'In Stock';
|
|
140
|
-
case 'low-stock':
|
|
141
|
-
return 'Low Stock';
|
|
142
|
-
case 'out-of-stock':
|
|
143
|
-
return 'Out of Stock';
|
|
144
|
-
default:
|
|
145
|
-
return status;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
return (_jsxs("tr", { children: [_jsx("td", { children: data.name }), _jsx("td", { children: data.category }), _jsxs("td", { children: ["$", data.price.toFixed(2)] }), _jsx("td", { children: data.stock }), _jsx("td", { children: _jsx(Badge, { color: getStatusColor(data.status), variant: "filled", size: "sm", children: getStatusLabel(data.status) }) }), _jsx("td", { children: _jsxs("div", { style: { display: 'flex', gap: '8px' }, children: [_jsx(Button, { size: "sm", variant: "primary", children: "Edit" }), _jsx(Button, { size: "sm", variant: "secondary", children: "View" })] }) })] }));
|
|
149
|
-
};
|
|
150
|
-
const ProjectListItem = ({ data }) => {
|
|
151
|
-
const getPriorityColor = (priority) => {
|
|
152
|
-
switch (priority) {
|
|
153
|
-
case 'high':
|
|
154
|
-
return 'error';
|
|
155
|
-
case 'medium':
|
|
156
|
-
return 'warning';
|
|
157
|
-
case 'low':
|
|
158
|
-
return 'success';
|
|
159
|
-
default:
|
|
160
|
-
return 'neutral';
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
return (_jsxs("tr", { children: [_jsx("td", { children: data.title }), _jsx("td", { children: data.team.join(', ') }), _jsx("td", { children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' }, children: [_jsx("div", { style: {
|
|
164
|
-
flex: 1,
|
|
165
|
-
height: '8px',
|
|
166
|
-
backgroundColor: '#e0e0e0',
|
|
167
|
-
borderRadius: '4px',
|
|
168
|
-
overflow: 'hidden',
|
|
169
|
-
}, children: _jsx("div", { style: {
|
|
170
|
-
width: `${data.progress}%`,
|
|
171
|
-
height: '100%',
|
|
172
|
-
backgroundColor: data.progress >= 75 ? '#4caf50' : data.progress >= 50 ? '#ff9800' : '#f44336',
|
|
173
|
-
transition: 'width 0.3s ease',
|
|
174
|
-
} }) }), _jsxs("span", { style: { fontSize: '12px', minWidth: '35px' }, children: [data.progress, "%"] })] }) }), _jsx("td", { children: data.deadline }), _jsx("td", { children: _jsx(Badge, { color: getPriorityColor(data.priority), variant: "outline", size: "sm", children: data.priority.charAt(0).toUpperCase() + data.priority.slice(1) }) })] }));
|
|
175
|
-
};
|
|
176
|
-
// Stories
|
|
177
|
-
export const BasicTable = {
|
|
178
|
-
args: {
|
|
179
|
-
columnConfigs: [
|
|
180
|
-
{ heading: 'Name', style: { width: '25%' } },
|
|
181
|
-
{ heading: 'Email', style: { width: '30%' } },
|
|
182
|
-
{ heading: 'Role', style: { width: '20%' } },
|
|
183
|
-
{ heading: 'Status', style: { width: '15%' } },
|
|
184
|
-
{ heading: 'Last Login', style: { width: '10%' } },
|
|
185
|
-
],
|
|
186
|
-
data: userData,
|
|
187
|
-
ListItem: UserListItem,
|
|
188
|
-
},
|
|
189
|
-
parameters: {
|
|
190
|
-
docs: {
|
|
191
|
-
description: {
|
|
192
|
-
story: 'A basic table displaying user information with text fields and status badges.',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
};
|
|
197
|
-
export const TableWithCustomComponents = {
|
|
198
|
-
args: {
|
|
199
|
-
columnConfigs: [
|
|
200
|
-
{ heading: 'Product Name', style: { width: '20%' } },
|
|
201
|
-
{ heading: 'Category', style: { width: '15%' } },
|
|
202
|
-
{ heading: 'Price', style: { width: '15%' } },
|
|
203
|
-
{ heading: 'Stock', style: { width: '10%', textAlign: 'center' } },
|
|
204
|
-
{ heading: 'Status', style: { width: '15%' } },
|
|
205
|
-
{ heading: 'Actions', style: { width: '25%', textAlign: 'center' } },
|
|
206
|
-
],
|
|
207
|
-
data: productData,
|
|
208
|
-
ListItem: ProductListItem,
|
|
209
|
-
},
|
|
210
|
-
parameters: {
|
|
211
|
-
docs: {
|
|
212
|
-
description: {
|
|
213
|
-
story: 'A table showcasing custom components including badges for status and action buttons. This demonstrates the versatility of the Table component.',
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
export const TableWithProgressBars = {
|
|
219
|
-
args: {
|
|
220
|
-
columnConfigs: [
|
|
221
|
-
{ heading: 'Project Title', style: { width: '25%' } },
|
|
222
|
-
{ heading: 'Team Members', style: { width: '25%' } },
|
|
223
|
-
{ heading: 'Progress', style: { width: '20%' } },
|
|
224
|
-
{ heading: 'Deadline', style: { width: '15%' } },
|
|
225
|
-
{ heading: 'Priority', style: { width: '15%' } },
|
|
226
|
-
],
|
|
227
|
-
data: projectData,
|
|
228
|
-
ListItem: ProjectListItem,
|
|
229
|
-
},
|
|
230
|
-
parameters: {
|
|
231
|
-
docs: {
|
|
232
|
-
description: {
|
|
233
|
-
story: 'A table with custom progress bars and priority badges, showing how complex UI elements can be integrated into table cells.',
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
};
|
|
238
|
-
export const StyledColumns = {
|
|
239
|
-
args: {
|
|
240
|
-
columnConfigs: [
|
|
241
|
-
{ heading: 'Name', style: { width: '25%', paddingLeft: '20px', fontWeight: '600' } },
|
|
242
|
-
{ heading: 'Email', style: { width: '30%', textAlign: 'left' } },
|
|
243
|
-
{ heading: 'Role', style: { width: '20%', textAlign: 'center' } },
|
|
244
|
-
{ heading: 'Status', style: { width: '15%', textAlign: 'center' } },
|
|
245
|
-
{ heading: 'Last Login', style: { width: '10%', textAlign: 'right', paddingRight: '20px' } },
|
|
246
|
-
],
|
|
247
|
-
data: userData,
|
|
248
|
-
ListItem: UserListItem,
|
|
249
|
-
},
|
|
250
|
-
parameters: {
|
|
251
|
-
docs: {
|
|
252
|
-
description: {
|
|
253
|
-
story: 'A table with custom column styling including padding, text alignment, and font weights.',
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
};
|