etudes 3.9.1 → 4.0.0-rc.0
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/lib/Accordion.d.ts +175 -56
- package/lib/Accordion.js +126 -74
- package/lib/Accordion.js.map +1 -1
- package/lib/BurgerButton.d.ts +1 -2
- package/lib/BurgerButton.js +17 -20
- package/lib/BurgerButton.js.map +1 -1
- package/lib/Collection.d.ts +284 -0
- package/lib/{List.js → Collection.js} +75 -48
- package/lib/Collection.js.map +1 -0
- package/lib/Conditional.d.ts +1 -1
- package/lib/Conditional.js +2 -1
- package/lib/Conditional.js.map +1 -1
- package/lib/DebugConsole.d.ts +1 -2
- package/lib/DebugConsole.js +8 -10
- package/lib/DebugConsole.js.map +1 -1
- package/lib/Dial.d.ts +1 -2
- package/lib/Dial.js +11 -16
- package/lib/Dial.js.map +1 -1
- package/lib/Dropdown.d.ts +95 -46
- package/lib/Dropdown.js +108 -76
- package/lib/Dropdown.js.map +1 -1
- package/lib/Each.d.ts +1 -1
- package/lib/Each.js +2 -1
- package/lib/Each.js.map +1 -1
- package/lib/ExtractChild.d.ts +1 -2
- package/lib/ExtractChild.js +4 -6
- package/lib/ExtractChild.js.map +1 -1
- package/lib/ExtractChildren.d.ts +1 -1
- package/lib/ExtractChildren.js +4 -6
- package/lib/ExtractChildren.js.map +1 -1
- package/lib/FlatSVG.d.ts +1 -2
- package/lib/FlatSVG.js +3 -1
- package/lib/FlatSVG.js.map +1 -1
- package/lib/MasonryGrid.d.ts +2 -2
- package/lib/MasonryGrid.js +9 -9
- package/lib/MasonryGrid.js.map +1 -1
- package/lib/Panorama.d.ts +2 -3
- package/lib/Panorama.js +11 -12
- package/lib/Panorama.js.map +1 -1
- package/lib/PanoramaSlider.d.ts +7 -3
- package/lib/PanoramaSlider.js +21 -24
- package/lib/PanoramaSlider.js.map +1 -1
- package/lib/RangeSlider.d.ts +2 -2
- package/lib/RangeSlider.js +25 -28
- package/lib/RangeSlider.js.map +1 -1
- package/lib/Repeat.d.ts +1 -1
- package/lib/Repeat.js +2 -1
- package/lib/Repeat.js.map +1 -1
- package/lib/RotatingGallery.d.ts +1 -2
- package/lib/RotatingGallery.js +13 -15
- package/lib/RotatingGallery.js.map +1 -1
- package/lib/SelectableButton.d.ts +2 -3
- package/lib/SelectableButton.js +3 -1
- package/lib/SelectableButton.js.map +1 -1
- package/lib/Slider.d.ts +3 -3
- package/lib/Slider.js +19 -22
- package/lib/Slider.js.map +1 -1
- package/lib/StepwiseSlider.d.ts +2 -2
- package/lib/StepwiseSlider.js +19 -23
- package/lib/StepwiseSlider.js.map +1 -1
- package/lib/SwipeContainer.d.ts +1 -2
- package/lib/SwipeContainer.js +3 -1
- package/lib/SwipeContainer.js.map +1 -1
- package/lib/TextField.d.ts +1 -2
- package/lib/TextField.js +3 -1
- package/lib/TextField.js.map +1 -1
- package/lib/Video.d.ts +1 -2
- package/lib/Video.js +6 -8
- package/lib/Video.js.map +1 -1
- package/lib/WithTooltip.d.ts +1 -1
- package/lib/WithTooltip.js +11 -11
- package/lib/WithTooltip.js.map +1 -1
- package/lib/hooks/useDragEffect.d.ts +1 -1
- package/lib/hooks/useDragEffect.js +2 -1
- package/lib/hooks/useDragEffect.js.map +1 -1
- package/lib/hooks/useElementRect.d.ts +1 -1
- package/lib/hooks/useElementRect.js +2 -1
- package/lib/hooks/useElementRect.js.map +1 -1
- package/lib/hooks/useInterval.d.ts +1 -1
- package/lib/hooks/useInterval.js +2 -1
- package/lib/hooks/useInterval.js.map +1 -1
- package/lib/hooks/useLoadImageEffect.d.ts +1 -1
- package/lib/hooks/useLoadImageEffect.js +2 -1
- package/lib/hooks/useLoadImageEffect.js.map +1 -1
- package/lib/hooks/useMounted.d.ts +1 -1
- package/lib/hooks/useMounted.js +2 -1
- package/lib/hooks/useMounted.js.map +1 -1
- package/lib/hooks/usePrevious.d.ts +1 -1
- package/lib/hooks/usePrevious.js +2 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useResizeEffect.d.ts +1 -1
- package/lib/hooks/useResizeEffect.js +2 -1
- package/lib/hooks/useResizeEffect.js.map +1 -1
- package/lib/hooks/useSearchParamState.d.ts +1 -1
- package/lib/hooks/useSearchParamState.js +4 -6
- package/lib/hooks/useSearchParamState.js.map +1 -1
- package/lib/hooks/useViewportSize.d.ts +1 -1
- package/lib/hooks/useViewportSize.js +2 -1
- package/lib/hooks/useViewportSize.js.map +1 -1
- package/lib/providers/ScrollPositionProvider.d.ts +1 -1
- package/lib/providers/ScrollPositionProvider.js +2 -2
- package/lib/providers/ScrollPositionProvider.js.map +1 -1
- package/lib/utils/asClassNameDict.d.ts +1 -1
- package/lib/utils/asClassNameDict.js +2 -1
- package/lib/utils/asClassNameDict.js.map +1 -1
- package/lib/utils/asComponentDict.d.ts +1 -1
- package/lib/utils/asComponentDict.js +2 -1
- package/lib/utils/asComponentDict.js.map +1 -1
- package/lib/utils/asStyleDict.d.ts +1 -1
- package/lib/utils/asStyleDict.js +2 -1
- package/lib/utils/asStyleDict.js.map +1 -1
- package/lib/utils/cloneStyledElement.d.ts +1 -1
- package/lib/utils/cloneStyledElement.js +2 -1
- package/lib/utils/cloneStyledElement.js.map +1 -1
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.js +23 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/styles.d.ts +1 -1
- package/lib/utils/styles.js +2 -1
- package/lib/utils/styles.js.map +1 -1
- package/lib/utils/useDebug.d.ts +1 -1
- package/lib/utils/useDebug.js +2 -1
- package/lib/utils/useDebug.js.map +1 -1
- package/package.json +15 -15
- package/lib/List.d.ts +0 -184
- package/lib/List.js.map +0 -1
package/lib/Accordion.d.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import React, { type ComponentType, type HTMLAttributes, type PropsWithChildren, type ReactElement, type Ref } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type CollectionItemProps, type CollectionOrientation, type CollectionProps, type CollectionSelectionMode } from './Collection';
|
|
3
|
+
/**
|
|
4
|
+
* Type describing the current item selection of {@link Accordion}, composed of
|
|
5
|
+
* a dictionary whose key corresponds the section index and value corresponds to
|
|
6
|
+
* an array of selected item indices. If the selection mode of the
|
|
7
|
+
* {@link Accordion} is `single`, only one key will be present and one index in
|
|
8
|
+
* the array value.
|
|
9
|
+
*/
|
|
3
10
|
export type AccordionSelection = Record<number, number[]>;
|
|
4
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Type describing the data of each section in {@link Accordion}.
|
|
13
|
+
*/
|
|
14
|
+
export type AccordionSection<T> = Pick<CollectionProps<T>, 'isSelectionTogglable' | 'itemLength' | 'itemPadding' | 'items' | 'layout' | 'numSegments'> & {
|
|
5
15
|
/**
|
|
6
|
-
* Label for the header.
|
|
16
|
+
* Label for the section header.
|
|
7
17
|
*/
|
|
8
18
|
label: string;
|
|
9
19
|
/**
|
|
@@ -13,13 +23,39 @@ export type AccordionSection<T> = Pick<ListProps<T>, 'isSelectionTogglable' | 'i
|
|
|
13
23
|
*/
|
|
14
24
|
maxVisible?: number;
|
|
15
25
|
};
|
|
16
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Type describing the props of each `ItemComponent` provided to
|
|
28
|
+
* {@link Accordion}.
|
|
29
|
+
*/
|
|
30
|
+
export type AccordionItemProps<T> = CollectionItemProps<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Type describing the props of each `HeaderComponent` provided to
|
|
33
|
+
* {@link Accordion}.
|
|
34
|
+
*/
|
|
17
35
|
export type AccordionHeaderProps<I, S extends AccordionSection<I> = AccordionSection<I>> = HTMLAttributes<HTMLElement> & PropsWithChildren<{
|
|
36
|
+
/**
|
|
37
|
+
* The index of the corresponding section.
|
|
38
|
+
*/
|
|
18
39
|
index: number;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates whether the corresponding section is collapsed.
|
|
42
|
+
*/
|
|
19
43
|
isCollapsed: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Data provided to the corresponding section.
|
|
46
|
+
*/
|
|
20
47
|
section: S;
|
|
48
|
+
/**
|
|
49
|
+
* Handler invoked to dispatch a custom event.
|
|
50
|
+
*
|
|
51
|
+
* @param name User-defined name of the custom event.
|
|
52
|
+
* @param info Optional user-defined info of the custom event.
|
|
53
|
+
*/
|
|
21
54
|
onCustomEvent?: (name: string, info?: any) => void;
|
|
22
55
|
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Type describing the props of {@link Accordion}.
|
|
58
|
+
*/
|
|
23
59
|
export type AccordionProps<I, S extends AccordionSection<I> = AccordionSection<I>> = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{
|
|
24
60
|
/**
|
|
25
61
|
* Specifies if expanded sections should automatically collapse upon expanding
|
|
@@ -27,25 +63,26 @@ export type AccordionProps<I, S extends AccordionSection<I> = AccordionSection<I
|
|
|
27
63
|
*/
|
|
28
64
|
autoCollapseSections?: boolean;
|
|
29
65
|
/**
|
|
30
|
-
* SVG markup to
|
|
66
|
+
* SVG markup to use as the collapse icon when a toggle button is
|
|
67
|
+
* automatically generated (when `HeaderComponent` is absent).
|
|
31
68
|
*/
|
|
32
69
|
collapseIconSvg?: string;
|
|
33
70
|
/**
|
|
34
|
-
* Indices of sections that are expanded.
|
|
71
|
+
* Indices of sections that are expanded. If specified, the component will not
|
|
72
|
+
* manage expansion states.
|
|
35
73
|
*/
|
|
36
74
|
expandedSectionIndices?: number[];
|
|
37
75
|
/**
|
|
38
|
-
* SVG markup to
|
|
76
|
+
* SVG markup to use as the expand icon when a toggle button is automatically
|
|
77
|
+
* generated (when `HeaderComponent` is absent).
|
|
39
78
|
*/
|
|
40
79
|
expandIconSvg?: string;
|
|
41
|
-
/**
|
|
42
|
-
* React component type to be used to generate items for each section.
|
|
43
|
-
*/
|
|
44
|
-
itemComponentType?: ComponentType<AccordionItemProps<I>>;
|
|
45
80
|
/**
|
|
46
81
|
* Orientation of this component.
|
|
82
|
+
*
|
|
83
|
+
* @see {@link CollectionOrientation}
|
|
47
84
|
*/
|
|
48
|
-
orientation?:
|
|
85
|
+
orientation?: CollectionOrientation;
|
|
49
86
|
/**
|
|
50
87
|
* Padding (in pixels) between each section.
|
|
51
88
|
*/
|
|
@@ -55,44 +92,60 @@ export type AccordionProps<I, S extends AccordionSection<I> = AccordionSection<I
|
|
|
55
92
|
*/
|
|
56
93
|
sections: S[];
|
|
57
94
|
/**
|
|
58
|
-
* Indices of selected items per section.
|
|
95
|
+
* Indices of selected items per section. If specified, the component will not
|
|
96
|
+
* manage selection state.
|
|
97
|
+
*
|
|
98
|
+
* @see {@link AccordionSelection}
|
|
59
99
|
*/
|
|
60
100
|
selection?: AccordionSelection;
|
|
61
101
|
/**
|
|
62
102
|
* Selection mode of each section.
|
|
103
|
+
*
|
|
104
|
+
* @see {@link CollectionSelectionMode}
|
|
63
105
|
*/
|
|
64
|
-
selectionMode?:
|
|
65
|
-
/**
|
|
66
|
-
* React component type to be used for generating headers inside the
|
|
67
|
-
* component. When absent, one will be generated automatically.
|
|
68
|
-
*/
|
|
69
|
-
headerComponentType?: ComponentType<AccordionHeaderProps<I, S>>;
|
|
106
|
+
selectionMode?: CollectionSelectionMode;
|
|
70
107
|
/**
|
|
71
108
|
* Specifies if the component should use default styles.
|
|
72
109
|
*/
|
|
73
110
|
useDefaultStyles?: boolean;
|
|
74
111
|
/**
|
|
75
|
-
* Handler invoked when an item is activated in a section.
|
|
112
|
+
* Handler invoked when an item is activated in a section. The order of
|
|
113
|
+
* handlers invoked when any selection changes take place is:
|
|
114
|
+
* 1. `onActivateAt`
|
|
115
|
+
* 2. `onDeselectAt`
|
|
116
|
+
* 3. `onSelectAt`
|
|
117
|
+
* 4. `onSelectionChange`
|
|
76
118
|
*
|
|
77
119
|
* @param itemIndex Item index.
|
|
78
120
|
* @param sectionIndex Section index.
|
|
79
121
|
*/
|
|
80
122
|
onActivateAt?: (itemIndex: number, sectionIndex: number) => void;
|
|
81
123
|
/**
|
|
82
|
-
* Handler invoked when a section is collapsed.
|
|
124
|
+
* Handler invoked when a section is collapsed. The order of handlers invoked
|
|
125
|
+
* when any section expansion changes take place is:
|
|
126
|
+
* 1. `onCollapseSectionAt`
|
|
127
|
+
* 2. `onExpandSectionAt`
|
|
83
128
|
*
|
|
84
129
|
* @param sectionIndex Section index.
|
|
85
130
|
*/
|
|
86
131
|
onCollapseSectionAt?: (sectionIndex: number) => void;
|
|
87
132
|
/**
|
|
88
|
-
* Handler invoked when an item is deselected in a section.
|
|
133
|
+
* Handler invoked when an item is deselected in a section. The order of
|
|
134
|
+
* handlers invoked when any selection changes take place is:
|
|
135
|
+
* 1. `onActivateAt`
|
|
136
|
+
* 2. `onDeselectAt`
|
|
137
|
+
* 3. `onSelectAt`
|
|
138
|
+
* 4. `onSelectionChange`
|
|
89
139
|
*
|
|
90
140
|
* @param itemIndex Item index.
|
|
91
141
|
* @param sectionIndex Section index.
|
|
92
142
|
*/
|
|
93
143
|
onDeselectAt?: (itemIndex: number, sectionIndex: number) => void;
|
|
94
144
|
/**
|
|
95
|
-
* Handler invoked when a section is expanded.
|
|
145
|
+
* Handler invoked when a section is expanded. The order of handlers invoked
|
|
146
|
+
* when any section expansion changes take place is:
|
|
147
|
+
* 1. `onCollapseSectionAt`
|
|
148
|
+
* 2. `onExpandSectionAt`
|
|
96
149
|
*
|
|
97
150
|
* @param sectionIndex Section index.
|
|
98
151
|
*/
|
|
@@ -101,8 +154,8 @@ export type AccordionProps<I, S extends AccordionSection<I> = AccordionSection<I
|
|
|
101
154
|
* Handler invoked when a custom event is dispatched from a section header.
|
|
102
155
|
*
|
|
103
156
|
* @param sectionIndex Index of the section which the header belongs.
|
|
104
|
-
* @param eventName
|
|
105
|
-
* @param eventInfo Optional info of the dispatched event.
|
|
157
|
+
* @param eventName User-defined name of the dispatched event.
|
|
158
|
+
* @param eventInfo Optional user-defined info of the dispatched event.
|
|
106
159
|
*/
|
|
107
160
|
onHeaderCustomEvent?: (sectionIndex: number, eventName: string, eventInfo?: any) => void;
|
|
108
161
|
/**
|
|
@@ -110,50 +163,82 @@ export type AccordionProps<I, S extends AccordionSection<I> = AccordionSection<I
|
|
|
110
163
|
*
|
|
111
164
|
* @param itemIndex Item index.
|
|
112
165
|
* @param sectionIndex Section index.
|
|
113
|
-
* @param eventName
|
|
114
|
-
* @param eventInfo Optional info of the dispatched event.
|
|
166
|
+
* @param eventName User-defined name of the dispatched event.
|
|
167
|
+
* @param eventInfo Optional user-defined info of the dispatched event.
|
|
115
168
|
*/
|
|
116
169
|
onItemCustomEvent?: (itemIndex: number, sectionIndex: number, eventName: string, eventInfo?: any) => void;
|
|
117
170
|
/**
|
|
118
|
-
* Handler invoked when an item is selected in a section.
|
|
171
|
+
* Handler invoked when an item is selected in a section. The order of
|
|
172
|
+
* handlers invoked when any selection changes take place is:
|
|
173
|
+
* 1. `onActivateAt`
|
|
174
|
+
* 2. `onDeselectAt`
|
|
175
|
+
* 3. `onSelectAt`
|
|
176
|
+
* 4. `onSelectionChange`
|
|
119
177
|
*
|
|
120
178
|
* @param itemIndex Item index.
|
|
121
179
|
* @param sectionIndex Section index.
|
|
122
180
|
*/
|
|
123
181
|
onSelectAt?: (itemIndex: number, sectionIndex: number) => void;
|
|
124
182
|
/**
|
|
125
|
-
* Handler invoked when selected items have changed.
|
|
183
|
+
* Handler invoked when selected items have changed. The order of handlers
|
|
184
|
+
* invoked when any selection changes take place is:
|
|
185
|
+
* 1. `onActivateAt`
|
|
186
|
+
* 2. `onDeselectAt`
|
|
187
|
+
* 3. `onSelectAt`
|
|
188
|
+
* 4. `onSelectionChange`
|
|
126
189
|
*
|
|
127
190
|
* @param selectedIndices Dictionary of indices of selected items per section.
|
|
128
191
|
*/
|
|
129
192
|
onSelectionChange?: (selection: AccordionSelection) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Component type for generating section headers inside the component. When
|
|
195
|
+
* absent, one will be generated automatically.
|
|
196
|
+
*/
|
|
197
|
+
HeaderComponent?: ComponentType<AccordionHeaderProps<I, S>>;
|
|
198
|
+
/**
|
|
199
|
+
* Component type for generating items for each section.
|
|
200
|
+
*/
|
|
201
|
+
ItemComponent?: ComponentType<AccordionItemProps<I>>;
|
|
130
202
|
}>;
|
|
131
|
-
|
|
203
|
+
/**
|
|
204
|
+
* A collection of selectable items laid out in sections in an accordion. Items
|
|
205
|
+
* are generated based on the provided `ItemComponent` while each section header
|
|
206
|
+
* is optionally provided by `HeaderComponent` or generated automatically.
|
|
207
|
+
*
|
|
208
|
+
* This component automatically determines if it should track selection state
|
|
209
|
+
* and expansion states internally. If the `selection` prop is provided, the
|
|
210
|
+
* component will not initialize the selection state. It will be up to its
|
|
211
|
+
* parent to provide item selection in tandem with the component's
|
|
212
|
+
* `onSelectionChange` handler. Likewise for the omission of the expansion
|
|
213
|
+
* states if `expandedSectionIndices` prop is provided.
|
|
214
|
+
*/
|
|
215
|
+
export declare const Accordion: <I, S extends AccordionSection<I> = AccordionSection<I>>(props: React.HTMLAttributes<HTMLDivElement> & {
|
|
132
216
|
/**
|
|
133
217
|
* Specifies if expanded sections should automatically collapse upon expanding
|
|
134
218
|
* another section.
|
|
135
219
|
*/
|
|
136
220
|
autoCollapseSections?: boolean | undefined;
|
|
137
221
|
/**
|
|
138
|
-
* SVG markup to
|
|
222
|
+
* SVG markup to use as the collapse icon when a toggle button is
|
|
223
|
+
* automatically generated (when `HeaderComponent` is absent).
|
|
139
224
|
*/
|
|
140
225
|
collapseIconSvg?: string | undefined;
|
|
141
226
|
/**
|
|
142
|
-
* Indices of sections that are expanded.
|
|
227
|
+
* Indices of sections that are expanded. If specified, the component will not
|
|
228
|
+
* manage expansion states.
|
|
143
229
|
*/
|
|
144
230
|
expandedSectionIndices?: number[] | undefined;
|
|
145
231
|
/**
|
|
146
|
-
* SVG markup to
|
|
232
|
+
* SVG markup to use as the expand icon when a toggle button is automatically
|
|
233
|
+
* generated (when `HeaderComponent` is absent).
|
|
147
234
|
*/
|
|
148
235
|
expandIconSvg?: string | undefined;
|
|
149
|
-
/**
|
|
150
|
-
* React component type to be used to generate items for each section.
|
|
151
|
-
*/
|
|
152
|
-
itemComponentType?: React.ComponentType<AccordionItemProps<I>> | undefined;
|
|
153
236
|
/**
|
|
154
237
|
* Orientation of this component.
|
|
238
|
+
*
|
|
239
|
+
* @see {@link CollectionOrientation}
|
|
155
240
|
*/
|
|
156
|
-
orientation?:
|
|
241
|
+
orientation?: CollectionOrientation | undefined;
|
|
157
242
|
/**
|
|
158
243
|
* Padding (in pixels) between each section.
|
|
159
244
|
*/
|
|
@@ -163,44 +248,60 @@ declare const _default: <I, S extends AccordionSection<I> = AccordionSection<I>>
|
|
|
163
248
|
*/
|
|
164
249
|
sections: S[];
|
|
165
250
|
/**
|
|
166
|
-
* Indices of selected items per section.
|
|
251
|
+
* Indices of selected items per section. If specified, the component will not
|
|
252
|
+
* manage selection state.
|
|
253
|
+
*
|
|
254
|
+
* @see {@link AccordionSelection}
|
|
167
255
|
*/
|
|
168
256
|
selection?: AccordionSelection | undefined;
|
|
169
257
|
/**
|
|
170
258
|
* Selection mode of each section.
|
|
259
|
+
*
|
|
260
|
+
* @see {@link CollectionSelectionMode}
|
|
171
261
|
*/
|
|
172
|
-
selectionMode?:
|
|
173
|
-
/**
|
|
174
|
-
* React component type to be used for generating headers inside the
|
|
175
|
-
* component. When absent, one will be generated automatically.
|
|
176
|
-
*/
|
|
177
|
-
headerComponentType?: React.ComponentType<AccordionHeaderProps<I, S>> | undefined;
|
|
262
|
+
selectionMode?: CollectionSelectionMode | undefined;
|
|
178
263
|
/**
|
|
179
264
|
* Specifies if the component should use default styles.
|
|
180
265
|
*/
|
|
181
266
|
useDefaultStyles?: boolean | undefined;
|
|
182
267
|
/**
|
|
183
|
-
* Handler invoked when an item is activated in a section.
|
|
268
|
+
* Handler invoked when an item is activated in a section. The order of
|
|
269
|
+
* handlers invoked when any selection changes take place is:
|
|
270
|
+
* 1. `onActivateAt`
|
|
271
|
+
* 2. `onDeselectAt`
|
|
272
|
+
* 3. `onSelectAt`
|
|
273
|
+
* 4. `onSelectionChange`
|
|
184
274
|
*
|
|
185
275
|
* @param itemIndex Item index.
|
|
186
276
|
* @param sectionIndex Section index.
|
|
187
277
|
*/
|
|
188
278
|
onActivateAt?: ((itemIndex: number, sectionIndex: number) => void) | undefined;
|
|
189
279
|
/**
|
|
190
|
-
* Handler invoked when a section is collapsed.
|
|
280
|
+
* Handler invoked when a section is collapsed. The order of handlers invoked
|
|
281
|
+
* when any section expansion changes take place is:
|
|
282
|
+
* 1. `onCollapseSectionAt`
|
|
283
|
+
* 2. `onExpandSectionAt`
|
|
191
284
|
*
|
|
192
285
|
* @param sectionIndex Section index.
|
|
193
286
|
*/
|
|
194
287
|
onCollapseSectionAt?: ((sectionIndex: number) => void) | undefined;
|
|
195
288
|
/**
|
|
196
|
-
* Handler invoked when an item is deselected in a section.
|
|
289
|
+
* Handler invoked when an item is deselected in a section. The order of
|
|
290
|
+
* handlers invoked when any selection changes take place is:
|
|
291
|
+
* 1. `onActivateAt`
|
|
292
|
+
* 2. `onDeselectAt`
|
|
293
|
+
* 3. `onSelectAt`
|
|
294
|
+
* 4. `onSelectionChange`
|
|
197
295
|
*
|
|
198
296
|
* @param itemIndex Item index.
|
|
199
297
|
* @param sectionIndex Section index.
|
|
200
298
|
*/
|
|
201
299
|
onDeselectAt?: ((itemIndex: number, sectionIndex: number) => void) | undefined;
|
|
202
300
|
/**
|
|
203
|
-
* Handler invoked when a section is expanded.
|
|
301
|
+
* Handler invoked when a section is expanded. The order of handlers invoked
|
|
302
|
+
* when any section expansion changes take place is:
|
|
303
|
+
* 1. `onCollapseSectionAt`
|
|
304
|
+
* 2. `onExpandSectionAt`
|
|
204
305
|
*
|
|
205
306
|
* @param sectionIndex Section index.
|
|
206
307
|
*/
|
|
@@ -209,8 +310,8 @@ declare const _default: <I, S extends AccordionSection<I> = AccordionSection<I>>
|
|
|
209
310
|
* Handler invoked when a custom event is dispatched from a section header.
|
|
210
311
|
*
|
|
211
312
|
* @param sectionIndex Index of the section which the header belongs.
|
|
212
|
-
* @param eventName
|
|
213
|
-
* @param eventInfo Optional info of the dispatched event.
|
|
313
|
+
* @param eventName User-defined name of the dispatched event.
|
|
314
|
+
* @param eventInfo Optional user-defined info of the dispatched event.
|
|
214
315
|
*/
|
|
215
316
|
onHeaderCustomEvent?: ((sectionIndex: number, eventName: string, eventInfo?: any) => void) | undefined;
|
|
216
317
|
/**
|
|
@@ -218,26 +319,44 @@ declare const _default: <I, S extends AccordionSection<I> = AccordionSection<I>>
|
|
|
218
319
|
*
|
|
219
320
|
* @param itemIndex Item index.
|
|
220
321
|
* @param sectionIndex Section index.
|
|
221
|
-
* @param eventName
|
|
222
|
-
* @param eventInfo Optional info of the dispatched event.
|
|
322
|
+
* @param eventName User-defined name of the dispatched event.
|
|
323
|
+
* @param eventInfo Optional user-defined info of the dispatched event.
|
|
223
324
|
*/
|
|
224
325
|
onItemCustomEvent?: ((itemIndex: number, sectionIndex: number, eventName: string, eventInfo?: any) => void) | undefined;
|
|
225
326
|
/**
|
|
226
|
-
* Handler invoked when an item is selected in a section.
|
|
327
|
+
* Handler invoked when an item is selected in a section. The order of
|
|
328
|
+
* handlers invoked when any selection changes take place is:
|
|
329
|
+
* 1. `onActivateAt`
|
|
330
|
+
* 2. `onDeselectAt`
|
|
331
|
+
* 3. `onSelectAt`
|
|
332
|
+
* 4. `onSelectionChange`
|
|
227
333
|
*
|
|
228
334
|
* @param itemIndex Item index.
|
|
229
335
|
* @param sectionIndex Section index.
|
|
230
336
|
*/
|
|
231
337
|
onSelectAt?: ((itemIndex: number, sectionIndex: number) => void) | undefined;
|
|
232
338
|
/**
|
|
233
|
-
* Handler invoked when selected items have changed.
|
|
339
|
+
* Handler invoked when selected items have changed. The order of handlers
|
|
340
|
+
* invoked when any selection changes take place is:
|
|
341
|
+
* 1. `onActivateAt`
|
|
342
|
+
* 2. `onDeselectAt`
|
|
343
|
+
* 3. `onSelectAt`
|
|
344
|
+
* 4. `onSelectionChange`
|
|
234
345
|
*
|
|
235
346
|
* @param selectedIndices Dictionary of indices of selected items per section.
|
|
236
347
|
*/
|
|
237
348
|
onSelectionChange?: ((selection: AccordionSelection) => void) | undefined;
|
|
349
|
+
/**
|
|
350
|
+
* Component type for generating section headers inside the component. When
|
|
351
|
+
* absent, one will be generated automatically.
|
|
352
|
+
*/
|
|
353
|
+
HeaderComponent?: React.ComponentType<AccordionHeaderProps<I, S>> | undefined;
|
|
354
|
+
/**
|
|
355
|
+
* Component type for generating items for each section.
|
|
356
|
+
*/
|
|
357
|
+
ItemComponent?: React.ComponentType<AccordionItemProps<I>> | undefined;
|
|
238
358
|
} & {
|
|
239
359
|
children?: React.ReactNode;
|
|
240
360
|
} & {
|
|
241
361
|
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
242
362
|
}) => ReactElement;
|
|
243
|
-
export default _default;
|