@bonprix-ds/react-wrapper-collapsible 1.1.3 → 1.1.5
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.js +1 -2
- package/dist/src/Collapsible.js +1 -2
- package/dist/src/Collapsible.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { e as default };
|
|
1
|
+
export { default } from "./src/Collapsible.js";
|
package/dist/src/Collapsible.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useEventListener as n, useInitialInView as r } from "@bonprix-ds/utils"
|
|
|
4
4
|
import { warnDeprecated as i } from "@bonprix-ds/utils/deprecation";
|
|
5
5
|
import "#styles";
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/Collapsible.tsx
|
|
8
8
|
typeof window < "u" && import("@bonprix-ds/bpds-collapsible").then(({ Collapsible: e }) => {
|
|
9
9
|
customElements.get("bpds-collapsible") || customElements.define("bpds-collapsible", e);
|
|
10
10
|
});
|
|
@@ -43,7 +43,6 @@ var s = ({ title: s, children: c, initiallyExpanded: l, initiallyOpened: u, root
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
s.displayName = "Collapsible";
|
|
46
|
-
//#endregion
|
|
47
46
|
export { s as default };
|
|
48
47
|
|
|
49
48
|
//# sourceMappingURL=Collapsible.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.js","names":["Collapsible","initiallyExpandedProp","initiallyOpened","onOpen","onClose","warnDeprecated","initiallyExpanded","ref","useInitialInView","rootRef","onInitialInView","detailsRef","useRef","useEventListener","onExpand","onCollapse","expand","collapse","useImperativeHandle","imperativeRef","title"],"sources":["../../src/Collapsible.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useImperativeHandle, useRef } from \"react\";\n\nimport type { CollapsibleProps } from \"@bonprix-ds/react-collapsible\";\nimport { useEventListener, useInitialInView } from \"@bonprix-ds/utils\";\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\nimport \"@bonprix-ds/bpds-collapsible/collapsible.css\";\n\n// The element class is loaded lazily and only in the browser:
|
|
1
|
+
{"version":3,"file":"Collapsible.js","names":["Collapsible","initiallyExpandedProp","initiallyOpened","onOpen","onClose","warnDeprecated","initiallyExpanded","ref","useInitialInView","rootRef","onInitialInView","detailsRef","useRef","useEventListener","onExpand","onCollapse","expand","collapse","useImperativeHandle","imperativeRef","title"],"sources":["../../src/Collapsible.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useImperativeHandle, useRef } from \"react\";\n\nimport type { CollapsibleProps } from \"@bonprix-ds/react-collapsible\";\nimport { useEventListener, useInitialInView } from \"@bonprix-ds/utils\";\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\nimport \"@bonprix-ds/bpds-collapsible/collapsible.css\";\n\n// The element class is loaded lazily and only in the browser: a static import would bundle it with\n// this module and register the tag before React hydrates the markup. Registering before the markup\n// arrives is not possible either way; the JSX below renders the open state itself, so the component\n// works without JavaScript and the upgrade only adds the animation and the custom events.\n// The registry check has to sit inside the callback, not beside the window guard: the tag can be\n// registered during the await - `defineCustomElements` from the umbrella does exactly that - and\n// `define` throws `NotSupportedError` on a name that is already taken.\nif (typeof window !== \"undefined\") {\n void import(\"@bonprix-ds/bpds-collapsible\").then(({ Collapsible }) => {\n if (!customElements.get(\"bpds-collapsible\")) customElements.define(\"bpds-collapsible\", Collapsible);\n });\n}\n\nexport type Props = CollapsibleProps;\n\nconst Collapsible = ({\n title,\n children,\n initiallyExpanded: initiallyExpandedProp,\n initiallyOpened,\n rootRef,\n imperativeRef,\n id,\n onExpand,\n onCollapse,\n onOpen,\n onClose,\n onInitialInView,\n}: Props) => {\n if (initiallyOpened !== undefined || onOpen || onClose) warnDeprecated(\"collapsible-expanded-props\");\n const initiallyExpanded = initiallyExpandedProp ?? initiallyOpened ?? false;\n const ref = useInitialInView(rootRef, onInitialInView);\n const detailsRef = useRef<HTMLDetailsElement>(null);\n\n useEventListener(ref, \"bpds-collapsible-expand\", onExpand ?? onOpen);\n useEventListener(ref, \"bpds-collapsible-collapse\", onCollapse ?? onClose);\n\n const expand = () => {\n if (detailsRef.current) detailsRef.current.open = true;\n };\n\n const collapse = () => {\n if (detailsRef.current) detailsRef.current.open = false;\n };\n\n useImperativeHandle(imperativeRef, () => ({\n expand,\n collapse,\n open: () => {\n warnDeprecated(\"collapsible-expanded-props\");\n expand();\n },\n close: () => {\n warnDeprecated(\"collapsible-expanded-props\");\n collapse();\n },\n }));\n\n return (\n <bpds-collapsible initially-expanded={initiallyExpanded ? \"true\" : undefined} ref={ref} id={id}>\n {/* `open` is rendered here rather than left to the element's connectedCallback so the markup\n is already correct without JavaScript, and hydration finds the DOM it rendered. */}\n <details ref={detailsRef} open={initiallyExpanded}>\n <summary>\n {title}\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"icon\" viewBox=\"0 0 24 24\">\n <path d=\"m12.046 14.424 6.12-6.121a1.2 1.2 0 0 1 1.698 0 .3.3 0 0 1 0 .424l-6.97 6.97a1.2 1.2 0 0 1-1.697 0l-6.97-6.97a.3.3 0 0 1 0-.424 1.2 1.2 0 0 1 1.697 0l6.122 6.121Z\" />\n </svg>\n </summary>\n <div>\n <div>{children}</div>\n </div>\n </details>\n </bpds-collapsible>\n );\n};\n\nCollapsible.displayName = \"Collapsible\";\n\nexport default Collapsible;\n"],"mappings":";;;;;;;AAgBI,OAAO,SAAW,OACpB,OAAY,+BAA+B,CAAC,MAAM,EAAE,qBAAkB;CACpE,AAAK,eAAe,IAAI,kBAAkB,KAAG,eAAe,OAAO,oBAAoBA,CAAW;AACpG,CAAC;AAKH,IAAMA,KAAe,EACnB,UACA,aACA,mBAAmBC,GACnB,oBACA,YACA,kBACA,OACA,aACA,eACA,WACA,YACA,yBACW;CACX,CAAIC,MAAoB,KAAA,KAAaC,KAAUC,MAASC,EAAe,4BAA4B;CACnG,IAAMC,IAAoBL,KAAyBC,KAAmB,IAChEK,IAAMC,EAAiBC,GAASC,CAAe,GAC/CC,IAAaC,EAA2B,IAAI;CAGlD,AADAC,EAAiBN,GAAK,2BAA2BO,KAAYX,CAAM,GACnEU,EAAiBN,GAAK,6BAA6BQ,KAAcX,CAAO;CAExE,IAAMY,UAAe;EACnB,AAAIL,EAAW,YAAS,EAAW,QAAQ,OAAO;CACpD,GAEMM,UAAiB;EACrB,AAAIN,EAAW,YAAS,EAAW,QAAQ,OAAO;CACpD;CAeA,OAbAO,EAAoBC,UAAsB;EACxC;EACA;EACA,YAAY;GAEV,AADAd,EAAe,4BAA4B,GAC3CW,EAAO;EACT;EACA,aAAa;GAEX,AADAX,EAAe,4BAA4B,GAC3CY,EAAS;EACX;CACF,EAAE,GAGA,kBAAC,oBAAD;EAAkB,sBAAoBX,IAAoB,SAAS,KAAA;EAAgB;EAAS;EAG1F,UAAA,kBAAC,WAAD;GAAS,KAAKK;GAAY,MAAML;GAAhC,UAAA,CACE,kBAAC,WAAD,EAAA,UAAA,CACGc,GACD,kBAAC,OAAD;IAAK,OAAM;IAA6B,WAAU;IAAO,SAAQ;IAC/D,UAAA,kBAAC,QAAD,EAAM,GAAE,qKAAsK,CAAA;GAC3K,CAAA,CACE,EAAA,CAAA,GACT,kBAAC,OAAD,EAAA,UACE,kBAAC,OAAD,EAAM,YAAc,CAAA,EACjB,CAAA,CACE;;CACO,CAAA;AAEtB;AAEA,EAAY,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonprix-ds/react-wrapper-collapsible",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Collapsible component, implemented as a React wrapper around bpds-collapsible, for the Bonprix Design System.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
"provenance": true
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@bonprix-ds/bpds-collapsible": "1.1.
|
|
45
|
-
"@bonprix-ds/react-collapsible": "1.1.
|
|
46
|
-
"@bonprix-ds/utils": "0.
|
|
44
|
+
"@bonprix-ds/bpds-collapsible": "1.1.2",
|
|
45
|
+
"@bonprix-ds/react-collapsible": "1.1.4",
|
|
46
|
+
"@bonprix-ds/utils": "0.6.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"@bonprix-ds/vite-config": "0.0.0",
|
|
49
50
|
"@testing-library/dom": "10.4.2",
|
|
50
51
|
"@testing-library/react": "16.3.3",
|
|
51
52
|
"@types/react": "19.3.0",
|
|
52
|
-
"vite": "8.3.
|
|
53
|
-
"vitest": "5.0.5"
|
|
54
|
-
"@bonprix-ds/vite-config": "0.0.0"
|
|
53
|
+
"vite": "8.3.5",
|
|
54
|
+
"vitest": "5.0.5"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^19",
|