@jamsrui/collapsible 0.0.13 → 0.0.15

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.
@@ -1 +1 @@
1
- "use client";import{a,b}from"./chunk-324DBYK6.mjs";export{a as CollapsibleConfig,b as useCollapsibleConfig};
1
+ "use client";import{createConfigContext as o}from"@jamsrui/utils";const[e,p]=o({displayName:"CollapsibleConfig"});export{e as CollapsibleConfig,p as useCollapsibleConfig};
@@ -1 +1 @@
1
- "use client";import{a}from"./chunk-ZEA6EOPI.mjs";import"./chunk-N576RNB6.mjs";export{a as CollapsibleContent};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{AnimatePresence as s,motion as p}from"motion/react";import{useCollapsibleContext as l}from"./collapsible-context.mjs";const C=t=>{const{children:o,...n}=t,{isOpen:i,getContentProps:r}=l();return e(s,{initial:!1,children:!!i&&e(p.div,{animate:{height:"auto"},exit:{height:0},initial:{height:0},role:"region",transition:{type:"spring",bounce:0,duration:.4},...r(n),children:o})})};export{C as CollapsibleContent};
@@ -1 +1 @@
1
- "use client";import{a,b}from"./chunk-N576RNB6.mjs";export{a as CollapsibleContext,b as useCollapsibleContext};
1
+ "use client";import{createContext as t,use as l}from"react";const o=t(null),p=()=>{const e=l(o);if(!e)throw new Error("useCollapsibleContext must be used within Collapsible");return e};export{o as CollapsibleContext,p as useCollapsibleContext};
@@ -1 +1 @@
1
- "use client";import{a}from"./chunk-VT67FJWO.mjs";import"./chunk-N576RNB6.mjs";export{a as CollapsibleTrigger};
1
+ "use client";import{cloneElement as l}from"react";import{useCollapsibleContext as o}from"./collapsible-context.mjs";const p=e=>{const{children:r}=e,{getTriggerProps:t}=o();return l(r,t())};export{p as CollapsibleTrigger};
@@ -1 +1 @@
1
- "use client";import{a}from"./chunk-AA2GL6IQ.mjs";import"./chunk-N576RNB6.mjs";import"./chunk-KFKEAGEV.mjs";export{a as Collapsible};
1
+ "use client";import{jsx as p}from"react/jsx-runtime";import{cloneElement as n}from"react";import{CollapsibleContext as s}from"./collapsible-context.mjs";import{useCollapsible as r}from"./use-collapsible.mjs";const m=e=>{const{children:o}=e,l=r(e),t=n(o,l.getRootProps());return p(s,{value:l,children:t})};export{m as Collapsible};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as i,b as r}from"./chunk-324DBYK6.mjs";import{a as l}from"./chunk-ZEA6EOPI.mjs";import{a as e}from"./chunk-VT67FJWO.mjs";import{a as o}from"./chunk-AA2GL6IQ.mjs";import"./chunk-N576RNB6.mjs";import"./chunk-KFKEAGEV.mjs";var C=Object.assign(o,{Root:o,Content:l,Trigger:e});export{C as Collapsible,i as CollapsibleConfig,l as CollapsibleContent,e as CollapsibleTrigger,r as useCollapsibleConfig};
1
+ import{Collapsible as o}from"./collapsible.mjs";import{CollapsibleContent as l}from"./collapsible-content.mjs";import{CollapsibleTrigger as e}from"./collapsible-trigger.mjs";import{CollapsibleConfig as a,useCollapsibleConfig as b}from"./collapsible-config.mjs";const p=Object.assign(o,{Root:o,Content:l,Trigger:e});export{p as Collapsible,a as CollapsibleConfig,l as CollapsibleContent,e as CollapsibleTrigger,b as useCollapsibleConfig};
@@ -1 +1 @@
1
- import{a}from"./chunk-KFKEAGEV.mjs";export{a as useCollapsible};
1
+ import{useCallback as a,useId as c,useMemo as P}from"react";import{useControlledState as f}from"@jamsrui/hooks";import{dataAttrDev as r,mergeProps as O}from"@jamsrui/utils";const y=g=>{const{defaultOpen:m,disabled:n=!1,isOpen:u,onOpenChange:C}=g,[e,l]=f({defaultProp:m,onChange:C,prop:u}),o=c(),t=c(),p=a(()=>{l(s=>!s)},[l]),i=a(()=>({"aria-expanded":e,"data-expanded":e,"data-slot":r("root")}),[e]),d=a(s=>({...s,"data-slot":r("content"),id:t,role:"region","aria-labelledby":o,hidden:!e}),[t,e,o]),b=a(()=>({...O({},{onClick:p}),id:o,"data-slot":r("trigger"),"aria-controls":t,"aria-expanded":e,"data-expanded":e,disabled:n,"aria-disabled":n}),[t,p,n,e,o]);return P(()=>({isOpen:e,getTriggerProps:b,getContentProps:d,getRootProps:i}),[d,i,b,e])};export{y as useCollapsible};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@jamsrui/collapsible",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "peerDependencies": {
5
5
  "motion": ">=12",
6
6
  "react": ">=19"
7
7
  },
8
8
  "dependencies": {
9
- "@jamsrui/hooks": "^0.0.13",
10
- "@jamsrui/core": "^0.0.11",
11
- "@jamsrui/utils": "^0.0.13"
9
+ "@jamsrui/hooks": "^0.0.15",
10
+ "@jamsrui/core": "^0.0.13",
11
+ "@jamsrui/utils": "^0.0.15"
12
12
  },
13
13
  "exports": {
14
14
  ".": {
@@ -1 +0,0 @@
1
- import{createConfigContext as o}from"@jamsrui/utils";var[e,p]=o({displayName:"CollapsibleConfig"});export{e as a,p as b};
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-N576RNB6.mjs";import{a as t}from"./chunk-KFKEAGEV.mjs";import{cloneElement as r}from"react";import{jsx as p}from"react/jsx-runtime";var m=e=>{let{children:n}=e,l=t(e),s=r(n,l.getRootProps());return p(o,{value:l,children:s})};export{m as a};
@@ -1 +0,0 @@
1
- import{useCallback as a,useId as c,useMemo as P}from"react";import{useControlledState as f}from"@jamsrui/hooks";import{dataAttrDev as r,mergeProps as O}from"@jamsrui/utils";var y=g=>{let{defaultOpen:m,disabled:n=!1,isOpen:u,onOpenChange:C}=g,[e,l]=f({defaultProp:m,onChange:C,prop:u}),o=c(),t=c(),p=a(()=>{l(s=>!s)},[l]),i=a(()=>({"aria-expanded":e,"data-expanded":e,"data-slot":r("root")}),[e]),d=a(s=>({...s,"data-slot":r("content"),id:t,role:"region","aria-labelledby":o,hidden:!e}),[t,e,o]),b=a(()=>({...O({},{onClick:p}),id:o,"data-slot":r("trigger"),"aria-controls":t,"aria-expanded":e,"data-expanded":e,disabled:n,"aria-disabled":n}),[t,p,n,e,o]);return P(()=>({isOpen:e,getTriggerProps:b,getContentProps:d,getRootProps:i}),[d,i,b,e])};export{y as a};
@@ -1 +0,0 @@
1
- import{createContext as t,use as l}from"react";var o=t(null),p=()=>{let e=l(o);if(!e)throw new Error("useCollapsibleContext must be used within Collapsible");return e};export{o as a,p as b};
@@ -1 +0,0 @@
1
- import{b as e}from"./chunk-N576RNB6.mjs";import{cloneElement as o}from"react";var p=r=>{let{children:t}=r,{getTriggerProps:l}=e();return o(t,l())};export{p as a};
@@ -1 +0,0 @@
1
- import{b as e}from"./chunk-N576RNB6.mjs";import{AnimatePresence as p,motion as l}from"motion/react";import{jsx as t}from"react/jsx-runtime";var C=o=>{let{children:n,...i}=o,{isOpen:r,getContentProps:s}=e();return t(p,{initial:!1,children:!!r&&t(l.div,{animate:{height:"auto"},exit:{height:0},initial:{height:0},role:"region",transition:{type:"spring",bounce:0,duration:.4},...s(i),children:n})})};export{C as a};