@spark-ui/collapsible 1.2.0 → 1.3.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 +6 -0
- package/dist/Collapsible.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +21 -21
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.3.0](https://github.com/adevinta/spark/compare/@spark-ui/collapsible@1.2.0...@spark-ui/collapsible@1.3.0) (2024-06-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **collapsible:** update types ([1acf698](https://github.com/adevinta/spark/commit/1acf698293da84110acb7d7930cb48e3ed1c8f80))
|
|
11
|
+
|
|
6
12
|
# [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
13
|
|
|
8
14
|
### Features
|
package/dist/Collapsible.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as collapsible from '@zag-js/collapsible';
|
|
2
2
|
import { type PropTypes } from '@zag-js/react';
|
|
3
|
-
import { type
|
|
4
|
-
export interface CollapsibleProps extends
|
|
3
|
+
import { type ComponentProps } from 'react';
|
|
4
|
+
export interface CollapsibleProps extends ComponentProps<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
7
7
|
*/
|
|
@@ -27,5 +27,5 @@ export interface CollapsibleProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
27
27
|
*/
|
|
28
28
|
ids?: collapsible.Context['ids'];
|
|
29
29
|
}
|
|
30
|
-
export declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export declare const Collapsible: import("react").ForwardRefExoticComponent<Omit<CollapsibleProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
31
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),p=require("@spark-ui/slot"),T=require("@zag-js/collapsible"),i=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 f=x(T),h=o.createContext(null),y=o.forwardRef(({asChild:e=!1,children:n,defaultOpen:t=!1,disabled:a=!1,onOpenChange:l,open:r,ids:s,...d},c)=>{const b={"open.controlled":r!==void 0,open:t||r,disabled:a,id:o.useId(),ids:s},O={...b,onOpenChange(j){l?.(j.open)},open:r,disabled:a},[v,N]=i.useMachine(f.machine(b),{context:O}),g=f.connect(v,N,i.normalizeProps),w=e?p.Slot:"div",S=i.mergeProps(g.getRootProps(),d);return o.createElement(h.Provider,{value:g},o.createElement(w,{"data-spark-component":"collapsible",ref:c,...S},n))});y.displayName="Collapsible";const P=()=>{const e=o.useContext(h);if(!e)throw Error("useCollapsibleContext must be used within a Collapsible provider");return e},u=o.forwardRef(({asChild:e=!1,className:n,children:t,...a},l)=>{const{getContentProps:r}=P(),s=e?p.Slot:"div",d=r(),c=i.mergeProps(d,{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});return o.createElement(s,{ref:l,"data-spark-component":"collapsible-content",...c},t)});u.displayName="Collapsible.Content";const m=o.forwardRef(({asChild:e=!1,children:n,...t},a)=>{const l=P(),r=e?p.Slot:"button",s=i.mergeProps(l.getTriggerProps(),t);return o.createElement(r,{ref:a,"data-spark-component":"collapsible-trigger",...s},n)});m.displayName="Collapsible.Trigger";const C=Object.assign(y,{Trigger:m,Content:u});C.displayName="Collapsible",m.displayName="Collapsible.Trigger",u.displayName="Collapsible.Content",exports.Collapsible=C;
|
package/dist/index.mjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Slot as
|
|
3
|
-
import * as
|
|
4
|
-
import { useMachine as j, normalizeProps as z, mergeProps as
|
|
1
|
+
import r, { createContext as O, forwardRef as d, useId as T, useContext as R } from "react";
|
|
2
|
+
import { Slot as c } from "@spark-ui/slot";
|
|
3
|
+
import * as h from "@zag-js/collapsible";
|
|
4
|
+
import { useMachine as j, normalizeProps as z, mergeProps as m } from "@zag-js/react";
|
|
5
5
|
import { cx as I } from "class-variance-authority";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const f = O(null), N = d(({ asChild: e = !1, children: t, defaultOpen: n = !1, disabled: o = !1, onOpenChange: l, open: a, ids: s, ...i }, p) => {
|
|
7
|
+
const b = { "open.controlled": a !== void 0, open: n || a, disabled: o, id: T(), ids: s }, y = { ...b, onOpenChange(w) {
|
|
8
8
|
l?.(w.open);
|
|
9
|
-
}, open: a, disabled: o }, [x, E] = j(
|
|
10
|
-
return
|
|
9
|
+
}, open: a, disabled: o }, [x, E] = j(h.machine(b), { context: y }), u = h.connect(x, E, z), P = e ? c : "div", k = m(u.getRootProps(), i);
|
|
10
|
+
return r.createElement(f.Provider, { value: u }, r.createElement(P, { "data-spark-component": "collapsible", ref: p, ...k }, t));
|
|
11
11
|
});
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const e = R(
|
|
12
|
+
N.displayName = "Collapsible";
|
|
13
|
+
const v = () => {
|
|
14
|
+
const e = R(f);
|
|
15
15
|
if (!e)
|
|
16
16
|
throw Error("useCollapsibleContext must be used within a Collapsible provider");
|
|
17
17
|
return e;
|
|
18
|
-
},
|
|
19
|
-
const { getContentProps: a } =
|
|
20
|
-
return
|
|
18
|
+
}, C = d(({ asChild: e = !1, className: t, children: n, ...o }, l) => {
|
|
19
|
+
const { getContentProps: a } = v(), s = e ? c : "div", i = a(), p = m(i, { 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 });
|
|
20
|
+
return r.createElement(s, { ref: l, "data-spark-component": "collapsible-content", ...p }, n);
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
return
|
|
22
|
+
C.displayName = "Collapsible.Content";
|
|
23
|
+
const g = d(({ asChild: e = !1, children: t, ...n }, o) => {
|
|
24
|
+
const l = v(), a = e ? c : "button", s = m(l.getTriggerProps(), n);
|
|
25
|
+
return r.createElement(a, { ref: o, "data-spark-component": "collapsible-trigger", ...s }, t);
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
const M = Object.assign(
|
|
29
|
-
M.displayName = "Collapsible",
|
|
27
|
+
g.displayName = "Collapsible.Trigger";
|
|
28
|
+
const M = Object.assign(N, { Trigger: g, Content: C });
|
|
29
|
+
M.displayName = "Collapsible", g.displayName = "Collapsible.Trigger", C.displayName = "Collapsible.Content";
|
|
30
30
|
export {
|
|
31
31
|
M as Collapsible
|
|
32
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/collapsible",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "An interactive component which expands/collapses a panel.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"@zag-js/collapsible": "^0.56.1",
|
|
49
49
|
"@zag-js/react": "^0.56.1"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "72d42b2ddfe158004106c228781396f82c7160da"
|
|
52
52
|
}
|