1 | declare namespace FomanticUI {
|
2 | interface Accordion {
|
3 | settings: AccordionSettings;
|
4 |
|
5 | /**
|
6 | * Refreshes all cached selectors and data.
|
7 | */
|
8 | (behavior: 'refresh'): JQuery;
|
9 |
|
10 | /**
|
11 | * Opens accordion content at index.
|
12 | */
|
13 | (behavior: 'open', index: number): JQuery;
|
14 |
|
15 | /**
|
16 | * Closes accordion content that are not active.
|
17 | */
|
18 | (behavior: 'close others'): JQuery;
|
19 |
|
20 | /**
|
21 | * Closes accordion content at index.
|
22 | */
|
23 | (behavior: 'close', index: number): JQuery;
|
24 |
|
25 | /**
|
26 | * Toggles accordion content at index.
|
27 | */
|
28 | (behavior: 'toggle', index: number): JQuery;
|
29 |
|
30 | (behavior: 'destroy'): JQuery;
|
31 | <K extends keyof AccordionSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<AccordionSettings, keyof AccordionSettings>>;
|
32 | <K extends keyof AccordionSettings>(behavior: 'setting', name: K, value: AccordionSettings[K]): JQuery;
|
33 | (behavior: 'setting', value: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
|
34 | (settings?: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
|
35 | }
|
36 |
|
37 | /**
|
38 | * @see {@link https://fomantic-ui.com/modules/accordion.html#/settings}
|
39 | */
|
40 | interface AccordionSettings {
|
41 | // region Accordion Settings
|
42 |
|
43 | /**
|
44 | * Only allow one section open at a time.
|
45 | * @default true
|
46 | */
|
47 | exclusive?: boolean | undefined;
|
48 |
|
49 | /**
|
50 | * Event on 'title' that will cause accordion to open.
|
51 | * @default 'click'
|
52 | */
|
53 | on: string;
|
54 |
|
55 | /**
|
56 | * Whether child content opacity should be animated (may cause performance issues with many child elements).
|
57 | * @default true
|
58 | */
|
59 | animateChildren: boolean;
|
60 |
|
61 | /**
|
62 | * Close open nested accordion content when an element closes.
|
63 | * @default false
|
64 | */
|
65 | closeNested: boolean;
|
66 |
|
67 | /**
|
68 | * Allow active sections to collapse.
|
69 | * @default true
|
70 | */
|
71 | collapsible: boolean;
|
72 |
|
73 | /**
|
74 | * Duration in ms of opening animation.
|
75 | * @default 350
|
76 | */
|
77 | duration: number;
|
78 |
|
79 | /**
|
80 | * Easing of opening animation. EaseInOutQuint is included with accordion, for additional options you must include easing equations.
|
81 | * @see {@link http://gsgd.co.uk/sandbox/jquery/easing/}
|
82 | * @default 'easeOutQuad'
|
83 | */
|
84 | easing: string;
|
85 |
|
86 | /**
|
87 | * Whether accordion should automatically refresh on DOM insertion
|
88 | * @default true
|
89 | */
|
90 | observeChanges: boolean;
|
91 |
|
92 | // endregion
|
93 |
|
94 | // region Callbacks
|
95 |
|
96 | /**
|
97 | * Callback before element opens.
|
98 | */
|
99 | onOpening(this: JQuery): void;
|
100 |
|
101 | /**
|
102 | * Callback after element is open.
|
103 | */
|
104 | onOpen(this: JQuery): void;
|
105 |
|
106 | /**
|
107 | * Callback before element closes.
|
108 | */
|
109 | onClosing(this: JQuery): void;
|
110 |
|
111 | /**
|
112 | * Callback after element is closed.
|
113 | */
|
114 | onClose(this: JQuery): void;
|
115 |
|
116 | /**
|
117 | * Callback before element opens or closes.
|
118 | */
|
119 | onChanging(this: JQuery): void;
|
120 |
|
121 | /**
|
122 | * Callback before element opens or closes.
|
123 | */
|
124 | onChange(this: JQuery): void;
|
125 |
|
126 | // endregion
|
127 |
|
128 | // region DOM Settings
|
129 |
|
130 | /**
|
131 | * DOM Selectors used internally.
|
132 | * Selectors used to find parts of a module.
|
133 | */
|
134 | selector: Accordion.SelectorSettings;
|
135 |
|
136 | /**
|
137 | * Class names used to determine element state.
|
138 | */
|
139 | className: Accordion.ClassNameSettings;
|
140 |
|
141 | // endregion
|
142 |
|
143 | // region Debug Settings
|
144 |
|
145 | /**
|
146 | * Name used in log statements
|
147 | * @default 'Accordion'
|
148 | */
|
149 | name: string;
|
150 |
|
151 | /**
|
152 | * Event namespace. Makes sure module teardown does not effect other events attached to an element.
|
153 | * @default 'accordion'
|
154 | */
|
155 | namespace: string;
|
156 |
|
157 | /**
|
158 | * Silences all console output including error messages, regardless of other debug settings.
|
159 | * @default false
|
160 | */
|
161 | silent: boolean;
|
162 |
|
163 | /**
|
164 | * Debug output to console
|
165 | * @default false
|
166 | */
|
167 | debug: boolean;
|
168 |
|
169 | /**
|
170 | * Show console.table output with performance metrics
|
171 | * @default true
|
172 | */
|
173 | performance: boolean;
|
174 |
|
175 | /**
|
176 | * Debug output includes all internal behaviors
|
177 | * @default false
|
178 | */
|
179 | verbose: boolean;
|
180 |
|
181 | error: Accordion.ErrorSettings;
|
182 |
|
183 | // endregion
|
184 | }
|
185 |
|
186 | namespace Accordion {
|
187 | type SelectorSettings = Partial<Pick<Settings.Selectors, keyof Settings.Selectors>>;
|
188 | type ClassNameSettings = Partial<Pick<Settings.ClassNames, keyof Settings.ClassNames>>;
|
189 | type ErrorSettings = Partial<Pick<Settings.Errors, keyof Settings.Errors>>;
|
190 |
|
191 | namespace Settings {
|
192 | interface Selectors {
|
193 | /**
|
194 | * @default '.accordion'
|
195 | */
|
196 | accordion: string;
|
197 |
|
198 | /**
|
199 | * @default '.title'
|
200 | */
|
201 | title: string;
|
202 |
|
203 | /**
|
204 | * @default '.title'
|
205 | */
|
206 | trigger: string;
|
207 |
|
208 | /**
|
209 | * @default '.ui.dropdown'
|
210 | */
|
211 | ignore: string;
|
212 |
|
213 | /**
|
214 | * @default '.content'
|
215 | */
|
216 | content: string;
|
217 | }
|
218 |
|
219 | interface ClassNames {
|
220 | /**
|
221 | * @default 'active'
|
222 | */
|
223 | active: string;
|
224 |
|
225 | /**
|
226 | * @default 'animating'
|
227 | */
|
228 | animating: string;
|
229 |
|
230 | /**
|
231 | * @default 'transition'
|
232 | */
|
233 | transition: string;
|
234 | }
|
235 |
|
236 | interface Errors {
|
237 | /**
|
238 | * @default 'The method you called is not defined.'
|
239 | */
|
240 | method: string;
|
241 | }
|
242 | }
|
243 | }
|
244 | }
|