@fluentui/react-accordion 0.0.0-nightly-20230427-0418.1 → 0.0.0-nightly-20230501-0418.1
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.json +19 -19
- package/CHANGELOG.md +12 -12
- package/package.json +9 -9
- package/dist/index.d.ts +0 -265
- package/lib/Accordion.js +0 -2
- package/lib/Accordion.js.map +0 -1
- package/lib/AccordionHeader.js +0 -2
- package/lib/AccordionHeader.js.map +0 -1
- package/lib/AccordionItem.js +0 -2
- package/lib/AccordionItem.js.map +0 -1
- package/lib/AccordionPanel.js +0 -2
- package/lib/AccordionPanel.js.map +0 -1
- package/lib/components/Accordion/Accordion.js +0 -18
- package/lib/components/Accordion/Accordion.js.map +0 -1
- package/lib/components/Accordion/Accordion.types.js +0 -2
- package/lib/components/Accordion/Accordion.types.js.map +0 -1
- package/lib/components/Accordion/AccordionContext.js +0 -11
- package/lib/components/Accordion/AccordionContext.js.map +0 -1
- package/lib/components/Accordion/index.js +0 -8
- package/lib/components/Accordion/index.js.map +0 -1
- package/lib/components/Accordion/renderAccordion.js +0 -16
- package/lib/components/Accordion/renderAccordion.js.map +0 -1
- package/lib/components/Accordion/useAccordion.js +0 -94
- package/lib/components/Accordion/useAccordion.js.map +0 -1
- package/lib/components/Accordion/useAccordionContextValues.js +0 -19
- package/lib/components/Accordion/useAccordionContextValues.js.map +0 -1
- package/lib/components/Accordion/useAccordionStyles.js +0 -9
- package/lib/components/Accordion/useAccordionStyles.js.map +0 -1
- package/lib/components/AccordionHeader/AccordionHeader.js +0 -19
- package/lib/components/AccordionHeader/AccordionHeader.js.map +0 -1
- package/lib/components/AccordionHeader/AccordionHeader.types.js +0 -2
- package/lib/components/AccordionHeader/AccordionHeader.types.js.map +0 -1
- package/lib/components/AccordionHeader/AccordionHeaderContext.js +0 -11
- package/lib/components/AccordionHeader/AccordionHeaderContext.js.map +0 -1
- package/lib/components/AccordionHeader/index.js +0 -7
- package/lib/components/AccordionHeader/index.js.map +0 -1
- package/lib/components/AccordionHeader/renderAccordionHeader.js +0 -16
- package/lib/components/AccordionHeader/renderAccordionHeader.js.map +0 -1
- package/lib/components/AccordionHeader/useAccordionHeader.js +0 -94
- package/lib/components/AccordionHeader/useAccordionHeader.js.map +0 -1
- package/lib/components/AccordionHeader/useAccordionHeaderContextValues.js +0 -19
- package/lib/components/AccordionHeader/useAccordionHeaderContextValues.js.map +0 -1
- package/lib/components/AccordionHeader/useAccordionHeaderStyles.js +0 -172
- package/lib/components/AccordionHeader/useAccordionHeaderStyles.js.map +0 -1
- package/lib/components/AccordionItem/AccordionItem.js +0 -18
- package/lib/components/AccordionItem/AccordionItem.js.map +0 -1
- package/lib/components/AccordionItem/AccordionItem.types.js +0 -2
- package/lib/components/AccordionItem/AccordionItem.types.js.map +0 -1
- package/lib/components/AccordionItem/AccordionItemContext.js +0 -12
- package/lib/components/AccordionItem/AccordionItemContext.js.map +0 -1
- package/lib/components/AccordionItem/index.js +0 -8
- package/lib/components/AccordionItem/index.js.map +0 -1
- package/lib/components/AccordionItem/renderAccordionItem.js +0 -16
- package/lib/components/AccordionItem/renderAccordionItem.js.map +0 -1
- package/lib/components/AccordionItem/useAccordionItem.js +0 -32
- package/lib/components/AccordionItem/useAccordionItem.js.map +0 -1
- package/lib/components/AccordionItem/useAccordionItemContextValues.js +0 -17
- package/lib/components/AccordionItem/useAccordionItemContextValues.js.map +0 -1
- package/lib/components/AccordionItem/useAccordionItemStyles.js +0 -9
- package/lib/components/AccordionItem/useAccordionItemStyles.js.map +0 -1
- package/lib/components/AccordionPanel/AccordionPanel.js +0 -16
- package/lib/components/AccordionPanel/AccordionPanel.js.map +0 -1
- package/lib/components/AccordionPanel/AccordionPanel.types.js +0 -2
- package/lib/components/AccordionPanel/AccordionPanel.types.js.map +0 -1
- package/lib/components/AccordionPanel/index.js +0 -6
- package/lib/components/AccordionPanel/index.js.map +0 -1
- package/lib/components/AccordionPanel/renderAccordionPanel.js +0 -13
- package/lib/components/AccordionPanel/renderAccordionPanel.js.map +0 -1
- package/lib/components/AccordionPanel/useAccordionPanel.js +0 -33
- package/lib/components/AccordionPanel/useAccordionPanel.js.map +0 -1
- package/lib/components/AccordionPanel/useAccordionPanelStyles.js +0 -25
- package/lib/components/AccordionPanel/useAccordionPanelStyles.js.map +0 -1
- package/lib/index.js +0 -5
- package/lib/index.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@fluentui/react-accordion",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui/react-accordion_v0.0.0-nightly-
|
|
7
|
-
"version": "0.0.0-nightly-
|
|
5
|
+
"date": "Mon, 01 May 2023 04:24:11 GMT",
|
|
6
|
+
"tag": "@fluentui/react-accordion_v0.0.0-nightly-20230501-0418.1",
|
|
7
|
+
"version": "0.0.0-nightly-20230501-0418.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -16,50 +16,50 @@
|
|
|
16
16
|
{
|
|
17
17
|
"author": "beachball",
|
|
18
18
|
"package": "@fluentui/react-accordion",
|
|
19
|
-
"comment": "Bump @fluentui/react-aria to v0.0.0-nightly-
|
|
20
|
-
"commit": "
|
|
19
|
+
"comment": "Bump @fluentui/react-aria to v0.0.0-nightly-20230501-0418.1",
|
|
20
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"author": "beachball",
|
|
24
24
|
"package": "@fluentui/react-accordion",
|
|
25
|
-
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-
|
|
26
|
-
"commit": "
|
|
25
|
+
"comment": "Bump @fluentui/react-context-selector to v0.0.0-nightly-20230501-0418.1",
|
|
26
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"author": "beachball",
|
|
30
30
|
"package": "@fluentui/react-accordion",
|
|
31
|
-
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
|
32
|
-
"commit": "
|
|
31
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230501-0418.1",
|
|
32
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"author": "beachball",
|
|
36
36
|
"package": "@fluentui/react-accordion",
|
|
37
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
|
38
|
-
"commit": "
|
|
37
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230501-0418.1",
|
|
38
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"author": "beachball",
|
|
42
42
|
"package": "@fluentui/react-accordion",
|
|
43
|
-
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-
|
|
44
|
-
"commit": "
|
|
43
|
+
"comment": "Bump @fluentui/react-tabster to v0.0.0-nightly-20230501-0418.1",
|
|
44
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"author": "beachball",
|
|
48
48
|
"package": "@fluentui/react-accordion",
|
|
49
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
|
50
|
-
"commit": "
|
|
49
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230501-0418.1",
|
|
50
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"author": "beachball",
|
|
54
54
|
"package": "@fluentui/react-accordion",
|
|
55
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
56
|
-
"commit": "
|
|
55
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230501-0418.1",
|
|
56
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"author": "beachball",
|
|
60
60
|
"package": "@fluentui/react-accordion",
|
|
61
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
62
|
-
"commit": "
|
|
61
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230501-0418.1",
|
|
62
|
+
"commit": "ec7f7770aa9dd65ad47721639ad0c5d238d9e037"
|
|
63
63
|
}
|
|
64
64
|
]
|
|
65
65
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-accordion
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 01 May 2023 04:24:11 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20230501-0418.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v0.0.0-nightly-20230501-0418.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.1.10..@fluentui/react-accordion_v0.0.0-nightly-
|
|
9
|
+
Mon, 01 May 2023 04:24:11 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-accordion_v9.1.10..@fluentui/react-accordion_v0.0.0-nightly-20230501-0418.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui/react-aria to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui/react-context-selector to v0.0.0-nightly-
|
|
17
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
|
18
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
|
19
|
-
- Bump @fluentui/react-tabster to v0.0.0-nightly-
|
|
20
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
|
21
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
|
22
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui/react-aria to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
16
|
+
- Bump @fluentui/react-context-selector to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
17
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
18
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
19
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
20
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
21
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
22
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230501-0418.1 ([commit](https://github.com/microsoft/fluentui/commit/ec7f7770aa9dd65ad47721639ad0c5d238d9e037) by beachball)
|
|
23
23
|
|
|
24
24
|
## [9.1.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-accordion_v9.1.10)
|
|
25
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-accordion",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20230501-0418.1",
|
|
4
4
|
"description": "Fluent UI accordion component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
|
29
29
|
"@fluentui/react-conformance": "*",
|
|
30
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
|
30
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230501-0418.1",
|
|
31
31
|
"@fluentui/scripts-api-extractor": "*",
|
|
32
32
|
"@fluentui/scripts-tasks": "*"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fluentui/react-aria": "0.0.0-nightly-
|
|
36
|
-
"@fluentui/react-context-selector": "0.0.0-nightly-
|
|
35
|
+
"@fluentui/react-aria": "0.0.0-nightly-20230501-0418.1",
|
|
36
|
+
"@fluentui/react-context-selector": "0.0.0-nightly-20230501-0418.1",
|
|
37
37
|
"@fluentui/react-icons": "^2.0.196",
|
|
38
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-
|
|
39
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-
|
|
40
|
-
"@fluentui/react-tabster": "0.0.0-nightly-
|
|
41
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
|
42
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
|
38
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20230501-0418.1",
|
|
39
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20230501-0418.1",
|
|
40
|
+
"@fluentui/react-tabster": "0.0.0-nightly-20230501-0418.1",
|
|
41
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230501-0418.1",
|
|
42
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230501-0418.1",
|
|
43
43
|
"@griffel/react": "^1.5.2",
|
|
44
44
|
"@swc/helpers": "^0.4.14"
|
|
45
45
|
},
|
package/dist/index.d.ts
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
import type { ARIAButtonSlotProps } from '@fluentui/react-aria';
|
|
4
|
-
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
5
|
-
import type { ComponentState } from '@fluentui/react-utilities';
|
|
6
|
-
import { ContextSelector } from '@fluentui/react-context-selector';
|
|
7
|
-
import { FC } from 'react';
|
|
8
|
-
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
9
|
-
import { Provider } from 'react';
|
|
10
|
-
import { ProviderProps } from 'react';
|
|
11
|
-
import * as React_2 from 'react';
|
|
12
|
-
import type { Slot } from '@fluentui/react-utilities';
|
|
13
|
-
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Define a styled Accordion, using the `useAccordion_unstable` and `useAccordionStyles_unstable` hooks.
|
|
17
|
-
*/
|
|
18
|
-
export declare const Accordion: ForwardRefComponent<AccordionProps>;
|
|
19
|
-
|
|
20
|
-
export declare const accordionClassNames: SlotClassNames<AccordionSlots>;
|
|
21
|
-
|
|
22
|
-
export declare type AccordionContextValue = Required<Pick<AccordionProps, 'collapsible'>> & Pick<AccordionProps, 'navigation'> & {
|
|
23
|
-
/**
|
|
24
|
-
* The list of opened panels by index
|
|
25
|
-
*/
|
|
26
|
-
openItems: AccordionItemValue[];
|
|
27
|
-
/**
|
|
28
|
-
* Callback used by AccordionItem to request a change on it's own opened state
|
|
29
|
-
* Should be used to toggle AccordionItem
|
|
30
|
-
*/
|
|
31
|
-
requestToggle: (event: AccordionToggleEvent, data: AccordionToggleData) => void;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export declare type AccordionContextValues = {
|
|
35
|
-
accordion: AccordionContextValue;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Define a styled AccordionHeader, using the `useAccordionHeader_unstable` and `useAccordionHeaderStyles_unstable`
|
|
40
|
-
* hooks.
|
|
41
|
-
*/
|
|
42
|
-
export declare const AccordionHeader: ForwardRefComponent<AccordionHeaderProps>;
|
|
43
|
-
|
|
44
|
-
export declare const accordionHeaderClassNames: SlotClassNames<AccordionHeaderSlots>;
|
|
45
|
-
|
|
46
|
-
export declare type AccordionHeaderContextValue = Required<Pick<AccordionHeaderProps, 'expandIconPosition' | 'size'>> & {
|
|
47
|
-
disabled: boolean;
|
|
48
|
-
open: boolean;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export declare type AccordionHeaderContextValues = {
|
|
52
|
-
accordionHeader: AccordionHeaderContextValue;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export declare type AccordionHeaderExpandIconPosition = 'start' | 'end';
|
|
56
|
-
|
|
57
|
-
export declare type AccordionHeaderProps = ComponentProps<Partial<AccordionHeaderSlots>> & {
|
|
58
|
-
/**
|
|
59
|
-
* The position of the expand icon slot in heading.
|
|
60
|
-
*/
|
|
61
|
-
expandIconPosition?: AccordionHeaderExpandIconPosition;
|
|
62
|
-
/**
|
|
63
|
-
* Indicates if the AccordionHeader should be rendered inline.
|
|
64
|
-
*/
|
|
65
|
-
inline?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Size of spacing in the heading.
|
|
68
|
-
*/
|
|
69
|
-
size?: AccordionHeaderSize;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export declare type AccordionHeaderSize = 'small' | 'medium' | 'large' | 'extra-large';
|
|
73
|
-
|
|
74
|
-
export declare type AccordionHeaderSlots = {
|
|
75
|
-
/**
|
|
76
|
-
* The element wrapping the button. By default this is a div, but can be a heading.
|
|
77
|
-
*/
|
|
78
|
-
root: Slot<'div', 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>;
|
|
79
|
-
/**
|
|
80
|
-
* The component to be used as button in heading
|
|
81
|
-
*/
|
|
82
|
-
button: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;
|
|
83
|
-
/**
|
|
84
|
-
* Expand icon slot rendered before (or after) children content in heading.
|
|
85
|
-
*/
|
|
86
|
-
expandIcon: Slot<'span'>;
|
|
87
|
-
/**
|
|
88
|
-
* Expand icon slot rendered before (or after) children content in heading.
|
|
89
|
-
*/
|
|
90
|
-
icon?: Slot<'div'>;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export declare type AccordionHeaderState = ComponentState<AccordionHeaderSlots> & Required<Pick<AccordionHeaderProps, 'inline'>> & AccordionHeaderContextValue;
|
|
94
|
-
|
|
95
|
-
export declare type AccordionIndex = number | number[];
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Define a styled AccordionItem, using the `useAccordionItem_unstable` and `useAccordionItemStyles_unstable` hooks.
|
|
99
|
-
*/
|
|
100
|
-
export declare const AccordionItem: ForwardRefComponent<AccordionItemProps>;
|
|
101
|
-
|
|
102
|
-
export declare const accordionItemClassNames: SlotClassNames<AccordionItemSlots>;
|
|
103
|
-
|
|
104
|
-
export declare type AccordionItemContextValue = Required<Pick<AccordionItemProps, 'disabled'>> & {
|
|
105
|
-
onHeaderClick(ev: React_2.MouseEvent | React_2.KeyboardEvent): void;
|
|
106
|
-
open: boolean;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export declare type AccordionItemContextValues = {
|
|
110
|
-
accordionItem: AccordionItemContextValue;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export declare type AccordionItemProps = ComponentProps<AccordionItemSlots> & {
|
|
114
|
-
/**
|
|
115
|
-
* Disables opening/closing of panel.
|
|
116
|
-
*/
|
|
117
|
-
disabled?: boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Required value that identifies this item inside an Accordion component.
|
|
120
|
-
*/
|
|
121
|
-
value: AccordionItemValue;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export declare const AccordionItemProvider: React_2.Provider<AccordionItemContextValue>;
|
|
125
|
-
|
|
126
|
-
export declare type AccordionItemSlots = {
|
|
127
|
-
root: Slot<'div'>;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export declare type AccordionItemState = ComponentState<AccordionItemSlots> & AccordionItemContextValue;
|
|
131
|
-
|
|
132
|
-
export declare type AccordionItemValue = unknown;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Define a styled AccordionPanel, using the `useAccordionPanel_unstable` and `useAccordionPanelStyles_unstable` hooks.
|
|
136
|
-
*/
|
|
137
|
-
export declare const AccordionPanel: ForwardRefComponent<AccordionPanelProps>;
|
|
138
|
-
|
|
139
|
-
export declare const accordionPanelClassNames: SlotClassNames<AccordionPanelSlots>;
|
|
140
|
-
|
|
141
|
-
export declare type AccordionPanelProps = ComponentProps<AccordionPanelSlots>;
|
|
142
|
-
|
|
143
|
-
export declare type AccordionPanelSlots = {
|
|
144
|
-
root: Slot<'div'>;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export declare type AccordionPanelState = ComponentState<AccordionPanelSlots> & {
|
|
148
|
-
/**
|
|
149
|
-
* Internal open state, provided by context.
|
|
150
|
-
*/
|
|
151
|
-
open: boolean;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export declare type AccordionProps = ComponentProps<AccordionSlots> & {
|
|
155
|
-
/**
|
|
156
|
-
* Default value for the uncontrolled state of the panel.
|
|
157
|
-
*/
|
|
158
|
-
defaultOpenItems?: AccordionItemValue | AccordionItemValue[];
|
|
159
|
-
/**
|
|
160
|
-
* Indicates if Accordion support multiple Panels closed at the same time.
|
|
161
|
-
*/
|
|
162
|
-
collapsible?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Indicates if Accordion support multiple Panels opened at the same time.
|
|
165
|
-
*/
|
|
166
|
-
multiple?: boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Indicates if keyboard navigation is available and gives two options, linear or circular navigation.
|
|
169
|
-
*/
|
|
170
|
-
navigation?: 'linear' | 'circular';
|
|
171
|
-
/**
|
|
172
|
-
* Callback to be called when the opened items change.
|
|
173
|
-
*/
|
|
174
|
-
onToggle?: AccordionToggleEventHandler;
|
|
175
|
-
/**
|
|
176
|
-
* Controls the state of the panel.
|
|
177
|
-
*/
|
|
178
|
-
openItems?: AccordionItemValue | AccordionItemValue[];
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export declare const AccordionProvider: Provider<AccordionContextValue> & FC<ProviderProps<AccordionContextValue>>;
|
|
182
|
-
|
|
183
|
-
export declare type AccordionSlots = {
|
|
184
|
-
root: Slot<'div'>;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export declare type AccordionState = ComponentState<AccordionSlots> & AccordionContextValue;
|
|
188
|
-
|
|
189
|
-
export declare type AccordionToggleData = {
|
|
190
|
-
value: AccordionItemValue;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export declare type AccordionToggleEvent<E = HTMLElement> = React_2.MouseEvent<E> | React_2.KeyboardEvent<E>;
|
|
194
|
-
|
|
195
|
-
export declare type AccordionToggleEventHandler = (event: AccordionToggleEvent, data: AccordionToggleData) => void;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Function that renders the final JSX of the component
|
|
199
|
-
*/
|
|
200
|
-
export declare const renderAccordion_unstable: (state: AccordionState, contextValues: AccordionContextValues) => JSX.Element;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Function that renders the final JSX of the component
|
|
204
|
-
*/
|
|
205
|
-
export declare const renderAccordionHeader_unstable: (state: AccordionHeaderState, contextValues: AccordionHeaderContextValues) => JSX.Element;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Function that renders the final JSX of the component
|
|
209
|
-
*/
|
|
210
|
-
export declare const renderAccordionItem_unstable: (state: AccordionItemState, contextValues: AccordionItemContextValues) => JSX.Element;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Function that renders the final JSX of the component
|
|
214
|
-
*/
|
|
215
|
-
export declare const renderAccordionPanel_unstable: (state: AccordionPanelState) => JSX.Element | null;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Returns the props and state required to render the component
|
|
219
|
-
* @param props - Accordion properties
|
|
220
|
-
* @param ref - reference to root HTMLElement of Accordion
|
|
221
|
-
*/
|
|
222
|
-
export declare const useAccordion_unstable: (props: AccordionProps, ref: React_2.Ref<HTMLElement>) => AccordionState;
|
|
223
|
-
|
|
224
|
-
export declare const useAccordionContext_unstable: <T>(selector: ContextSelector<AccordionContextValue, T>) => T;
|
|
225
|
-
|
|
226
|
-
export declare function useAccordionContextValues_unstable(state: AccordionState): AccordionContextValues;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Returns the props and state required to render the component
|
|
230
|
-
* @param props - AccordionHeader properties
|
|
231
|
-
* @param ref - reference to root HTMLElement of AccordionHeader
|
|
232
|
-
*/
|
|
233
|
-
export declare const useAccordionHeader_unstable: (props: AccordionHeaderProps, ref: React_2.Ref<HTMLElement>) => AccordionHeaderState;
|
|
234
|
-
|
|
235
|
-
export declare function useAccordionHeaderContextValues_unstable(state: AccordionHeaderState): AccordionHeaderContextValues;
|
|
236
|
-
|
|
237
|
-
/** Applies style classnames to slots */
|
|
238
|
-
export declare const useAccordionHeaderStyles_unstable: (state: AccordionHeaderState) => AccordionHeaderState;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Returns the props and state required to render the component
|
|
242
|
-
* @param props - AccordionItem properties
|
|
243
|
-
* @param ref - reference to root HTMLElement of AccordionItem
|
|
244
|
-
*/
|
|
245
|
-
export declare const useAccordionItem_unstable: (props: AccordionItemProps, ref: React_2.Ref<HTMLElement>) => AccordionItemState;
|
|
246
|
-
|
|
247
|
-
export declare const useAccordionItemContext_unstable: () => AccordionItemContextValue;
|
|
248
|
-
|
|
249
|
-
export declare function useAccordionItemContextValues_unstable(state: AccordionItemState): AccordionItemContextValues;
|
|
250
|
-
|
|
251
|
-
export declare const useAccordionItemStyles_unstable: (state: AccordionItemState) => AccordionItemState;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Returns the props and state required to render the component
|
|
255
|
-
* @param props - AccordionPanel properties
|
|
256
|
-
* @param ref - reference to root HTMLElement of AccordionPanel
|
|
257
|
-
*/
|
|
258
|
-
export declare const useAccordionPanel_unstable: (props: AccordionPanelProps, ref: React_2.Ref<HTMLElement>) => AccordionPanelState;
|
|
259
|
-
|
|
260
|
-
/** Applies style classnames to slots */
|
|
261
|
-
export declare const useAccordionPanelStyles_unstable: (state: AccordionPanelState) => AccordionPanelState;
|
|
262
|
-
|
|
263
|
-
export declare const useAccordionStyles_unstable: (state: AccordionState) => AccordionState;
|
|
264
|
-
|
|
265
|
-
export { }
|
package/lib/Accordion.js
DELETED
package/lib/Accordion.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../src/Accordion.ts"],"sourcesContent":["export * from './components/Accordion/index';\n"],"mappings":"AAAA,cAAc"}
|
package/lib/AccordionHeader.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../src/AccordionHeader.ts"],"sourcesContent":["export * from './components/AccordionHeader/index';\n"],"mappings":"AAAA,cAAc"}
|
package/lib/AccordionItem.js
DELETED
package/lib/AccordionItem.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../src/AccordionItem.ts"],"sourcesContent":["export * from './components/AccordionItem/index';\n"],"mappings":"AAAA,cAAc"}
|
package/lib/AccordionPanel.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../src/AccordionPanel.ts"],"sourcesContent":["export * from './components/AccordionPanel/index';\n"],"mappings":"AAAA,cAAc"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { renderAccordion_unstable } from './renderAccordion';
|
|
3
|
-
import { useAccordion_unstable } from './useAccordion';
|
|
4
|
-
import { useAccordionContextValues_unstable } from './useAccordionContextValues';
|
|
5
|
-
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
6
|
-
import { useAccordionStyles_unstable } from './useAccordionStyles';
|
|
7
|
-
/**
|
|
8
|
-
* Define a styled Accordion, using the `useAccordion_unstable` and `useAccordionStyles_unstable` hooks.
|
|
9
|
-
*/
|
|
10
|
-
export const Accordion = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
11
|
-
const state = useAccordion_unstable(props, ref);
|
|
12
|
-
const contextValues = useAccordionContextValues_unstable(state);
|
|
13
|
-
useAccordionStyles_unstable(state);
|
|
14
|
-
useCustomStyleHook_unstable('useAccordionStyles_unstable')(state);
|
|
15
|
-
return renderAccordion_unstable(state, contextValues);
|
|
16
|
-
});
|
|
17
|
-
Accordion.displayName = 'Accordion';
|
|
18
|
-
//# sourceMappingURL=Accordion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","renderAccordion_unstable","useAccordion_unstable","useAccordionContextValues_unstable","useCustomStyleHook_unstable","useAccordionStyles_unstable","Accordion","forwardRef","props","ref","state","contextValues","displayName"],"sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderAccordion_unstable } from './renderAccordion';\nimport { useAccordion_unstable } from './useAccordion';\nimport { useAccordionContextValues_unstable } from './useAccordionContextValues';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useAccordionStyles_unstable } from './useAccordionStyles';\nimport type { AccordionProps } from './Accordion.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled Accordion, using the `useAccordion_unstable` and `useAccordionStyles_unstable` hooks.\n */\nexport const Accordion: ForwardRefComponent<AccordionProps> = React.forwardRef<HTMLDivElement, AccordionProps>(\n (props, ref) => {\n const state = useAccordion_unstable(props, ref);\n const contextValues = useAccordionContextValues_unstable(state);\n\n useAccordionStyles_unstable(state);\n\n useCustomStyleHook_unstable('useAccordionStyles_unstable')(state);\n\n return renderAccordion_unstable(state, contextValues);\n },\n);\n\nAccordion.displayName = 'Accordion';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,qBAAqB,QAAQ;AACtC,SAASC,kCAAkC,QAAQ;AACnD,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,QAAQ;AAI5C;;;AAGA,OAAO,MAAMC,SAAA,gBAAiDN,KAAA,CAAMO,UAAU,CAC5E,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACd,MAAMC,KAAA,GAAQR,qBAAA,CAAsBM,KAAA,EAAOC,GAAA;EAC3C,MAAME,aAAA,GAAgBR,kCAAA,CAAmCO,KAAA;EAEzDL,2BAAA,CAA4BK,KAAA;EAE5BN,2BAAA,CAA4B,+BAA+BM,KAAA;EAE3D,OAAOT,wBAAA,CAAyBS,KAAA,EAAOC,aAAA;AACzC;AAGFL,SAAA,CAAUM,WAAW,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React"],"sources":["../../../src/components/Accordion/Accordion.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AccordionItemValue } from '../AccordionItem/AccordionItem.types';\n\nexport type AccordionIndex = number | number[];\n\nexport type AccordionToggleEvent<E = HTMLElement> = React.MouseEvent<E> | React.KeyboardEvent<E>;\n\nexport type AccordionToggleEventHandler = (event: AccordionToggleEvent, data: AccordionToggleData) => void;\n\nexport type AccordionContextValue = Required<Pick<AccordionProps, 'collapsible'>> &\n Pick<AccordionProps, 'navigation'> & {\n /**\n * The list of opened panels by index\n */\n openItems: AccordionItemValue[];\n /**\n * Callback used by AccordionItem to request a change on it's own opened state\n * Should be used to toggle AccordionItem\n */\n requestToggle: (event: AccordionToggleEvent, data: AccordionToggleData) => void;\n };\n\nexport type AccordionContextValues = {\n accordion: AccordionContextValue;\n};\n\nexport type AccordionSlots = {\n root: Slot<'div'>;\n};\n\nexport type AccordionToggleData = {\n value: AccordionItemValue;\n};\n\nexport type AccordionProps = ComponentProps<AccordionSlots> & {\n /**\n * Default value for the uncontrolled state of the panel.\n */\n defaultOpenItems?: AccordionItemValue | AccordionItemValue[];\n\n /**\n * Indicates if Accordion support multiple Panels closed at the same time.\n */\n collapsible?: boolean;\n\n /**\n * Indicates if Accordion support multiple Panels opened at the same time.\n */\n multiple?: boolean;\n\n /**\n * Indicates if keyboard navigation is available and gives two options, linear or circular navigation.\n */\n navigation?: 'linear' | 'circular';\n\n /**\n * Callback to be called when the opened items change.\n */\n onToggle?: AccordionToggleEventHandler;\n\n /**\n * Controls the state of the panel.\n */\n openItems?: AccordionItemValue | AccordionItemValue[];\n};\n\nexport type AccordionState = ComponentState<AccordionSlots> & AccordionContextValue;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
|
2
|
-
export const AccordionContext = /*#__PURE__*/createContext(undefined);
|
|
3
|
-
const accordionContextDefaultValue = {
|
|
4
|
-
openItems: [],
|
|
5
|
-
collapsible: false,
|
|
6
|
-
requestToggle() {
|
|
7
|
-
/* noop */}
|
|
8
|
-
};
|
|
9
|
-
export const AccordionProvider = AccordionContext.Provider;
|
|
10
|
-
export const useAccordionContext_unstable = selector => useContextSelector(AccordionContext, (ctx = accordionContextDefaultValue) => selector(ctx));
|
|
11
|
-
//# sourceMappingURL=AccordionContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContextSelector","AccordionContext","undefined","accordionContextDefaultValue","openItems","collapsible","requestToggle","AccordionProvider","Provider","useAccordionContext_unstable","selector","ctx"],"sources":["../../../src/components/Accordion/AccordionContext.ts"],"sourcesContent":["import { createContext, ContextSelector, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { AccordionContextValue } from './Accordion.types';\n\nexport const AccordionContext: Context<AccordionContextValue> = createContext<AccordionContextValue | undefined>(\n undefined,\n) as Context<AccordionContextValue>;\n\nconst accordionContextDefaultValue: AccordionContextValue = {\n openItems: [],\n collapsible: false,\n requestToggle() {\n /* noop */\n },\n};\n\nexport const AccordionProvider = AccordionContext.Provider;\nexport const useAccordionContext_unstable = <T>(selector: ContextSelector<AccordionContextValue, T>): T =>\n useContextSelector(AccordionContext, (ctx = accordionContextDefaultValue) => selector(ctx));\n"],"mappings":"AAAA,SAASA,aAAa,EAAmBC,kBAAkB,QAAQ;AAInE,OAAO,MAAMC,gBAAA,gBAAmDF,aAAA,CAC9DG,SAAA;AAGF,MAAMC,4BAAA,GAAsD;EAC1DC,SAAA,EAAW,EAAE;EACbC,WAAA,EAAa,KAAK;EAClBC,cAAA,EAAgB;IACd;AAEJ;AAEA,OAAO,MAAMC,iBAAA,GAAoBN,gBAAA,CAAiBO,QAAQ;AAC1D,OAAO,MAAMC,4BAAA,GAAmCC,QAAA,IAC9CV,kBAAA,CAAmBC,gBAAA,EAAkB,CAACU,GAAA,GAAMR,4BAA4B,KAAKO,QAAA,CAASC,GAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './Accordion';
|
|
2
|
-
export * from './Accordion.types';
|
|
3
|
-
export * from './renderAccordion';
|
|
4
|
-
export * from './useAccordion';
|
|
5
|
-
export * from './useAccordionStyles';
|
|
6
|
-
export * from './useAccordionContextValues';
|
|
7
|
-
export * from './AccordionContext';
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/components/Accordion/index.ts"],"sourcesContent":["export * from './Accordion';\nexport * from './Accordion.types';\nexport * from './renderAccordion';\nexport * from './useAccordion';\nexport * from './useAccordionStyles';\nexport * from './useAccordionContextValues';\nexport * from './AccordionContext';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
|
|
2
|
-
import { getSlotsNext } from '@fluentui/react-utilities';
|
|
3
|
-
import { AccordionContext } from './AccordionContext';
|
|
4
|
-
/**
|
|
5
|
-
* Function that renders the final JSX of the component
|
|
6
|
-
*/
|
|
7
|
-
export const renderAccordion_unstable = (state, contextValues) => {
|
|
8
|
-
const {
|
|
9
|
-
slots,
|
|
10
|
-
slotProps
|
|
11
|
-
} = getSlotsNext(state);
|
|
12
|
-
return /*#__PURE__*/createElement(slots.root, slotProps.root, /*#__PURE__*/createElement(AccordionContext.Provider, {
|
|
13
|
-
value: contextValues.accordion
|
|
14
|
-
}, slotProps.root.children));
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=renderAccordion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createElement","getSlotsNext","AccordionContext","renderAccordion_unstable","state","contextValues","slots","slotProps","root","Provider","value","accordion","children"],"sources":["../../../src/components/Accordion/renderAccordion.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\n\nimport { AccordionContext } from './AccordionContext';\nimport type { AccordionState, AccordionSlots, AccordionContextValues } from './Accordion.types';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderAccordion_unstable = (state: AccordionState, contextValues: AccordionContextValues) => {\n const { slots, slotProps } = getSlotsNext<AccordionSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <AccordionContext.Provider value={contextValues.accordion}>{slotProps.root.children}</AccordionContext.Provider>\n </slots.root>\n );\n};\n"],"mappings":"AAAA,2BACA,yBAEA,SAASA,aAAa,QAAQ;AAE9B,SAASC,YAAY,QAAQ;AAE7B,SAASC,gBAAgB,QAAQ;AAGjC;;;AAGA,OAAO,MAAMC,wBAAA,GAA2BA,CAACC,KAAA,EAAuBC,aAAA,KAA0C;EACxG,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGN,YAAA,CAA6BG,KAAA;EAE1D,oBACEJ,aAhBJ,CAgBKM,KAAA,CAAME,IAAI,EAAKD,SAAA,CAAUC,IAAI,eAC5BR,aAjBN,CAiBOE,gBAAA,CAAiBO,QAAQ;IAACC,KAAA,EAAOL,aAAA,CAAcM;KAAYJ,SAAA,CAAUC,IAAI,CAACI,QAAQ;AAGzF"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { getNativeElementProps, useControllableState, useEventCallback } from '@fluentui/react-utilities';
|
|
3
|
-
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
4
|
-
/**
|
|
5
|
-
* Returns the props and state required to render the component
|
|
6
|
-
* @param props - Accordion properties
|
|
7
|
-
* @param ref - reference to root HTMLElement of Accordion
|
|
8
|
-
*/
|
|
9
|
-
export const useAccordion_unstable = (props, ref) => {
|
|
10
|
-
const {
|
|
11
|
-
openItems: controlledOpenItems,
|
|
12
|
-
defaultOpenItems,
|
|
13
|
-
multiple = false,
|
|
14
|
-
collapsible = false,
|
|
15
|
-
onToggle,
|
|
16
|
-
navigation
|
|
17
|
-
} = props;
|
|
18
|
-
const [openItems, setOpenItems] = useControllableState({
|
|
19
|
-
state: React.useMemo(() => normalizeValues(controlledOpenItems), [controlledOpenItems]),
|
|
20
|
-
defaultState: () => initializeUncontrolledOpenItems({
|
|
21
|
-
defaultOpenItems,
|
|
22
|
-
multiple
|
|
23
|
-
}),
|
|
24
|
-
initialState: []
|
|
25
|
-
});
|
|
26
|
-
const arrowNavigationProps = useArrowNavigationGroup({
|
|
27
|
-
circular: navigation === 'circular',
|
|
28
|
-
tabbable: true
|
|
29
|
-
});
|
|
30
|
-
const requestToggle = useEventCallback((event, data) => {
|
|
31
|
-
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, data);
|
|
32
|
-
setOpenItems(previousOpenItems => updateOpenItems(data.value, previousOpenItems, multiple, collapsible));
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
collapsible,
|
|
36
|
-
navigation,
|
|
37
|
-
openItems,
|
|
38
|
-
requestToggle,
|
|
39
|
-
components: {
|
|
40
|
-
root: 'div'
|
|
41
|
-
},
|
|
42
|
-
root: getNativeElementProps('div', {
|
|
43
|
-
...props,
|
|
44
|
-
...(navigation ? arrowNavigationProps : {}),
|
|
45
|
-
ref
|
|
46
|
-
})
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Initial value for the uncontrolled case of the list of open indexes
|
|
51
|
-
*/
|
|
52
|
-
function initializeUncontrolledOpenItems({
|
|
53
|
-
defaultOpenItems,
|
|
54
|
-
multiple
|
|
55
|
-
}) {
|
|
56
|
-
if (defaultOpenItems !== undefined) {
|
|
57
|
-
if (Array.isArray(defaultOpenItems)) {
|
|
58
|
-
return multiple ? defaultOpenItems : [defaultOpenItems[0]];
|
|
59
|
-
}
|
|
60
|
-
return [defaultOpenItems];
|
|
61
|
-
}
|
|
62
|
-
return [];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Updates the list of open indexes based on an index that changes
|
|
66
|
-
* @param value - the index that will change
|
|
67
|
-
* @param previousOpenItems - list of current open indexes
|
|
68
|
-
* @param multiple - if Accordion support multiple Panels opened at the same time
|
|
69
|
-
* @param collapsible - if Accordion support multiple Panels closed at the same time
|
|
70
|
-
*/
|
|
71
|
-
function updateOpenItems(value, previousOpenItems, multiple, collapsible) {
|
|
72
|
-
if (multiple) {
|
|
73
|
-
if (previousOpenItems.includes(value)) {
|
|
74
|
-
if (previousOpenItems.length > 1 || collapsible) {
|
|
75
|
-
return previousOpenItems.filter(i => i !== value);
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
return [...previousOpenItems, value].sort();
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
return previousOpenItems[0] === value && collapsible ? [] : [value];
|
|
82
|
-
}
|
|
83
|
-
return previousOpenItems;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Normalizes Accordion index into an array of indexes
|
|
87
|
-
*/
|
|
88
|
-
function normalizeValues(index) {
|
|
89
|
-
if (index === undefined) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
return Array.isArray(index) ? index : [index];
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=useAccordion.js.map
|