@superminimalui/table 0.0.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/dist/index.d.mts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +77 -0
- package/dist/index.mjs +50 -0
- package/package.json +24 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type TableBorderVariant = "soft" | "hard";
|
|
4
|
+
type TableBorderColor = "primary" | "neutral" | "danger";
|
|
5
|
+
type TableBorderWidth = "sm" | "md" | "lg";
|
|
6
|
+
interface TableProps {
|
|
7
|
+
columns: number;
|
|
8
|
+
rows: number;
|
|
9
|
+
bordered?: boolean;
|
|
10
|
+
borderVariant?: TableBorderVariant;
|
|
11
|
+
borderColor?: TableBorderColor;
|
|
12
|
+
borderWidth?: TableBorderWidth;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare function Table({ columns, rows, bordered, borderVariant, borderColor, borderWidth, className, }: TableProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { Table, type TableProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type TableBorderVariant = "soft" | "hard";
|
|
4
|
+
type TableBorderColor = "primary" | "neutral" | "danger";
|
|
5
|
+
type TableBorderWidth = "sm" | "md" | "lg";
|
|
6
|
+
interface TableProps {
|
|
7
|
+
columns: number;
|
|
8
|
+
rows: number;
|
|
9
|
+
bordered?: boolean;
|
|
10
|
+
borderVariant?: TableBorderVariant;
|
|
11
|
+
borderColor?: TableBorderColor;
|
|
12
|
+
borderWidth?: TableBorderWidth;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare function Table({ columns, rows, bordered, borderVariant, borderColor, borderWidth, className, }: TableProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { Table, type TableProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Table: () => Table
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/Table/Table.tsx
|
|
28
|
+
var import_core = require("@simple-ui/core");
|
|
29
|
+
|
|
30
|
+
// src/Table/table.styles.ts
|
|
31
|
+
var borderColorMap = {
|
|
32
|
+
primary: "border-[var(--ui-primary)]",
|
|
33
|
+
neutral: "border-white/20",
|
|
34
|
+
danger: "border-red-500"
|
|
35
|
+
};
|
|
36
|
+
var borderWidthMap = {
|
|
37
|
+
sm: "border",
|
|
38
|
+
md: "border-2",
|
|
39
|
+
lg: "border-4"
|
|
40
|
+
};
|
|
41
|
+
var borderVariantMap = {
|
|
42
|
+
soft: "rounded-md",
|
|
43
|
+
hard: "rounded-none"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/Table/Table.tsx
|
|
47
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
48
|
+
function Table({
|
|
49
|
+
columns,
|
|
50
|
+
rows,
|
|
51
|
+
bordered = true,
|
|
52
|
+
borderVariant = "soft",
|
|
53
|
+
borderColor = "neutral",
|
|
54
|
+
borderWidth = "sm",
|
|
55
|
+
className
|
|
56
|
+
}) {
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: (0, import_core.cn)(
|
|
61
|
+
"grid text-sm",
|
|
62
|
+
bordered && borderWidthMap[borderWidth],
|
|
63
|
+
bordered && borderColorMap[borderColor],
|
|
64
|
+
bordered && borderVariantMap[borderVariant],
|
|
65
|
+
className
|
|
66
|
+
),
|
|
67
|
+
style: {
|
|
68
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
69
|
+
},
|
|
70
|
+
children: Array.from({ length: rows * columns }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-2", children: "Cell" }, i))
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
Table
|
|
77
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/Table/Table.tsx
|
|
2
|
+
import { cn } from "@simple-ui/core";
|
|
3
|
+
|
|
4
|
+
// src/Table/table.styles.ts
|
|
5
|
+
var borderColorMap = {
|
|
6
|
+
primary: "border-[var(--ui-primary)]",
|
|
7
|
+
neutral: "border-white/20",
|
|
8
|
+
danger: "border-red-500"
|
|
9
|
+
};
|
|
10
|
+
var borderWidthMap = {
|
|
11
|
+
sm: "border",
|
|
12
|
+
md: "border-2",
|
|
13
|
+
lg: "border-4"
|
|
14
|
+
};
|
|
15
|
+
var borderVariantMap = {
|
|
16
|
+
soft: "rounded-md",
|
|
17
|
+
hard: "rounded-none"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// src/Table/Table.tsx
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
function Table({
|
|
23
|
+
columns,
|
|
24
|
+
rows,
|
|
25
|
+
bordered = true,
|
|
26
|
+
borderVariant = "soft",
|
|
27
|
+
borderColor = "neutral",
|
|
28
|
+
borderWidth = "sm",
|
|
29
|
+
className
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: cn(
|
|
35
|
+
"grid text-sm",
|
|
36
|
+
bordered && borderWidthMap[borderWidth],
|
|
37
|
+
bordered && borderColorMap[borderColor],
|
|
38
|
+
bordered && borderVariantMap[borderVariant],
|
|
39
|
+
className
|
|
40
|
+
),
|
|
41
|
+
style: {
|
|
42
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
|
|
43
|
+
},
|
|
44
|
+
children: Array.from({ length: rows * columns }).map((_, i) => /* @__PURE__ */ jsx("div", { className: "p-2", children: "Cell" }, i))
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
Table
|
|
50
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@superminimalui/table",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.cjs.js",
|
|
5
|
+
"module": "dist/index.esm.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsup"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@superminimalui/core": "workspace:*"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tsup": "^8.5.1",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
}
|
|
24
|
+
}
|