@tecsinapse/cortex-react 1.5.8 → 1.5.10
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.
|
@@ -19,7 +19,9 @@ const Trigger = ({
|
|
|
19
19
|
* Only applied to trigger arrow
|
|
20
20
|
*/
|
|
21
21
|
className,
|
|
22
|
-
onOpen
|
|
22
|
+
onOpen,
|
|
23
|
+
onClose,
|
|
24
|
+
invertedArrow = false
|
|
23
25
|
}) => {
|
|
24
26
|
const { open, toggle } = useAccordionContext();
|
|
25
27
|
if (!floating && !label) {
|
|
@@ -30,6 +32,8 @@ const Trigger = ({
|
|
|
30
32
|
const action = () => {
|
|
31
33
|
if (!open) {
|
|
32
34
|
onOpen?.();
|
|
35
|
+
} else {
|
|
36
|
+
onClose?.();
|
|
33
37
|
}
|
|
34
38
|
toggle?.();
|
|
35
39
|
};
|
|
@@ -59,7 +63,7 @@ const Trigger = ({
|
|
|
59
63
|
className: clsx(
|
|
60
64
|
"text-secondary-medium transition-transform duration-200",
|
|
61
65
|
{
|
|
62
|
-
"rotate-180": open
|
|
66
|
+
"rotate-180": invertedArrow ? !open : open
|
|
63
67
|
}
|
|
64
68
|
)
|
|
65
69
|
}
|
|
@@ -105,9 +109,20 @@ const Root = ({
|
|
|
105
109
|
defaultOpen,
|
|
106
110
|
label,
|
|
107
111
|
floating,
|
|
108
|
-
onOpen
|
|
112
|
+
onOpen,
|
|
113
|
+
invertedArrow,
|
|
114
|
+
onClose
|
|
109
115
|
}) => {
|
|
110
|
-
return /* @__PURE__ */ React.createElement(Face, { defaultOpen }, /* @__PURE__ */ React.createElement(
|
|
116
|
+
return /* @__PURE__ */ React.createElement(Face, { defaultOpen }, /* @__PURE__ */ React.createElement(
|
|
117
|
+
Trigger,
|
|
118
|
+
{
|
|
119
|
+
label,
|
|
120
|
+
floating,
|
|
121
|
+
onOpen,
|
|
122
|
+
onClose,
|
|
123
|
+
invertedArrow
|
|
124
|
+
}
|
|
125
|
+
), /* @__PURE__ */ React.createElement(Content, null, children));
|
|
111
126
|
};
|
|
112
127
|
const Accordion = {
|
|
113
128
|
Face,
|
|
@@ -17,7 +17,9 @@ const Trigger = ({
|
|
|
17
17
|
* Only applied to trigger arrow
|
|
18
18
|
*/
|
|
19
19
|
className,
|
|
20
|
-
onOpen
|
|
20
|
+
onOpen,
|
|
21
|
+
onClose,
|
|
22
|
+
invertedArrow = false
|
|
21
23
|
}) => {
|
|
22
24
|
const { open, toggle } = useAccordionContext();
|
|
23
25
|
if (!floating && !label) {
|
|
@@ -28,6 +30,8 @@ const Trigger = ({
|
|
|
28
30
|
const action = () => {
|
|
29
31
|
if (!open) {
|
|
30
32
|
onOpen?.();
|
|
33
|
+
} else {
|
|
34
|
+
onClose?.();
|
|
31
35
|
}
|
|
32
36
|
toggle?.();
|
|
33
37
|
};
|
|
@@ -57,7 +61,7 @@ const Trigger = ({
|
|
|
57
61
|
className: clsx(
|
|
58
62
|
"text-secondary-medium transition-transform duration-200",
|
|
59
63
|
{
|
|
60
|
-
"rotate-180": open
|
|
64
|
+
"rotate-180": invertedArrow ? !open : open
|
|
61
65
|
}
|
|
62
66
|
)
|
|
63
67
|
}
|
|
@@ -103,9 +107,20 @@ const Root = ({
|
|
|
103
107
|
defaultOpen,
|
|
104
108
|
label,
|
|
105
109
|
floating,
|
|
106
|
-
onOpen
|
|
110
|
+
onOpen,
|
|
111
|
+
invertedArrow,
|
|
112
|
+
onClose
|
|
107
113
|
}) => {
|
|
108
|
-
return /* @__PURE__ */ React__default.createElement(Face, { defaultOpen }, /* @__PURE__ */ React__default.createElement(
|
|
114
|
+
return /* @__PURE__ */ React__default.createElement(Face, { defaultOpen }, /* @__PURE__ */ React__default.createElement(
|
|
115
|
+
Trigger,
|
|
116
|
+
{
|
|
117
|
+
label,
|
|
118
|
+
floating,
|
|
119
|
+
onOpen,
|
|
120
|
+
onClose,
|
|
121
|
+
invertedArrow
|
|
122
|
+
}
|
|
123
|
+
), /* @__PURE__ */ React__default.createElement(Content, null, children));
|
|
109
124
|
};
|
|
110
125
|
const Accordion = {
|
|
111
126
|
Face,
|
|
@@ -5,6 +5,8 @@ interface AccordionProps {
|
|
|
5
5
|
label?: string;
|
|
6
6
|
floating?: boolean;
|
|
7
7
|
onOpen?: () => void;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
invertedArrow?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare const useAccordionContext: () => {
|
|
10
12
|
open: boolean;
|
|
@@ -12,8 +14,8 @@ export declare const useAccordionContext: () => {
|
|
|
12
14
|
};
|
|
13
15
|
export declare const Accordion: {
|
|
14
16
|
Face: ({ children, defaultOpen, }: Pick<AccordionProps, 'children' | 'defaultOpen'>) => JSX.Element;
|
|
15
|
-
Root: ({ children, defaultOpen, label, floating, onOpen, }: AccordionProps) => JSX.Element;
|
|
16
|
-
Trigger: ({ label, floating, className, onOpen, }: Pick<AccordionProps, 'floating' | 'label' | 'onOpen'> & {
|
|
17
|
+
Root: ({ children, defaultOpen, label, floating, onOpen, invertedArrow, onClose, }: AccordionProps) => JSX.Element;
|
|
18
|
+
Trigger: ({ label, floating, className, onOpen, onClose, invertedArrow, }: Pick<AccordionProps, 'floating' | 'label' | 'onOpen' | 'onClose' | 'invertedArrow'> & {
|
|
17
19
|
className?: string;
|
|
18
20
|
}) => JSX.Element;
|
|
19
21
|
Content: ({ children }: Pick<AccordionProps, 'children'>) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.10",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react-dom": ">=18.0.0",
|
|
47
47
|
"tailwind": ">=3.3.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d19ecc9756e227a3d87e0fc69109b6f9bd2bb28f"
|
|
50
50
|
}
|