1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21/**
22 * Declare the type of status button
23 *
24 * @enum { number }
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @since 8
27 */
28/**
29 * Declare the type of status button
30 *
31 * @enum { number }
32 * @syscap SystemCapability.ArkUI.ArkUI.Full
33 * @form
34 * @since 9
35 */
36/**
37 * Declare the type of status button
38 *
39 * @enum { number }
40 * @syscap SystemCapability.ArkUI.ArkUI.Full
41 * @crossplatform
42 * @form
43 * @since 10
44 */
45/**
46 * Declare the type of status button
47 *
48 * @enum { number }
49 * @syscap SystemCapability.ArkUI.ArkUI.Full
50 * @crossplatform
51 * @form
52 * @atomicservice
53 * @since 11
54 */
55declare enum ToggleType {
56  /**
57   * Checkbox
58   *
59   * @syscap SystemCapability.ArkUI.ArkUI.Full
60   * @since 8
61   */
62  /**
63   * Checkbox
64   *
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @form
67   * @since 9
68   */
69  /**
70   * Checkbox
71   *
72   * @syscap SystemCapability.ArkUI.ArkUI.Full
73   * @crossplatform
74   * @form
75   * @since 10
76   */
77  /**
78   * Checkbox
79   *
80   * @syscap SystemCapability.ArkUI.ArkUI.Full
81   * @crossplatform
82   * @form
83   * @atomicservice
84   * @since 11
85   */
86  Checkbox,
87
88  /**
89   * Switch
90   *
91   * @syscap SystemCapability.ArkUI.ArkUI.Full
92   * @since 8
93   */
94  /**
95   * Switch
96   *
97   * @syscap SystemCapability.ArkUI.ArkUI.Full
98   * @form
99   * @since 9
100   */
101  /**
102   * Switch
103   *
104   * @syscap SystemCapability.ArkUI.ArkUI.Full
105   * @crossplatform
106   * @form
107   * @since 10
108   */
109  /**
110   * Switch
111   *
112   * @syscap SystemCapability.ArkUI.ArkUI.Full
113   * @crossplatform
114   * @form
115   * @atomicservice
116   * @since 11
117   */
118  Switch,
119
120  /**
121   * Button
122   *
123   * @syscap SystemCapability.ArkUI.ArkUI.Full
124   * @since 8
125   */
126  /**
127   * Button
128   *
129   * @syscap SystemCapability.ArkUI.ArkUI.Full
130   * @form
131   * @since 9
132   */
133  /**
134   * Button
135   *
136   * @syscap SystemCapability.ArkUI.ArkUI.Full
137   * @crossplatform
138   * @form
139   * @since 10
140   */
141  /**
142   * Button
143   *
144   * @syscap SystemCapability.ArkUI.ArkUI.Full
145   * @crossplatform
146   * @form
147   * @atomicservice
148   * @since 11
149   */
150  Button,
151}
152
153/**
154 * Defines the switch style.
155 *
156 * @interface SwitchStyle
157 * @syscap SystemCapability.ArkUI.ArkUI.Full
158 * @crossplatform
159 * @atomicservice
160 * @since 12
161 */
162declare interface SwitchStyle {
163  /**
164   * Set the radius of the point of the switch.
165   *
166   * @type { ?(number | Resource) }
167   * @syscap SystemCapability.ArkUI.ArkUI.Full
168   * @crossplatform
169   * @atomicservice
170   * @since 12
171   */
172  pointRadius?: number | Resource;
173
174  /**
175   * Set the color of the unselected switch.
176   *
177   * @type { ?ResourceColor }
178   * @syscap SystemCapability.ArkUI.ArkUI.Full
179   * @crossplatform
180   * @atomicservice
181   * @since 12
182   */
183  unselectedColor?: ResourceColor;
184
185  /**
186   * Set the color of the point of the switch.
187   *
188   * @type { ?ResourceColor }
189   * @syscap SystemCapability.ArkUI.ArkUI.Full
190   * @crossplatform
191   * @atomicservice
192   * @since 12
193   */
194  pointColor?: ResourceColor;
195
196  /**
197   * Set the border radius of the track of the switch.
198   *
199   * @type { ?(number | Resource) }
200   * @syscap SystemCapability.ArkUI.ArkUI.Full
201   * @crossplatform
202   * @atomicservice
203   * @since 12
204   */
205  trackBorderRadius?: number | Resource;
206}
207
208/**
209 * ToggleConfiguration used by toggle Modifier
210 *
211 * @interface ToggleConfiguration
212 * @syscap SystemCapability.ArkUI.ArkUI.Full
213 * @crossplatform
214 * @atomicservice
215 * @since 12
216 */
217declare interface ToggleConfiguration extends CommonConfiguration<ToggleConfiguration> {
218
219  /**
220   * Indicates whether the Toggle is on.
221   *
222   * @type { boolean }
223   * @syscap SystemCapability.ArkUI.ArkUI.Full
224   * @crossplatform
225   * @atomicservice
226   * @since 12
227   */
228  isOn: boolean;
229
230  /**
231   * Indicates whether the Toggle is enabled.
232   *
233   * @type { boolean }
234   * @syscap SystemCapability.ArkUI.ArkUI.Full
235   * @crossplatform
236   * @atomicservice
237   * @since 12
238   */
239  enabled: boolean;
240
241  /**
242   * Trigger toggle select change
243   *
244   * @type { Callback<boolean> }
245   * @syscap SystemCapability.ArkUI.ArkUI.Full
246   * @crossplatform
247   * @atomicservice
248   * @since 12
249   */
250  triggerChange: Callback<boolean>;
251}
252
253/**
254 * Defines the toggle options.
255 *
256 * @interface ToggleOptions
257 * @syscap SystemCapability.ArkUI.ArkUI.Full
258 * @crossplatform
259 * @form
260 * @atomicservice
261 * @since 13
262 */
263declare interface ToggleOptions {
264  /**
265   * Type of the toggle.
266   *
267   * @type { ToggleType }
268   * @syscap SystemCapability.ArkUI.ArkUI.Full
269   * @since 8
270   */
271  /**
272   * Type of the toggle.
273   *
274   * @type { ToggleType }
275   * @syscap SystemCapability.ArkUI.ArkUI.Full
276   * @form
277   * @since 9
278   */
279  /**
280   * Type of the toggle.
281   *
282   * @type { ToggleType }
283   * @syscap SystemCapability.ArkUI.ArkUI.Full
284   * @crossplatform
285   * @form
286   * @since 10
287   */
288  /**
289   * Type of the toggle.
290   *
291   * @type { ToggleType }
292   * @syscap SystemCapability.ArkUI.ArkUI.Full
293   * @crossplatform
294   * @form
295   * @atomicservice
296   * @since 11
297   */
298  type: ToggleType;
299
300  /**
301   * Whether the toggle is on.
302   *
303   * @type { ?boolean }
304   * @syscap SystemCapability.ArkUI.ArkUI.Full
305   * @since 8
306   */
307  /**
308   * Whether the toggle is on.
309   *
310   * @type { ?boolean }
311   * @syscap SystemCapability.ArkUI.ArkUI.Full
312   * @form
313   * @since 9
314   */
315  /**
316   * Whether the toggle is on.
317   *
318   * @type { ?boolean }
319   * @syscap SystemCapability.ArkUI.ArkUI.Full
320   * @crossplatform
321   * @form
322   * @since 10
323   */
324  /**
325   * Whether the toggle is on.
326   *
327   * @type { ?boolean }
328   * @syscap SystemCapability.ArkUI.ArkUI.Full
329   * @crossplatform
330   * @form
331   * @atomicservice
332   * @since 11
333   */
334  isOn?: boolean
335}
336
337/**
338 * Defines the toggle interface.
339 *
340 * @interface ToggleInterface
341 * @syscap SystemCapability.ArkUI.ArkUI.Full
342 * @since 8
343 */
344/**
345 * Defines the toggle interface.
346 *
347 * @interface ToggleInterface
348 * @syscap SystemCapability.ArkUI.ArkUI.Full
349 * @form
350 * @since 9
351 */
352/**
353 * Defines the toggle interface.
354 *
355 * @interface ToggleInterface
356 * @syscap SystemCapability.ArkUI.ArkUI.Full
357 * @crossplatform
358 * @form
359 * @since 10
360 */
361/**
362 * Defines the toggle interface.
363 *
364 * @interface ToggleInterface
365 * @syscap SystemCapability.ArkUI.ArkUI.Full
366 * @crossplatform
367 * @form
368 * @atomicservice
369 * @since 11
370 */
371interface ToggleInterface {
372  /**
373   * Set parameters to obtain the toggle.
374   *
375   * @param { object } options
376   * @returns { ToggleAttribute }
377   * @syscap SystemCapability.ArkUI.ArkUI.Full
378   * @since 8
379   */
380  /**
381   * Set parameters to obtain the toggle.
382   *
383   * @param { object } options
384   * @returns { ToggleAttribute }
385   * @syscap SystemCapability.ArkUI.ArkUI.Full
386   * @form
387   * @since 9
388   */
389  /**
390   * Set parameters to obtain the toggle.
391   *
392   * @param { object } options
393   * @returns { ToggleAttribute }
394   * @syscap SystemCapability.ArkUI.ArkUI.Full
395   * @crossplatform
396   * @form
397   * @since 10
398   */
399  /**
400   * Set parameters to obtain the toggle.
401   *
402   * @param { object } options
403   * @returns { ToggleAttribute }
404   * @syscap SystemCapability.ArkUI.ArkUI.Full
405   * @crossplatform
406   * @form
407   * @atomicservice
408   * @since 11
409   */
410  /**
411   * Set parameters to obtain the toggle.
412   *
413   * @param { ToggleOptions } options - toggle options
414   * @returns { ToggleAttribute }
415   * @syscap SystemCapability.ArkUI.ArkUI.Full
416   * @crossplatform
417   * @form
418   * @atomicservice
419   * @since 13
420   */
421  (options: ToggleOptions): ToggleAttribute;
422}
423
424/**
425 * Defines the toggle attribute functions
426 *
427 * @extends CommonMethod<ToggleAttribute>
428 * @syscap SystemCapability.ArkUI.ArkUI.Full
429 * @since 8
430 */
431/**
432 * Defines the toggle attribute functions
433 *
434 * @extends CommonMethod<ToggleAttribute>
435 * @syscap SystemCapability.ArkUI.ArkUI.Full
436 * @form
437 * @since 9
438 */
439/**
440 * Defines the toggle attribute functions
441 *
442 * @extends CommonMethod<ToggleAttribute>
443 * @syscap SystemCapability.ArkUI.ArkUI.Full
444 * @crossplatform
445 * @form
446 * @since 10
447 */
448/**
449 * Defines the toggle attribute functions
450 *
451 * @extends CommonMethod<ToggleAttribute>
452 * @syscap SystemCapability.ArkUI.ArkUI.Full
453 * @crossplatform
454 * @form
455 * @atomicservice
456 * @since 11
457 */
458declare class ToggleAttribute extends CommonMethod<ToggleAttribute> {
459  /**
460   * Called when the selected state of the component changes.
461   *
462   * @param { function } callback
463   * @returns { ToggleAttribute }
464   * @syscap SystemCapability.ArkUI.ArkUI.Full
465   * @since 8
466   */
467  /**
468   * Called when the selected state of the component changes.
469   *
470   * @param { function } callback
471   * @returns { ToggleAttribute }
472   * @syscap SystemCapability.ArkUI.ArkUI.Full
473   * @form
474   * @since 9
475   */
476  /**
477   * Called when the selected state of the component changes.
478   *
479   * @param { function } callback
480   * @returns { ToggleAttribute }
481   * @syscap SystemCapability.ArkUI.ArkUI.Full
482   * @crossplatform
483   * @form
484   * @since 10
485   */
486  /**
487   * Called when the selected state of the component changes.
488   *
489   * @param { function } callback
490   * @returns { ToggleAttribute }
491   * @syscap SystemCapability.ArkUI.ArkUI.Full
492   * @crossplatform
493   * @form
494   * @atomicservice
495   * @since 11
496   */
497  onChange(callback: (isOn: boolean) => void): ToggleAttribute;
498
499  /**
500   * Set the content modifier of toggle.
501   *
502   * @param { ContentModifier<ToggleConfiguration> } modifier - The content modifier of toggle.
503   * @returns { ToggleAttribute }
504   * @syscap SystemCapability.ArkUI.ArkUI.Full
505   * @crossplatform
506   * @atomicservice
507   * @since 12
508   */
509  contentModifier(modifier: ContentModifier<ToggleConfiguration>): ToggleAttribute;
510
511  /**
512   * Called when the color of the selected button is set.
513   *
514   * @param { ResourceColor } value
515   * @returns { ToggleAttribute }
516   * @syscap SystemCapability.ArkUI.ArkUI.Full
517   * @since 8
518   */
519  /**
520   * Called when the color of the selected button is set.
521   *
522   * @param { ResourceColor } value
523   * @returns { ToggleAttribute }
524   * @syscap SystemCapability.ArkUI.ArkUI.Full
525   * @form
526   * @since 9
527   */
528  /**
529   * Called when the color of the selected button is set.
530   *
531   * @param { ResourceColor } value
532   * @returns { ToggleAttribute }
533   * @syscap SystemCapability.ArkUI.ArkUI.Full
534   * @crossplatform
535   * @form
536   * @since 10
537   */
538  /**
539   * Called when the color of the selected button is set.
540   *
541   * @param { ResourceColor } value
542   * @returns { ToggleAttribute }
543   * @syscap SystemCapability.ArkUI.ArkUI.Full
544   * @crossplatform
545   * @form
546   * @atomicservice
547   * @since 11
548   */
549  selectedColor(value: ResourceColor): ToggleAttribute;
550
551  /**
552   * Called when the color of the selected button is set.
553   *
554   * @param { ResourceColor } color
555   * @returns { ToggleAttribute }
556   * @syscap SystemCapability.ArkUI.ArkUI.Full
557   * @since 8
558   */
559  /**
560   * Called when the color of the selected button is set.
561   *
562   * @param { ResourceColor } color
563   * @returns { ToggleAttribute }
564   * @syscap SystemCapability.ArkUI.ArkUI.Full
565   * @form
566   * @since 9
567   */
568  /**
569   * Called when the color of the selected button is set.
570   *
571   * @param { ResourceColor } color
572   * @returns { ToggleAttribute }
573   * @syscap SystemCapability.ArkUI.ArkUI.Full
574   * @crossplatform
575   * @form
576   * @since 10
577   */
578  /**
579   * Called when the color of the selected button is set.
580   *
581   * @param { ResourceColor } color
582   * @returns { ToggleAttribute }
583   * @syscap SystemCapability.ArkUI.ArkUI.Full
584   * @crossplatform
585   * @form
586   * @atomicservice
587   * @since 11
588   */
589  switchPointColor(color: ResourceColor): ToggleAttribute;
590
591  /**
592   * Set the style of the switch.
593   *
594   * @param { SwitchStyle } value
595   * @returns { ToggleAttribute }
596   * @syscap SystemCapability.ArkUI.ArkUI.Full
597   * @crossplatform
598   * @atomicservice
599   * @since 12
600   */
601  switchStyle(value: SwitchStyle): ToggleAttribute;
602}
603
604/**
605 * Defines Toggle Component.
606 *
607 * @syscap SystemCapability.ArkUI.ArkUI.Full
608 * @since 8
609 */
610/**
611 * Defines Toggle Component.
612 *
613 * @syscap SystemCapability.ArkUI.ArkUI.Full
614 * @form
615 * @since 9
616 */
617/**
618 * Defines Toggle Component.
619 *
620 * @syscap SystemCapability.ArkUI.ArkUI.Full
621 * @crossplatform
622 * @form
623 * @since 10
624 */
625/**
626 * Defines Toggle Component.
627 *
628 * @syscap SystemCapability.ArkUI.ArkUI.Full
629 * @crossplatform
630 * @form
631 * @atomicservice
632 * @since 11
633 */
634declare const Toggle: ToggleInterface;
635
636/**
637 * Defines Toggle Component instance.
638 *
639 * @syscap SystemCapability.ArkUI.ArkUI.Full
640 * @since 8
641 */
642/**
643 * Defines Toggle Component instance.
644 *
645 * @syscap SystemCapability.ArkUI.ArkUI.Full
646 * @form
647 * @since 9
648 */
649/**
650 * Defines Toggle Component instance.
651 *
652 * @syscap SystemCapability.ArkUI.ArkUI.Full
653 * @crossplatform
654 * @form
655 * @since 10
656 */
657/**
658 * Defines Toggle Component instance.
659 *
660 * @syscap SystemCapability.ArkUI.ArkUI.Full
661 * @crossplatform
662 * @form
663 * @atomicservice
664 * @since 11
665 */
666declare const ToggleInstance: ToggleAttribute;
667