@chayns-components/core 5.0.0-beta.944 → 5.0.0-beta.945
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.
|
@@ -17,7 +17,7 @@ const getAccordionHeadHeight = ({
|
|
|
17
17
|
element.style.pointerEvents = 'none';
|
|
18
18
|
element.style.whiteSpace = 'nowrap';
|
|
19
19
|
element.style.width = `${width}px`;
|
|
20
|
-
element.
|
|
20
|
+
element.innerHTML = title;
|
|
21
21
|
document.body.appendChild(element);
|
|
22
22
|
const closedHeight = Math.max(element.clientHeight + 8, isWrapped ? 40 : 33);
|
|
23
23
|
if (isWrapped) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","names":["_react","require","getAccordionHeadHeight","isWrapped","title","width","hasSearch","element","document","createElement","style","fontSize","opacity","pointerEvents","whiteSpace","
|
|
1
|
+
{"version":3,"file":"accordion.js","names":["_react","require","getAccordionHeadHeight","isWrapped","title","width","hasSearch","element","document","createElement","style","fontSize","opacity","pointerEvents","whiteSpace","innerHTML","body","appendChild","closedHeight","Math","max","clientHeight","fontWeight","openHeight","removeChild","closed","open","exports","getElementClickEvent","hasClickHandler","checkForClickHandler","el","isValidElement","props","onClick","children","Children","forEach"],"sources":["../../../src/utils/accordion.ts"],"sourcesContent":["import { Children, isValidElement, ReactNode } from 'react';\nimport type { AccordionHeadProps } from '../components/accordion/accordion-head/AccordionHead';\n\ntype GetAccordionHeadHeightOptions = Pick<AccordionHeadProps, 'isWrapped' | 'title'> & {\n width: number;\n hasSearch: boolean;\n};\n\ninterface GetAccordionHeadHeightResult {\n closed: number;\n open: number;\n}\n\nexport const getAccordionHeadHeight = ({\n isWrapped,\n title,\n width,\n hasSearch,\n}: GetAccordionHeadHeightOptions): GetAccordionHeadHeightResult => {\n const element = document.createElement('div');\n\n element.style.fontSize = '1rem';\n element.style.opacity = '0';\n element.style.pointerEvents = 'none';\n element.style.whiteSpace = 'nowrap';\n element.style.width = `${width}px`;\n\n element.innerHTML = title;\n\n document.body.appendChild(element);\n\n const closedHeight = Math.max(element.clientHeight + 8, isWrapped ? 40 : 33);\n\n if (isWrapped) {\n element.style.fontWeight = 'bold';\n element.style.whiteSpace = 'nowrap';\n } else {\n element.style.fontSize = '1.3rem';\n element.style.whiteSpace = hasSearch ? 'nowrap' : 'normal';\n }\n\n const openHeight = Math.max(element.clientHeight + 8, isWrapped ? 40 : 33);\n\n document.body.removeChild(element);\n\n return { closed: closedHeight, open: openHeight };\n};\n\nexport const getElementClickEvent = (element: ReactNode) => {\n let hasClickHandler = false;\n\n const checkForClickHandler = (el: ReactNode) => {\n if (!isValidElement(el)) return;\n\n if (el.props.onClick) {\n hasClickHandler = true;\n\n return;\n }\n\n if (el.props.children) {\n Children.forEach(el.props.children, checkForClickHandler);\n }\n };\n\n checkForClickHandler(element);\n\n return hasClickHandler;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAaO,MAAMC,sBAAsB,GAAGA,CAAC;EACnCC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC;AAC2B,CAAC,KAAmC;EAC/D,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAE7CF,OAAO,CAACG,KAAK,CAACC,QAAQ,GAAG,MAAM;EAC/BJ,OAAO,CAACG,KAAK,CAACE,OAAO,GAAG,GAAG;EAC3BL,OAAO,CAACG,KAAK,CAACG,aAAa,GAAG,MAAM;EACpCN,OAAO,CAACG,KAAK,CAACI,UAAU,GAAG,QAAQ;EACnCP,OAAO,CAACG,KAAK,CAACL,KAAK,GAAG,GAAGA,KAAK,IAAI;EAElCE,OAAO,CAACQ,SAAS,GAAGX,KAAK;EAEzBI,QAAQ,CAACQ,IAAI,CAACC,WAAW,CAACV,OAAO,CAAC;EAElC,MAAMW,YAAY,GAAGC,IAAI,CAACC,GAAG,CAACb,OAAO,CAACc,YAAY,GAAG,CAAC,EAAElB,SAAS,GAAG,E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Events = 'none';
|
|
13
13
|
element.style.whiteSpace = 'nowrap';
|
|
14
14
|
element.style.width = `${width}px`;
|
|
15
|
-
element.
|
|
15
|
+
element.innerHTML = title;
|
|
16
16
|
document.body.appendChild(element);
|
|
17
17
|
const closedHeight = Math.max(element.clientHeight + 8, isWrapped ? 40 : 33);
|
|
18
18
|
if (isWrapped) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","names":["Children","isValidElement","getAccordionHeadHeight","_ref","isWrapped","title","width","hasSearch","element","document","createElement","style","fontSize","opacity","pointerEvents","whiteSpace","
|
|
1
|
+
{"version":3,"file":"accordion.js","names":["Children","isValidElement","getAccordionHeadHeight","_ref","isWrapped","title","width","hasSearch","element","document","createElement","style","fontSize","opacity","pointerEvents","whiteSpace","innerHTML","body","appendChild","closedHeight","Math","max","clientHeight","fontWeight","openHeight","removeChild","closed","open","getElementClickEvent","hasClickHandler","checkForClickHandler","el","props","onClick","children","forEach"],"sources":["../../../src/utils/accordion.ts"],"sourcesContent":["import { Children, isValidElement, ReactNode } from 'react';\nimport type { AccordionHeadProps } from '../components/accordion/accordion-head/AccordionHead';\n\ntype GetAccordionHeadHeightOptions = Pick<AccordionHeadProps, 'isWrapped' | 'title'> & {\n width: number;\n hasSearch: boolean;\n};\n\ninterface GetAccordionHeadHeightResult {\n closed: number;\n open: number;\n}\n\nexport const getAccordionHeadHeight = ({\n isWrapped,\n title,\n width,\n hasSearch,\n}: GetAccordionHeadHeightOptions): GetAccordionHeadHeightResult => {\n const element = document.createElement('div');\n\n element.style.fontSize = '1rem';\n element.style.opacity = '0';\n element.style.pointerEvents = 'none';\n element.style.whiteSpace = 'nowrap';\n element.style.width = `${width}px`;\n\n element.innerHTML = title;\n\n document.body.appendChild(element);\n\n const closedHeight = Math.max(element.clientHeight + 8, isWrapped ? 40 : 33);\n\n if (isWrapped) {\n element.style.fontWeight = 'bold';\n element.style.whiteSpace = 'nowrap';\n } else {\n element.style.fontSize = '1.3rem';\n element.style.whiteSpace = hasSearch ? 'nowrap' : 'normal';\n }\n\n const openHeight = Math.max(element.clientHeight + 8, isWrapped ? 40 : 33);\n\n document.body.removeChild(element);\n\n return { closed: closedHeight, open: openHeight };\n};\n\nexport const getElementClickEvent = (element: ReactNode) => {\n let hasClickHandler = false;\n\n const checkForClickHandler = (el: ReactNode) => {\n if (!isValidElement(el)) return;\n\n if (el.props.onClick) {\n hasClickHandler = true;\n\n return;\n }\n\n if (el.props.children) {\n Children.forEach(el.props.children, checkForClickHandler);\n }\n };\n\n checkForClickHandler(element);\n\n return hasClickHandler;\n};\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,cAAc,QAAmB,OAAO;AAa3D,OAAO,MAAMC,sBAAsB,GAAGC,IAAA,IAK6B;EAAA,IAL5B;IACnCC,SAAS;IACTC,KAAK;IACLC,KAAK;IACLC;EAC2B,CAAC,GAAAJ,IAAA;EAC5B,MAAMK,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAE7CF,OAAO,CAACG,KAAK,CAACC,QAAQ,GAAG,MAAM;EAC/BJ,OAAO,CAACG,KAAK,CAACE,OAAO,GAAG,GAAG;EAC3BL,OAAO,CAACG,KAAK,CAACG,aAAa,GAAG,MAAM;EACpCN,OAAO,CAACG,KAAK,CAACI,UAAU,GAAG,QAAQ;EACnCP,OAAO,CAACG,KAAK,CAACL,KAAK,GAAG,GAAGA,KAAK,IAAI;EAElCE,OAAO,CAACQ,SAAS,GAAGX,KAAK;EAEzBI,QAAQ,CAACQ,IAAI,CAACC,WAAW,CAACV,OAAO,CAAC;EAElC,MAAMW,YAAY,GAAGC,IAAI,CAACC,GAAG,CAACb,OAAO,CAACc,YAAY,GAAG,CAAC,EAAElB,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC;EAE5E,IAAIA,SAAS,EAAE;IACXI,OAAO,CAACG,KAAK,CAACY,UAAU,GAAG,MAAM;IACjCf,OAAO,CAACG,KAAK,CAACI,UAAU,GAAG,QAAQ;EACvC,CAAC,MAAM;IACHP,OAAO,CAACG,KAAK,CAACC,QAAQ,GAAG,QAAQ;IACjCJ,OAAO,CAACG,KAAK,CAACI,UAAU,GAAGR,SAAS,GAAG,QAAQ,GAAG,QAAQ;EAC9D;EAEA,MAAMiB,UAAU,GAAGJ,IAAI,CAACC,GAAG,CAACb,OAAO,CAACc,YAAY,GAAG,CAAC,EAAElB,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC;EAE1EK,QAAQ,CAACQ,IAAI,CAACQ,WAAW,CAACjB,OAAO,CAAC;EAElC,OAAO;IAAEkB,MAAM,EAAEP,YAAY;IAAEQ,IAAI,EAAEH;EAAW,CAAC;AACrD,CAAC;AAED,OAAO,MAAMI,oBAAoB,GAAIpB,OAAkB,IAAK;EACxD,IAAIqB,eAAe,GAAG,KAAK;EAE3B,MAAMC,oBAAoB,GAAIC,EAAa,IAAK;IAC5C,IAAI,eAAC9B,cAAc,CAAC8B,EAAE,CAAC,EAAE;IAEzB,IAAIA,EAAE,CAACC,KAAK,CAACC,OAAO,EAAE;MAClBJ,eAAe,GAAG,IAAI;MAEtB;IACJ;IAEA,IAAIE,EAAE,CAACC,KAAK,CAACE,QAAQ,EAAE;MACnBlC,QAAQ,CAACmC,OAAO,CAACJ,EAAE,CAACC,KAAK,CAACE,QAAQ,EAAEJ,oBAAoB,CAAC;IAC7D;EACJ,CAAC;EAEDA,oBAAoB,CAACtB,OAAO,CAAC;EAE7B,OAAOqB,eAAe;AAC1B,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AccordionHeadProps } from '../components/accordion/accordion-head/AccordionHead';
|
|
2
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import type { AccordionHeadProps } from '../components/accordion/accordion-head/AccordionHead';
|
|
3
3
|
type GetAccordionHeadHeightOptions = Pick<AccordionHeadProps, 'isWrapped' | 'title'> & {
|
|
4
4
|
width: number;
|
|
5
5
|
hasSearch: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.945",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "6c596835d5783e056194c6e342ccec1238f4a3bc"
|
|
91
91
|
}
|