@san-siva/blogkit 1.1.40 → 1.1.41
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/cjs/staticComponents/TableStatic.js +16 -1
- package/dist/cjs/staticComponents/TableStatic.js.map +1 -1
- package/dist/esm/staticComponents/TableStatic.js +16 -1
- package/dist/esm/staticComponents/TableStatic.js.map +1 -1
- package/dist/types/staticComponents/TableStatic.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/staticComponents/TableStatic.tsx +17 -3
|
@@ -5,9 +5,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var Table_module = require('../styles/Table.module.scss.js');
|
|
7
7
|
|
|
8
|
+
const isEmptyNode = (node) => {
|
|
9
|
+
if (node == null || typeof node === 'boolean') {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (typeof node === 'string') {
|
|
13
|
+
return node.trim() === '';
|
|
14
|
+
}
|
|
15
|
+
if (typeof node === 'number') {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(node)) {
|
|
19
|
+
return node.every(isEmptyNode);
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
8
23
|
const Table = ({ rows = [], headers = [], hasMarginUp = false, hasMarginDown = false, fontSize, }) => {
|
|
9
24
|
const columnCount = headers.length;
|
|
10
|
-
const hasHeaders = headers.some(header => !(
|
|
25
|
+
const hasHeaders = headers.some(header => !isEmptyNode(header));
|
|
11
26
|
return (jsxRuntime.jsxs("div", { className: `${Table_module.default.table}
|
|
12
27
|
${hasMarginUp ? Table_module.default['margin-top--1'] : ''}
|
|
13
28
|
${hasMarginDown ? Table_module.default['margin-bottom--2'] : ''}`, style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableStatic.js","sources":["../../../src/staticComponents/TableStatic.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport styles from '../styles/Table.module.scss';\n\ninterface TableProperties {\n\trows?: ReactNode[][];\n\theaders?: ReactNode[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n\tfontSize?: string;\n}\n\nconst Table = ({\n\trows = [],\n\theaders = [],\n\thasMarginUp = false,\n\thasMarginDown = false,\n\tfontSize,\n}: TableProperties) => {\n\tconst columnCount = headers.length;\n\tconst hasHeaders = headers.some(
|
|
1
|
+
{"version":3,"file":"TableStatic.js","sources":["../../../src/staticComponents/TableStatic.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport styles from '../styles/Table.module.scss';\n\ninterface TableProperties {\n\trows?: ReactNode[][];\n\theaders?: ReactNode[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n\tfontSize?: string;\n}\n\nconst isEmptyNode = (node: ReactNode): boolean => {\n\tif (node == null || typeof node === 'boolean') {\n\t\treturn true;\n\t}\n\tif (typeof node === 'string') {\n\t\treturn node.trim() === '';\n\t}\n\tif (typeof node === 'number') {\n\t\treturn false;\n\t}\n\tif (Array.isArray(node)) {\n\t\treturn node.every(isEmptyNode);\n\t}\n\treturn false;\n};\n\nconst Table = ({\n\trows = [],\n\theaders = [],\n\thasMarginUp = false,\n\thasMarginDown = false,\n\tfontSize,\n}: TableProperties) => {\n\tconst columnCount = headers.length;\n\tconst hasHeaders = headers.some(header => !isEmptyNode(header));\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles.table}\n\t\t\t\t${hasMarginUp ? styles['margin-top--1'] : ''}\n\t\t\t\t${hasMarginDown ? styles['margin-bottom--2'] : ''}`}\n\t\t\tstyle={{\n\t\t\t\tgridTemplateColumns: `repeat(${columnCount}, auto)`,\n\t\t\t}}\n\t\t>\n\t\t\t{hasHeaders && (\n\t\t\t\t<div className={`${styles['table__header']}`}>\n\t\t\t\t\t{headers.map((header, index) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={typeof header === 'string' ? header : index}\n\t\t\t\t\t\t\tclassName={`${styles['table__header__cell']}`}\n\t\t\t\t\t\t\tstyle={fontSize ? { fontSize } : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{header}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{rows.map((row, index) => (\n\t\t\t\t<div key={index} className={`${styles['table__row']}`}>\n\t\t\t\t\t{row.map((cell, cellIndex) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={typeof cell === 'string' ? cell : cellIndex}\n\t\t\t\t\t\t\tclassName={`${styles['table__row__cell']}`}\n\t\t\t\t\t\t\tstyle={fontSize ? { fontSize } : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{cell}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n\nexport default Table;\n"],"names":["_jsxs","styles","_jsx"],"mappings":";;;;;;;AAWA,MAAM,WAAW,GAAG,CAAC,IAAe,KAAa;IAChD,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,SAAS,EAAE;AAC9C,QAAA,OAAO,IAAI;IACZ;AACA,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;IAC1B;AACA,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,KAAK;IACb;AACA,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACxB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IAC/B;AACA,IAAA,OAAO,KAAK;AACb,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,EACd,IAAI,GAAG,EAAE,EACT,OAAO,GAAG,EAAE,EACZ,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,EACrB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,kBAAkB,CAAC,EAAE,EAC1C,KAAK,EAAE,QAAQ,GAAG,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAA,QAAA,EAEzC,IAAI,EAAA,EAJA,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,SAAS,CAK3C,CACN,CAAC,EAAA,EATO,KAAK,CAUT,CACN,CAAC,CAAA,EAAA,CACG;AAER;;;;"}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import styles from '../styles/Table.module.scss.js';
|
|
3
3
|
|
|
4
|
+
const isEmptyNode = (node) => {
|
|
5
|
+
if (node == null || typeof node === 'boolean') {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (typeof node === 'string') {
|
|
9
|
+
return node.trim() === '';
|
|
10
|
+
}
|
|
11
|
+
if (typeof node === 'number') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(node)) {
|
|
15
|
+
return node.every(isEmptyNode);
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
4
19
|
const Table = ({ rows = [], headers = [], hasMarginUp = false, hasMarginDown = false, fontSize, }) => {
|
|
5
20
|
const columnCount = headers.length;
|
|
6
|
-
const hasHeaders = headers.some(header => !(
|
|
21
|
+
const hasHeaders = headers.some(header => !isEmptyNode(header));
|
|
7
22
|
return (jsxs("div", { className: `${styles.table}
|
|
8
23
|
${hasMarginUp ? styles['margin-top--1'] : ''}
|
|
9
24
|
${hasMarginDown ? styles['margin-bottom--2'] : ''}`, style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableStatic.js","sources":["../../../src/staticComponents/TableStatic.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport styles from '../styles/Table.module.scss';\n\ninterface TableProperties {\n\trows?: ReactNode[][];\n\theaders?: ReactNode[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n\tfontSize?: string;\n}\n\nconst Table = ({\n\trows = [],\n\theaders = [],\n\thasMarginUp = false,\n\thasMarginDown = false,\n\tfontSize,\n}: TableProperties) => {\n\tconst columnCount = headers.length;\n\tconst hasHeaders = headers.some(
|
|
1
|
+
{"version":3,"file":"TableStatic.js","sources":["../../../src/staticComponents/TableStatic.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport styles from '../styles/Table.module.scss';\n\ninterface TableProperties {\n\trows?: ReactNode[][];\n\theaders?: ReactNode[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n\tfontSize?: string;\n}\n\nconst isEmptyNode = (node: ReactNode): boolean => {\n\tif (node == null || typeof node === 'boolean') {\n\t\treturn true;\n\t}\n\tif (typeof node === 'string') {\n\t\treturn node.trim() === '';\n\t}\n\tif (typeof node === 'number') {\n\t\treturn false;\n\t}\n\tif (Array.isArray(node)) {\n\t\treturn node.every(isEmptyNode);\n\t}\n\treturn false;\n};\n\nconst Table = ({\n\trows = [],\n\theaders = [],\n\thasMarginUp = false,\n\thasMarginDown = false,\n\tfontSize,\n}: TableProperties) => {\n\tconst columnCount = headers.length;\n\tconst hasHeaders = headers.some(header => !isEmptyNode(header));\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles.table}\n\t\t\t\t${hasMarginUp ? styles['margin-top--1'] : ''}\n\t\t\t\t${hasMarginDown ? styles['margin-bottom--2'] : ''}`}\n\t\t\tstyle={{\n\t\t\t\tgridTemplateColumns: `repeat(${columnCount}, auto)`,\n\t\t\t}}\n\t\t>\n\t\t\t{hasHeaders && (\n\t\t\t\t<div className={`${styles['table__header']}`}>\n\t\t\t\t\t{headers.map((header, index) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={typeof header === 'string' ? header : index}\n\t\t\t\t\t\t\tclassName={`${styles['table__header__cell']}`}\n\t\t\t\t\t\t\tstyle={fontSize ? { fontSize } : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{header}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{rows.map((row, index) => (\n\t\t\t\t<div key={index} className={`${styles['table__row']}`}>\n\t\t\t\t\t{row.map((cell, cellIndex) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={typeof cell === 'string' ? cell : cellIndex}\n\t\t\t\t\t\t\tclassName={`${styles['table__row__cell']}`}\n\t\t\t\t\t\t\tstyle={fontSize ? { fontSize } : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{cell}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n\nexport default Table;\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAWA,MAAM,WAAW,GAAG,CAAC,IAAe,KAAa;IAChD,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,SAAS,EAAE;AAC9C,QAAA,OAAO,IAAI;IACZ;AACA,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;IAC1B;AACA,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,KAAK;IACb;AACA,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACxB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IAC/B;AACA,IAAA,OAAO,KAAK;AACb,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,EACd,IAAI,GAAG,EAAE,EACT,OAAO,GAAG,EAAE,EACZ,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,EACrB,QAAQ,GACS,KAAI;AACrB,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM;AAClC,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,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G,SAAS,CAK3C,CACN,CAAC,EAAA,EATO,KAAK,CAUT,CACN,CAAC,CAAA,EAAA,CACG;AAER;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableStatic.d.ts","sourceRoot":"","sources":["../../../src/staticComponents/TableStatic.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,UAAU,eAAe;IACxB,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"TableStatic.d.ts","sourceRoot":"","sources":["../../../src/staticComponents/TableStatic.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,UAAU,eAAe;IACxB,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAkBD,QAAA,MAAM,KAAK,GAAI,0DAMZ,eAAe,4CAyCjB,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@san-siva/blogkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.41",
|
|
4
4
|
"description": "A reusable blog component library for React/Next.js applications with code highlighting, diagrams, and rich content features",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -9,6 +9,22 @@ interface TableProperties {
|
|
|
9
9
|
fontSize?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
const isEmptyNode = (node: ReactNode): boolean => {
|
|
13
|
+
if (node == null || typeof node === 'boolean') {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (typeof node === 'string') {
|
|
17
|
+
return node.trim() === '';
|
|
18
|
+
}
|
|
19
|
+
if (typeof node === 'number') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (Array.isArray(node)) {
|
|
23
|
+
return node.every(isEmptyNode);
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
|
|
12
28
|
const Table = ({
|
|
13
29
|
rows = [],
|
|
14
30
|
headers = [],
|
|
@@ -17,9 +33,7 @@ const Table = ({
|
|
|
17
33
|
fontSize,
|
|
18
34
|
}: TableProperties) => {
|
|
19
35
|
const columnCount = headers.length;
|
|
20
|
-
const hasHeaders = headers.some(
|
|
21
|
-
header => !(typeof header === 'string' && header.trim() === '') && header != null,
|
|
22
|
-
);
|
|
36
|
+
const hasHeaders = headers.some(header => !isEmptyNode(header));
|
|
23
37
|
|
|
24
38
|
return (
|
|
25
39
|
<div
|