@san-siva/blogkit 1.1.32 → 1.1.33
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/components/CheckList.js +1 -4
- package/dist/cjs/components/CheckList.js.map +1 -1
- package/dist/cjs/dynamicComponents/CheckListDynamic.js +11 -14
- package/dist/cjs/dynamicComponents/CheckListDynamic.js.map +1 -1
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.css.map +1 -1
- package/dist/esm/components/CheckList.js +1 -4
- package/dist/esm/components/CheckList.js.map +1 -1
- package/dist/esm/dynamicComponents/CheckListDynamic.js +11 -14
- package/dist/esm/dynamicComponents/CheckListDynamic.js.map +1 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.css.map +1 -1
- package/dist/types/components/CheckList.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/CheckList.tsx +8 -13
- package/src/styles/CheckList.module.scss +2 -2
- package/src/styles/CodeBlock.module.scss +2 -3
- package/src/dynamicComponents/CheckListDynamic.tsx +0 -66
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { lazy, Suspense } from 'react';
|
|
4
2
|
import CheckListStatic from '../staticComponents/CheckListStatic.js';
|
|
5
3
|
|
|
6
|
-
const CheckListDynamic = lazy(() => import('../dynamicComponents/CheckListDynamic.js'));
|
|
7
4
|
const CheckList = ({ items, hasMarginUp = false, hasMarginDown = false, }) => {
|
|
8
|
-
return (jsx(
|
|
5
|
+
return (jsx(CheckListStatic, { items: items, hasMarginUp: hasMarginUp, hasMarginDown: hasMarginDown }));
|
|
9
6
|
};
|
|
10
7
|
|
|
11
8
|
export { CheckList as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckList.js","sources":["../../../src/components/CheckList.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"CheckList.js","sources":["../../../src/components/CheckList.tsx"],"sourcesContent":["import CheckListStatic, {\n\ttype CheckListItem,\n} from '../staticComponents/CheckListStatic';\n\ninterface CheckListProperties {\n\titems: CheckListItem[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst CheckList = ({\n\titems,\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: CheckListProperties) => {\n\treturn (\n\t\t<CheckListStatic\n\t\t\titems={items}\n\t\t\thasMarginUp={hasMarginUp}\n\t\t\thasMarginDown={hasMarginDown}\n\t\t/>\n\t);\n};\n\nexport { type CheckListItem };\nexport default CheckList;\n"],"names":["_jsx"],"mappings":";;;AAUA,MAAM,SAAS,GAAG,CAAC,EAClB,KAAK,EACL,WAAW,GAAG,KAAK,EACnB,aAAa,GAAG,KAAK,GACA,KAAI;AACzB,IAAA,QACCA,GAAA,CAAC,eAAe,EAAA,EACf,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAAA,CAC3B;AAEJ;;;;"}
|
|
@@ -3,24 +3,21 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import styles from '../styles/CheckList.module.scss.js';
|
|
5
5
|
|
|
6
|
-
const CHECKBOX_SIZE = 12;
|
|
7
|
-
const P_TAG_FONT_SIZE = 16;
|
|
8
6
|
const CheckListDynamic = ({ items, hasMarginUp = false, hasMarginDown = false, }) => {
|
|
9
7
|
const [checkboxMarginTop, setCheckboxMarginTop] = useState(0);
|
|
10
8
|
const measureRef = useRef(null);
|
|
11
9
|
useEffect(() => {
|
|
12
|
-
if (!measureRef.current)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
10
|
+
// if (!measureRef.current) return;
|
|
11
|
+
// const p = measureRef.current.querySelector('p');
|
|
12
|
+
// if (!p) return;
|
|
13
|
+
// const rawLineHeight = getComputedStyle(p).lineHeight;
|
|
14
|
+
// const lineHeight =
|
|
15
|
+
// rawLineHeight === 'normal'
|
|
16
|
+
// ? P_TAG_FONT_SIZE * 1.2
|
|
17
|
+
// : parseFloat(rawLineHeight);
|
|
18
|
+
// if (!isNaN(lineHeight)) {
|
|
19
|
+
// setCheckboxMarginTop(Math.max(0, (lineHeight - CHECKBOX_SIZE) / 2));
|
|
20
|
+
// }
|
|
24
21
|
}, []);
|
|
25
22
|
return (jsx("div", { className: `${styles['check-list']} ${hasMarginUp ? styles['margin-top--1'] : ''} ${hasMarginDown ? styles['margin-bottom--2'] : ''}`, children: items.map((item, index) => (jsxs("div", { className: styles['check-list__item'], style: { alignItems: 'flex-start' }, "data-id": item.id, ref: index === 0 ? measureRef : undefined, children: [jsx("div", { className: `${styles['check-list__item__input']} ${item.isChecked ? styles['check-list__item__input--checked'] : ''}`, style: { marginTop: `${checkboxMarginTop}px` } }), item.children] }, item.id))) }));
|
|
26
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckListDynamic.js","sources":["../../../src/dynamicComponents/CheckListDynamic.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { CheckListItem } from '../staticComponents/CheckListStatic';\nimport styles from '../styles/CheckList.module.scss';\n\ninterface Properties {\n\titems: CheckListItem[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst CHECKBOX_SIZE = 12;\nconst P_TAG_FONT_SIZE = 16;\n\nconst CheckListDynamic = ({\n\titems,\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: Properties) => {\n\tconst [checkboxMarginTop, setCheckboxMarginTop] = useState(0);\n\tconst measureRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\
|
|
1
|
+
{"version":3,"file":"CheckListDynamic.js","sources":["../../../src/dynamicComponents/CheckListDynamic.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { CheckListItem } from '../staticComponents/CheckListStatic';\nimport styles from '../styles/CheckList.module.scss';\n\ninterface Properties {\n\titems: CheckListItem[];\n\thasMarginUp?: boolean;\n\thasMarginDown?: boolean;\n}\n\nconst CHECKBOX_SIZE = 12;\nconst P_TAG_FONT_SIZE = 16;\n\nconst CheckListDynamic = ({\n\titems,\n\thasMarginUp = false,\n\thasMarginDown = false,\n}: Properties) => {\n\tconst [checkboxMarginTop, setCheckboxMarginTop] = useState(0);\n\tconst measureRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\t// if (!measureRef.current) return;\n\t\t// const p = measureRef.current.querySelector('p');\n\t\t// if (!p) return;\n\t\t// const rawLineHeight = getComputedStyle(p).lineHeight;\n\t\t// const lineHeight =\n\t\t// \trawLineHeight === 'normal'\n\t\t// \t\t? P_TAG_FONT_SIZE * 1.2\n\t\t// \t\t: parseFloat(rawLineHeight);\n\t\t// if (!isNaN(lineHeight)) {\n\t\t// \tsetCheckboxMarginTop(Math.max(0, (lineHeight - CHECKBOX_SIZE) / 2));\n\t\t// }\n\t}, []);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`${styles['check-list']} ${hasMarginUp ? styles['margin-top--1'] : ''} ${\n\t\t\t\thasMarginDown ? styles['margin-bottom--2'] : ''\n\t\t\t}`}\n\t\t>\n\t\t\t{items.map((item, index) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={item.id}\n\t\t\t\t\tclassName={styles['check-list__item']}\n\t\t\t\t\tstyle={{ alignItems: 'flex-start' }}\n\t\t\t\t\tdata-id={item.id}\n\t\t\t\t\tref={index === 0 ? measureRef : undefined}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={`${styles['check-list__item__input']} ${\n\t\t\t\t\t\t\titem.isChecked ? styles['check-list__item__input--checked'] : ''\n\t\t\t\t\t\t}`}\n\t\t\t\t\t\tstyle={{ marginTop: `${checkboxM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