@bitrise/bitkit 10.11.0-alpha-chakra.1 → 10.11.0-alpha-chakra.2
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit",
|
|
3
3
|
"description": "Bitrise React component library",
|
|
4
|
-
"version": "10.11.0-alpha-chakra.
|
|
4
|
+
"version": "10.11.0-alpha-chakra.2",
|
|
5
5
|
"repository": "git@github.com:bitrise-io/bitkit.git",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"license": "UNLICENSED",
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
export interface AccordionProps extends Omit<ChakraAccordionProps, 'onChange'> {
|
|
10
10
|
colorScheme?: 'white' | 'gray';
|
|
11
|
-
onChange
|
|
11
|
+
onChange?: (ids: string[], indexes: number[]) => void;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const getItemIds = (props: AccordionProps) => {
|
|
@@ -26,11 +26,13 @@ const Accordion = (props: AccordionProps) => {
|
|
|
26
26
|
const itemIds = getItemIds(props);
|
|
27
27
|
|
|
28
28
|
const onAccordionChange = (indexes: ExpandedIndex) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if (onChange) {
|
|
30
|
+
const indexArray = Object.values(indexes).sort();
|
|
31
|
+
onChange(
|
|
32
|
+
indexArray.map((i: number) => itemIds[i]),
|
|
33
|
+
indexArray,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
return (
|