@spark-ui/collapsible 1.0.0 → 1.2.0
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/CHANGELOG.md +12 -0
- package/dist/Collapsible.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +14 -14
- package/dist/public/docgen.json +19 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.2.0](https://github.com/adevinta/spark/compare/@spark-ui/collapsible@1.1.0...@spark-ui/collapsible@1.2.0) (2024-06-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **collapsible:** add "ids" props, useful for composition ([10c3ade](https://github.com/adevinta/spark/commit/10c3ade6d16b396ede579fd1ebed5911a89f087f))
|
|
11
|
+
|
|
12
|
+
# [1.1.0](https://github.com/adevinta/spark/compare/@spark-ui/collapsible@1.0.0...@spark-ui/collapsible@1.1.0) (2024-06-14)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **accordion:** accordion component ([023c2f9](https://github.com/adevinta/spark/commit/023c2f94cd5af6dc6ed48d39fe8224e3c7373847))
|
|
17
|
+
|
|
6
18
|
# [1.0.0](https://github.com/adevinta/spark/compare/@spark-ui/collapsible@0.1.1...@spark-ui/collapsible@1.0.0) (2024-06-12)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/dist/Collapsible.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export interface CollapsibleProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
22
22
|
* The controlled open state of the collapsible. Must be used in conjunction with `onOpenChange`.
|
|
23
23
|
*/
|
|
24
24
|
open?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The ids of the elements in the collapsible. Useful for composition
|
|
27
|
+
*/
|
|
28
|
+
ids?: collapsible.Context['ids'];
|
|
25
29
|
}
|
|
26
30
|
export declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
31
|
export declare const useCollapsibleContext: () => collapsible.Api<PropTypes>;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),d=require("@spark-ui/slot"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),d=require("@spark-ui/slot"),T=require("@zag-js/collapsible"),s=require("@zag-js/react"),q=require("class-variance-authority");function x(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const b=x(T),f=o.createContext(null),C=o.forwardRef(({asChild:e=!1,children:n,defaultOpen:t=!1,disabled:a=!1,onOpenChange:l,open:r,ids:i,...y},P)=>{const u={"open.controlled":r!==void 0,open:t||r,disabled:a,id:o.useId(),ids:i},O={...u,onOpenChange(j){l?.(j.open)},open:r,disabled:a},[v,N]=s.useMachine(b.machine(u),{context:O}),m=b.connect(v,N,s.normalizeProps),w=e?d.Slot:"div",S=s.mergeProps(m.getRootProps(),y);return o.createElement(f.Provider,{value:m},o.createElement(w,{"data-spark-component":"collapsible",ref:P,...S},n))});C.displayName="Collapsible";const h=()=>{const e=o.useContext(f);if(!e)throw Error("useCollapsibleContext must be used within a Collapsible provider");return e},c=o.forwardRef(({asChild:e=!1,className:n,children:t,...a},l)=>{const{getContentProps:r}=h(),i=e?d.Slot:"div";return o.createElement(i,{ref:l,...s.mergeProps(r(),{className:q.cx("overflow-hidden","motion-reduce:!animate-none","[&[hidden]]:hidden","data-[state=open]:animate-standalone-collapse-in data-[state=closed]:animate-standalone-collapse-out",n),...a}),"data-spark-component":"collapsible-content"},t)});c.displayName="Collapsible.Content";const p=o.forwardRef(({asChild:e=!1,children:n,...t},a)=>{const{getTriggerProps:l}=h(),r=e?d.Slot:"button";return o.createElement(r,{ref:a,"data-spark-component":"collapsible-trigger",...s.mergeProps(l(),t)},n)});p.displayName="Collapsible.Trigger";const g=Object.assign(C,{Trigger:p,Content:c});g.displayName="Collapsible",p.displayName="Collapsible.Trigger",c.displayName="Collapsible.Content",exports.Collapsible=g;
|
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import s, { createContext as
|
|
1
|
+
import s, { createContext as O, forwardRef as i, useId as T, useContext as R } from "react";
|
|
2
2
|
import { Slot as p } from "@spark-ui/slot";
|
|
3
3
|
import * as b from "@zag-js/collapsible";
|
|
4
|
-
import { useMachine as
|
|
5
|
-
import { cx as
|
|
6
|
-
const
|
|
7
|
-
const C = { "open.controlled": a !== void 0, open: n || a, disabled: o, id:
|
|
8
|
-
l?.(
|
|
9
|
-
}
|
|
10
|
-
return s.createElement(
|
|
4
|
+
import { useMachine as j, normalizeProps as z, mergeProps as d } from "@zag-js/react";
|
|
5
|
+
import { cx as I } from "class-variance-authority";
|
|
6
|
+
const u = O(null), h = i(({ asChild: e = !1, children: t, defaultOpen: n = !1, disabled: o = !1, onOpenChange: l, open: a, ids: r, ...N }, v) => {
|
|
7
|
+
const C = { "open.controlled": a !== void 0, open: n || a, disabled: o, id: T(), ids: r }, y = { ...C, onOpenChange(w) {
|
|
8
|
+
l?.(w.open);
|
|
9
|
+
}, open: a, disabled: o }, [x, E] = j(b.machine(C), { context: y }), g = b.connect(x, E, z), P = e ? p : "div", k = d(g.getRootProps(), N);
|
|
10
|
+
return s.createElement(u.Provider, { value: g }, s.createElement(P, { "data-spark-component": "collapsible", ref: v, ...k }, t));
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
h.displayName = "Collapsible";
|
|
13
13
|
const f = () => {
|
|
14
|
-
const e =
|
|
14
|
+
const e = R(u);
|
|
15
15
|
if (!e)
|
|
16
16
|
throw Error("useCollapsibleContext must be used within a Collapsible provider");
|
|
17
17
|
return e;
|
|
18
18
|
}, c = i(({ asChild: e = !1, className: t, children: n, ...o }, l) => {
|
|
19
19
|
const { getContentProps: a } = f(), r = e ? p : "div";
|
|
20
|
-
return s.createElement(r, { ref: l, ...d(a(), { className:
|
|
20
|
+
return s.createElement(r, { ref: l, ...d(a(), { className: I("overflow-hidden", "motion-reduce:!animate-none", "[&[hidden]]:hidden", "data-[state=open]:animate-standalone-collapse-in data-[state=closed]:animate-standalone-collapse-out", t), ...o }), "data-spark-component": "collapsible-content" }, n);
|
|
21
21
|
});
|
|
22
22
|
c.displayName = "Collapsible.Content";
|
|
23
23
|
const m = i(({ asChild: e = !1, children: t, ...n }, o) => {
|
|
@@ -25,8 +25,8 @@ const m = i(({ asChild: e = !1, children: t, ...n }, o) => {
|
|
|
25
25
|
return s.createElement(a, { ref: o, "data-spark-component": "collapsible-trigger", ...d(l(), n) }, t);
|
|
26
26
|
});
|
|
27
27
|
m.displayName = "Collapsible.Trigger";
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const M = Object.assign(h, { Trigger: m, Content: c });
|
|
29
|
+
M.displayName = "Collapsible", m.displayName = "Collapsible.Trigger", c.displayName = "Collapsible.Content";
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
M as Collapsible
|
|
32
32
|
};
|
package/dist/public/docgen.json
CHANGED
|
@@ -99,6 +99,25 @@
|
|
|
99
99
|
"type": {
|
|
100
100
|
"name": "boolean"
|
|
101
101
|
}
|
|
102
|
+
},
|
|
103
|
+
"ids": {
|
|
104
|
+
"defaultValue": null,
|
|
105
|
+
"description": "The ids of the elements in the collapsible. Useful for composition",
|
|
106
|
+
"name": "ids",
|
|
107
|
+
"parent": {
|
|
108
|
+
"fileName": "collapsible/src/Collapsible.tsx",
|
|
109
|
+
"name": "CollapsibleProps"
|
|
110
|
+
},
|
|
111
|
+
"declarations": [
|
|
112
|
+
{
|
|
113
|
+
"fileName": "collapsible/src/Collapsible.tsx",
|
|
114
|
+
"name": "CollapsibleProps"
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"required": false,
|
|
118
|
+
"type": {
|
|
119
|
+
"name": "Partial<{ root: string; content: string; trigger: string; }>"
|
|
120
|
+
}
|
|
102
121
|
}
|
|
103
122
|
}
|
|
104
123
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/collapsible",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "An interactive component which expands/collapses a panel.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"category": "components"
|
|
40
40
|
},
|
|
41
41
|
"bugs": {
|
|
42
|
-
"url": "https://github.com/adevinta/spark/issues?q=is%3Aopen+label%
|
|
42
|
+
"url": "https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3A%22Component%3A+collapsible%22"
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://sparkui.vercel.app",
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@spark-ui/slot": "^1.7.1",
|
|
48
|
-
"@zag-js/collapsible": "^0.56.
|
|
49
|
-
"@zag-js/react": "^0.56.
|
|
48
|
+
"@zag-js/collapsible": "^0.56.1",
|
|
49
|
+
"@zag-js/react": "^0.56.1"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "280915cb634da62b25cbef3d1a727497c768aae3"
|
|
52
52
|
}
|