@superminimalui/table 0.0.2 → 0.0.4

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.
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -23,54 +24,37 @@ __export(index_exports, {
23
24
  });
24
25
  module.exports = __toCommonJS(index_exports);
25
26
 
26
- // src/Table/Table.tsx
27
- var import_core = require("@simple-ui/core");
28
-
29
- // src/Table/table.styles.ts
30
- var borderColorMap = {
31
- primary: "border-[var(--ui-primary)]",
32
- neutral: "border-white/20",
33
- danger: "border-red-500"
34
- };
35
- var borderWidthMap = {
36
- sm: "border",
37
- md: "border-2",
38
- lg: "border-4"
39
- };
40
- var borderVariantMap = {
41
- soft: "rounded-md",
42
- hard: "rounded-none"
43
- };
44
-
45
- // src/Table/Table.tsx
27
+ // src/Table.tsx
28
+ var import_core = require("@superminimalui/core");
46
29
  var import_jsx_runtime = require("react/jsx-runtime");
47
- function Table({
48
- columns,
30
+ var Table = ({
49
31
  rows,
32
+ columns,
50
33
  bordered = true,
51
- borderVariant = "soft",
52
- borderColor = "neutral",
53
- borderWidth = "sm",
34
+ borderColor = "black",
35
+ borderWidth = "1px",
54
36
  className
55
- }) {
37
+ }) => {
38
+ const borderStyle = bordered ? `${borderWidth} solid ${borderColor}` : "none";
56
39
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
57
- "div",
40
+ "table",
58
41
  {
59
- className: (0, import_core.cn)(
60
- "grid text-sm",
61
- bordered && borderWidthMap[borderWidth],
62
- bordered && borderColorMap[borderColor],
63
- bordered && borderVariantMap[borderVariant],
64
- className
65
- ),
66
- style: {
67
- gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
68
- },
69
- children: Array.from({ length: rows * columns }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "p-2", children: "Cell" }, i))
42
+ className: (0, import_core.cn)("table-auto", className),
43
+ style: { border: borderStyle },
44
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: Array.from({ length: rows }).map((_, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: Array.from({ length: columns }).map((_2, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
45
+ "td",
46
+ {
47
+ style: { border: borderStyle, padding: "0.5rem" },
48
+ children: [
49
+ "Cell ",
50
+ rowIdx + 1,
51
+ "-",
52
+ colIdx + 1
53
+ ]
54
+ },
55
+ colIdx
56
+ )) }, rowIdx)) })
70
57
  }
71
58
  );
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- Table
76
- });
59
+ };
60
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/Table.tsx"],"sourcesContent":["export { Table } from \"./Table\";\r\n","import React from \"react\";\r\nimport { cn } from \"@superminimalui/core\";\r\n\r\nexport interface TableProps {\r\n rows: number;\r\n columns: number;\r\n bordered?: boolean;\r\n borderColor?: string;\r\n borderWidth?: string;\r\n className?: string;\r\n}\r\n\r\nexport const Table: React.FC<TableProps> = ({\r\n rows,\r\n columns,\r\n bordered = true,\r\n borderColor = \"black\",\r\n borderWidth = \"1px\",\r\n className,\r\n}) => {\r\n const borderStyle = bordered ? `${borderWidth} solid ${borderColor}` : \"none\";\r\n return (\r\n <table\r\n className={cn(\"table-auto\", className)}\r\n style={{ border: borderStyle }}\r\n >\r\n <tbody>\r\n {Array.from({ length: rows }).map((_, rowIdx) => (\r\n <tr key={rowIdx}>\r\n {Array.from({ length: columns }).map((_, colIdx) => (\r\n <td\r\n key={colIdx}\r\n style={{ border: borderStyle, padding: \"0.5rem\" }}\r\n >\r\n Cell {rowIdx + 1}-{colIdx + 1}\r\n </td>\r\n ))}\r\n </tr>\r\n ))}\r\n </tbody>\r\n </table>\r\n );\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAAmB;AA2BT;AAhBH,IAAM,QAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd;AACF,MAAM;AACJ,QAAM,cAAc,WAAW,GAAG,WAAW,UAAU,WAAW,KAAK;AACvE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,gBAAG,cAAc,SAAS;AAAA,MACrC,OAAO,EAAE,QAAQ,YAAY;AAAA,MAE7B,sDAAC,WACE,gBAAM,KAAK,EAAE,QAAQ,KAAK,CAAC,EAAE,IAAI,CAAC,GAAG,WACpC,4CAAC,QACE,gBAAM,KAAK,EAAE,QAAQ,QAAQ,CAAC,EAAE,IAAI,CAACA,IAAG,WACvC;AAAA,QAAC;AAAA;AAAA,UAEC,OAAO,EAAE,QAAQ,aAAa,SAAS,SAAS;AAAA,UACjD;AAAA;AAAA,YACO,SAAS;AAAA,YAAE;AAAA,YAAE,SAAS;AAAA;AAAA;AAAA,QAHvB;AAAA,MAIP,CACD,KARM,MAST,CACD,GACH;AAAA;AAAA,EACF;AAEJ;","names":["_"]}
package/dist/index.d.mts CHANGED
@@ -1,18 +1,13 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import React from 'react';
2
2
 
3
- type TableBorderVariant = "soft" | "hard";
4
- type TableBorderColor = "primary" | "neutral" | "danger";
5
- type TableBorderWidth = "sm" | "md" | "lg";
6
3
  interface TableProps {
7
- columns: number;
8
4
  rows: number;
5
+ columns: number;
9
6
  bordered?: boolean;
10
- borderVariant?: TableBorderVariant;
11
- borderColor?: TableBorderColor;
12
- borderWidth?: TableBorderWidth;
7
+ borderColor?: string;
8
+ borderWidth?: string;
13
9
  className?: string;
14
10
  }
11
+ declare const Table: React.FC<TableProps>;
15
12
 
16
- declare function Table({ columns, rows, bordered, borderVariant, borderColor, borderWidth, className, }: TableProps): react_jsx_runtime.JSX.Element;
17
-
18
- export { Table, type TableProps };
13
+ export { Table };
package/dist/index.d.ts CHANGED
@@ -1,18 +1,13 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import React from 'react';
2
2
 
3
- type TableBorderVariant = "soft" | "hard";
4
- type TableBorderColor = "primary" | "neutral" | "danger";
5
- type TableBorderWidth = "sm" | "md" | "lg";
6
3
  interface TableProps {
7
- columns: number;
8
4
  rows: number;
5
+ columns: number;
9
6
  bordered?: boolean;
10
- borderVariant?: TableBorderVariant;
11
- borderColor?: TableBorderColor;
12
- borderWidth?: TableBorderWidth;
7
+ borderColor?: string;
8
+ borderWidth?: string;
13
9
  className?: string;
14
10
  }
11
+ declare const Table: React.FC<TableProps>;
15
12
 
16
- declare function Table({ columns, rows, bordered, borderVariant, borderColor, borderWidth, className, }: TableProps): react_jsx_runtime.JSX.Element;
17
-
18
- export { Table, type TableProps };
13
+ export { Table };
@@ -0,0 +1,37 @@
1
+ // src/Table.tsx
2
+ import { cn } from "@superminimalui/core";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var Table = ({
5
+ rows,
6
+ columns,
7
+ bordered = true,
8
+ borderColor = "black",
9
+ borderWidth = "1px",
10
+ className
11
+ }) => {
12
+ const borderStyle = bordered ? `${borderWidth} solid ${borderColor}` : "none";
13
+ return /* @__PURE__ */ jsx(
14
+ "table",
15
+ {
16
+ className: cn("table-auto", className),
17
+ style: { border: borderStyle },
18
+ children: /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: rows }).map((_, rowIdx) => /* @__PURE__ */ jsx("tr", { children: Array.from({ length: columns }).map((_2, colIdx) => /* @__PURE__ */ jsxs(
19
+ "td",
20
+ {
21
+ style: { border: borderStyle, padding: "0.5rem" },
22
+ children: [
23
+ "Cell ",
24
+ rowIdx + 1,
25
+ "-",
26
+ colIdx + 1
27
+ ]
28
+ },
29
+ colIdx
30
+ )) }, rowIdx)) })
31
+ }
32
+ );
33
+ };
34
+ export {
35
+ Table
36
+ };
37
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Table.tsx"],"sourcesContent":["import React from \"react\";\r\nimport { cn } from \"@superminimalui/core\";\r\n\r\nexport interface TableProps {\r\n rows: number;\r\n columns: number;\r\n bordered?: boolean;\r\n borderColor?: string;\r\n borderWidth?: string;\r\n className?: string;\r\n}\r\n\r\nexport const Table: React.FC<TableProps> = ({\r\n rows,\r\n columns,\r\n bordered = true,\r\n borderColor = \"black\",\r\n borderWidth = \"1px\",\r\n className,\r\n}) => {\r\n const borderStyle = bordered ? `${borderWidth} solid ${borderColor}` : \"none\";\r\n return (\r\n <table\r\n className={cn(\"table-auto\", className)}\r\n style={{ border: borderStyle }}\r\n >\r\n <tbody>\r\n {Array.from({ length: rows }).map((_, rowIdx) => (\r\n <tr key={rowIdx}>\r\n {Array.from({ length: columns }).map((_, colIdx) => (\r\n <td\r\n key={colIdx}\r\n style={{ border: borderStyle, padding: \"0.5rem\" }}\r\n >\r\n Cell {rowIdx + 1}-{colIdx + 1}\r\n </td>\r\n ))}\r\n </tr>\r\n ))}\r\n </tbody>\r\n </table>\r\n );\r\n};\r\n"],"mappings":";AACA,SAAS,UAAU;AA2BT,cAEI,YAFJ;AAhBH,IAAM,QAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd;AACF,MAAM;AACJ,QAAM,cAAc,WAAW,GAAG,WAAW,UAAU,WAAW,KAAK;AACvE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,cAAc,SAAS;AAAA,MACrC,OAAO,EAAE,QAAQ,YAAY;AAAA,MAE7B,8BAAC,WACE,gBAAM,KAAK,EAAE,QAAQ,KAAK,CAAC,EAAE,IAAI,CAAC,GAAG,WACpC,oBAAC,QACE,gBAAM,KAAK,EAAE,QAAQ,QAAQ,CAAC,EAAE,IAAI,CAACA,IAAG,WACvC;AAAA,QAAC;AAAA;AAAA,UAEC,OAAO,EAAE,QAAQ,aAAa,SAAS,SAAS;AAAA,UACjD;AAAA;AAAA,YACO,SAAS;AAAA,YAAE;AAAA,YAAE,SAAS;AAAA;AAAA;AAAA,QAHvB;AAAA,MAIP,CACD,KARM,MAST,CACD,GACH;AAAA;AAAA,EACF;AAEJ;","names":["_"]}
package/package.json CHANGED
@@ -1,24 +1,22 @@
1
1
  {
2
2
  "name": "@superminimalui/table",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "dist"
9
9
  ],
10
- "sideEffects": false,
11
10
  "scripts": {
12
11
  "build": "tsup"
13
12
  },
14
- "dependencies": {
15
- "@superminimalui/core": "^0.0.1"
16
- },
17
13
  "peerDependencies": {
18
- "react": ">=18"
14
+ "react": ">=18",
15
+ "@superminimalui/core": "^0.0.1"
19
16
  },
20
17
  "devDependencies": {
21
18
  "tsup": "^8.5.1",
22
- "typescript": "^5.9.3"
19
+ "typescript": "^5.9.3",
20
+ "@types/react": "^19.2.7"
23
21
  }
24
22
  }
package/dist/index.mjs DELETED
@@ -1,50 +0,0 @@
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
- };