@jamsrui/accordion 0.0.10 → 0.0.12
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/{accordion-BW3IFpcC.d.mts → accordion-ZPzXJf-I.d.mts} +16 -16
- package/dist/accordion-config.d.mts +1 -1
- package/dist/accordion-context.d.mts +1 -1
- package/dist/accordion-item.mjs +1 -1
- package/dist/accordion.d.mts +1 -1
- package/dist/chunk-XEIFPPNA.mjs +1 -0
- package/dist/{chunk-GGEGJUDM.mjs → chunk-YYWGBE52.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/use-accordion-item.mjs +1 -1
- package/dist/use-accordion.d.mts +1 -1
- package/package.json +5 -5
- package/dist/chunk-J3U5BOWN.mjs +0 -1
|
@@ -27,69 +27,69 @@ declare const useAccordion: (props: useAccordion.Props) => {
|
|
|
27
27
|
classNames: SlotsToClassNames<"header" | "content" | "root" | "item" | "contentWrapper" | "indicator" | "headingContent" | "trigger"> | undefined;
|
|
28
28
|
styles: {
|
|
29
29
|
root: (slotProps?: ({
|
|
30
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
30
31
|
variant?: "light" | "splitted" | undefined;
|
|
31
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
32
32
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
33
33
|
item: (slotProps?: ({
|
|
34
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
34
35
|
variant?: "light" | "splitted" | undefined;
|
|
35
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
36
36
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
37
37
|
header: (slotProps?: ({
|
|
38
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
38
39
|
variant?: "light" | "splitted" | undefined;
|
|
39
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
40
40
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
41
41
|
trigger: (slotProps?: ({
|
|
42
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
42
43
|
variant?: "light" | "splitted" | undefined;
|
|
43
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
44
44
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
45
45
|
content: (slotProps?: ({
|
|
46
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
46
47
|
variant?: "light" | "splitted" | undefined;
|
|
47
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
48
48
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
49
49
|
contentWrapper: (slotProps?: ({
|
|
50
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
50
51
|
variant?: "light" | "splitted" | undefined;
|
|
51
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
52
52
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
53
53
|
indicator: (slotProps?: ({
|
|
54
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
54
55
|
variant?: "light" | "splitted" | undefined;
|
|
55
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
56
56
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
57
57
|
headingContent: (slotProps?: ({
|
|
58
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
58
59
|
variant?: "light" | "splitted" | undefined;
|
|
59
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
60
60
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
61
61
|
} & {
|
|
62
62
|
root: (slotProps?: ({
|
|
63
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
63
64
|
variant?: "light" | "splitted" | undefined;
|
|
64
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
65
65
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
66
66
|
item: (slotProps?: ({
|
|
67
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
67
68
|
variant?: "light" | "splitted" | undefined;
|
|
68
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
69
69
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
70
70
|
header: (slotProps?: ({
|
|
71
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
71
72
|
variant?: "light" | "splitted" | undefined;
|
|
72
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
73
73
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
74
74
|
trigger: (slotProps?: ({
|
|
75
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
75
76
|
variant?: "light" | "splitted" | undefined;
|
|
76
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
77
77
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
78
78
|
content: (slotProps?: ({
|
|
79
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
79
80
|
variant?: "light" | "splitted" | undefined;
|
|
80
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
81
81
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
82
82
|
contentWrapper: (slotProps?: ({
|
|
83
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
83
84
|
variant?: "light" | "splitted" | undefined;
|
|
84
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
85
85
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
86
86
|
indicator: (slotProps?: ({
|
|
87
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
87
88
|
variant?: "light" | "splitted" | undefined;
|
|
88
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
89
89
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
90
90
|
headingContent: (slotProps?: ({
|
|
91
|
+
radius?: "none" | "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | undefined;
|
|
91
92
|
variant?: "light" | "splitted" | undefined;
|
|
92
|
-
radius?: "md" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "full" | "none" | undefined;
|
|
93
93
|
} & _jamsrui_utils.ClassProp<tailwind_merge.ClassNameValue>) | undefined) => string;
|
|
94
94
|
} & {};
|
|
95
95
|
handleAccordionOpen: (idx: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { GlobalConfigProps } from '@jamsrui/core';
|
|
3
|
-
import { A as Accordion } from './accordion-
|
|
3
|
+
import { A as Accordion } from './accordion-ZPzXJf-I.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@jamsrui/utils';
|
|
6
6
|
import 'tailwind-merge';
|
package/dist/accordion-item.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-YYWGBE52.mjs";import"./chunk-XEIFPPNA.mjs";import"./chunk-MXQSODZO.mjs";import"./chunk-ODJOF4YS.mjs";export{a as AccordionItem};
|
package/dist/accordion.d.mts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as h}from"./chunk-MXQSODZO.mjs";import{useCallback as c,useId as y,useMemo as x}from"react";import{useCompositeItem as H}from"@jamsrui/composite";import{cn as i,dataAttrDev as s,mergeProps as G}from"@jamsrui/utils";var U=W=>{let{styles:t,classNames:o,handleAccordionOpen:g,value:P,elementRefs:R,slotProps:n}=h(),{index:v}=H({}),D=(v+1).toString(),{value:d=D,isDisabled:r,indicator:N,...p}=W,a=x(()=>P.includes(d),[P,d]),m=y(),l=y(),C=c(e=>({...p,...e,"data-slot":s("item"),className:t.item({className:i(o?.item,p.className,e.className)}),"aria-disabled":r,"data-disabled":r}),[o?.item,p,r,t]),A=c(e=>({...e,"data-slot":s("content-wrapper"),className:t.contentWrapper({className:i(o?.contentWrapper,e.className)})}),[o?.contentWrapper,t]),u=c(e=>({...e,"data-slot":s("content"),className:t.content({className:i(o?.content,e.className)}),role:"region","aria-labelledby":m,id:l}),[o?.content,l,t,m]),I=c(e=>({...G(e,{onClick:()=>{g(d)},disabled:r,"aria-disabled":r,"data-disabled":r}),"data-slot":s("trigger"),className:t.trigger({className:i(o?.trigger,e.className)}),id:m,"aria-expanded":a,"aria-controls":l}),[r,t,o?.trigger,m,a,l,g,d]),f=c(e=>({...n?.trigger,...e,"data-slot":s("indicator"),"data-open":a,className:t.indicator({className:i(n?.indicator?.className,o?.indicator,e.className)})}),[o?.indicator,a,n?.indicator?.className,n?.trigger,t]),b=c(e=>({...G(n?.headingContent,e),"data-slot":s("heading-content"),className:t.headingContent({className:i(n?.headingContent?.className,o?.headingContent,e.className)})}),[o?.headingContent,n?.headingContent,t]);return x(()=>({getItemProps:C,getContentProps:u,getTriggerProps:I,getContentWrapperProps:A,getIndicatorProps:f,getHeadingContentProps:b,isOpen:a,indicator:N,isDisabled:r}),[C,u,I,A,f,b,a,N,r])};export{U as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
1
|
+
import{a as t}from"./chunk-XEIFPPNA.mjs";import{b as r}from"./chunk-MXQSODZO.mjs";import{a as e}from"./chunk-ODJOF4YS.mjs";import{useRenderElement as p}from"@jamsrui/hooks";import{mergeProps as d}from"@jamsrui/utils";import{jsx as P}from"react/jsx-runtime";var C=c=>{let n=r(),m=d(n.slotProps?.item??{},c),o=t(m),{getItemProps:s}=o,i=p("div",{props:[s({})]});return P(e,{ctx:o,children:i})};export{C as a};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Accordion } from './accordion-
|
|
1
|
+
export { A as Accordion } from './accordion-ZPzXJf-I.mjs';
|
|
2
2
|
export { AccordionConfig, useAccordionConfig } from './accordion-config.mjs';
|
|
3
3
|
export { AccordionContent } from './accordion-content.mjs';
|
|
4
4
|
export { A as AccordionItem } from './accordion-item-CjrslTeD.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as n}from"./chunk-UBUBYUEY.mjs";import{a as i}from"./chunk-VSIS7MHA.mjs";import"./chunk-JT5VCZTC.mjs";import"./chunk-WQE6QIET.mjs";import{a as o,b as r}from"./chunk-VJHN34FK.mjs";import{a as e}from"./chunk-773TRCOO.mjs";import"./chunk-EW4H5PY5.mjs";import"./chunk-AZTA4BMJ.mjs";import"./chunk-N7FXYTDE.mjs";import"./chunk-3KX5ZPFZ.mjs";import{a as t}from"./chunk-
|
|
1
|
+
"use client";import{a as n}from"./chunk-UBUBYUEY.mjs";import{a as i}from"./chunk-VSIS7MHA.mjs";import"./chunk-JT5VCZTC.mjs";import"./chunk-WQE6QIET.mjs";import{a as o,b as r}from"./chunk-VJHN34FK.mjs";import{a as e}from"./chunk-773TRCOO.mjs";import"./chunk-EW4H5PY5.mjs";import"./chunk-AZTA4BMJ.mjs";import"./chunk-N7FXYTDE.mjs";import"./chunk-3KX5ZPFZ.mjs";import{a as t}from"./chunk-YYWGBE52.mjs";import"./chunk-XEIFPPNA.mjs";import"./chunk-MXQSODZO.mjs";import{c}from"./chunk-ODJOF4YS.mjs";export{i as Accordion,o as AccordionConfig,e as AccordionContent,t as AccordionItem,n as AccordionTrigger,r as useAccordionConfig,c as useAccordionItemState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-XEIFPPNA.mjs";import"./chunk-MXQSODZO.mjs";export{a as useAccordionItem};
|
package/dist/use-accordion.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
import '@jamsrui/utils';
|
|
3
3
|
import 'tailwind-merge';
|
|
4
|
-
export { u as useAccordion } from './accordion-
|
|
4
|
+
export { u as useAccordion } from './accordion-ZPzXJf-I.mjs';
|
|
5
5
|
import './accordion-content.mjs';
|
|
6
6
|
import './accordion-content-wrapper.mjs';
|
|
7
7
|
import './accordion-heading-content.mjs';
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/accordion",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"motion": ">=12",
|
|
6
6
|
"react": ">=19",
|
|
7
7
|
"react-dom": ">=19"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@jamsrui/
|
|
11
|
-
"@jamsrui/composite": "^0.0.
|
|
12
|
-
"@jamsrui/
|
|
13
|
-
"@jamsrui/utils": "^0.0.
|
|
10
|
+
"@jamsrui/hooks": "^0.0.12",
|
|
11
|
+
"@jamsrui/composite": "^0.0.5",
|
|
12
|
+
"@jamsrui/core": "^0.0.10",
|
|
13
|
+
"@jamsrui/utils": "^0.0.12"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
package/dist/chunk-J3U5BOWN.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as k}from"./chunk-MXQSODZO.mjs";import{useCallback as I,useId as G,useMemo as E}from"react";import{useCallback as b,useEffect as M,useId as U,useMemo as j,useRef as z,useState as F}from"react";import{dataAttr as K}from"@jamsrui/utils";import{createContext as T,use as W}from"react";var L=T(null),D=()=>{let u=W(L);if(!u)throw new Error("useCompositeContext must be used within a Composite");return u};var R=u=>{let{id:s,isDisabled:n=!1}=u,e=D(),y=U(),h=z(null),[c,N]=F(-1),g=s??y;M(()=>{let{index:t}=e.registerItem({id:g,ref:h.current,isDisabled:n});return N(t),()=>e.unregisterItem(g)},[e,n,g]);let i=c,a=i===e.activeIndex,l=b(t=>{let m=e.items.current[t]?.ref;e.virtual||m?.focus()},[e.items,e.virtual]),f=b(t=>{if(e.virtual)return;let m=e.dir==="rtl",p=e.orientation==="horizontal"||e.orientation==="both",v=e.orientation==="vertical"||e.orientation==="both",r=i;t.key==="ArrowRight"&&p&&!m||t.key==="ArrowDown"&&v||t.key==="ArrowLeft"&&p&&m?(t.preventDefault(),r=e.moveNext(i),console.log(r),e.setActiveIndex(r),l(r)):t.key==="ArrowLeft"&&p&&!m||t.key==="ArrowUp"&&v||t.key==="ArrowRight"&&p&&m?(t.preventDefault(),r=e.movePrev(i),e.setActiveIndex(r),l(r)):t.key==="Home"||t.key==="PageUp"?(t.preventDefault(),r=e.moveFirst(),e.setActiveIndex(r),l(r)):(t.key==="End"||t.key==="PageDown")&&(t.preventDefault(),r=e.moveLast(),e.setActiveIndex(r),l(r))},[e,l,i]),d=b(()=>{e.setActiveIndex(i)},[e,i]),x=j(()=>e.virtual?{tabIndex:-1,"aria-selected":K(a)}:{tabIndex:a?0:-1,onKeyDown:f,onFocus:d},[e.virtual,a,d,f]),C=b(t=>{h.current=t},[]);return{props:{...x,id:g,"data-index":i,ref:C},index:i}};import{cn as P,dataAttrDev as A,mergeProps as H}from"@jamsrui/utils";var _=u=>{let{styles:s,classNames:n,handleAccordionOpen:e,value:y,elementRefs:h,slotProps:c}=k(),{index:N}=R({});console.log(N);let g=(N+1).toString(),{value:i=g,isDisabled:a,indicator:l,...f}=u,d=E(()=>y.includes(i),[y,i]),x=G(),C=G(),t=I(o=>({...f,...o,"data-slot":A("item"),className:s.item({className:P(n?.item,f.className,o.className)}),"aria-disabled":a,"data-disabled":a}),[n?.item,f,a,s]),m=I(o=>({...o,"data-slot":A("content-wrapper"),className:s.contentWrapper({className:P(n?.contentWrapper,o.className)})}),[n?.contentWrapper,s]),p=I(o=>({...o,"data-slot":A("content"),className:s.content({className:P(n?.content,o.className)}),role:"region","aria-labelledby":x,id:C}),[n?.content,C,s,x]),v=I(o=>({...H(o,{onClick:()=>{e(i)},disabled:a,"aria-disabled":a,"data-disabled":a}),"data-slot":A("trigger"),className:s.trigger({className:P(n?.trigger,o.className)}),id:x,"aria-expanded":d,"aria-controls":C}),[a,s,n?.trigger,x,d,C,e,i]),r=I(o=>({...c?.trigger,...o,"data-slot":A("indicator"),"data-open":d,className:s.indicator({className:P(c?.indicator?.className,n?.indicator,o.className)})}),[n?.indicator,d,c?.indicator?.className,c?.trigger,s]),w=I(o=>({...H(c?.headingContent,o),"data-slot":A("heading-content"),className:s.headingContent({className:P(c?.headingContent?.className,n?.headingContent,o.className)})}),[n?.headingContent,c?.headingContent,s]);return E(()=>({getItemProps:t,getContentProps:p,getTriggerProps:v,getContentWrapperProps:m,getIndicatorProps:r,getHeadingContentProps:w,isOpen:d,indicator:l,isDisabled:a}),[t,p,v,m,r,w,d,l,a])};export{_ as a};
|