1/* 2 * Copyright (c) 2021 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 * Provides a button component. 18 * @since 7 19 */ 20declare enum ButtonType { 21 /** 22 * Capsule button (rounded corners default to half the height). 23 * @since 7 24 */ 25 Capsule, 26 27 /** 28 * Round buttons. 29 * @since 7 30 */ 31 Circle, 32 33 /** 34 * Common button (no rounded corners by default). 35 * @since 7 36 */ 37 Normal, 38} 39 40/** 41 * Defines the button options. 42 * @since 7 43 */ 44declare interface ButtonOptions { 45 /** 46 * Describes the button style. 47 * @since 7 48 */ 49 type?: ButtonType; 50 51 /** 52 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 53 * @since 7 54 */ 55 stateEffect?: boolean; 56} 57 58/** 59 * Defines the Button Component. 60 * @since 7 61 */ 62interface ButtonInterface { 63 /** 64 * Button object 65 * @since 7 66 */ 67 (): ButtonAttribute; 68 69 /** 70 * Create Button with Text child. 71 * @since 7 72 */ 73 (options: ButtonOptions): ButtonAttribute; 74 75 /** 76 * Create Button with inner text label. 77 * @since 7 78 */ 79 (label: ResourceStr, options?: ButtonOptions): ButtonAttribute; 80} 81 82/** 83 * Defines the button attribute functions. 84 * @since 7 85 */ 86declare class ButtonAttribute extends CommonMethod<ButtonAttribute> { 87 /** 88 * Describes the button style. 89 * @since 7 90 */ 91 type(value: ButtonType): ButtonAttribute; 92 93 /** 94 * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled. 95 * @since 7 96 */ 97 stateEffect(value: boolean): ButtonAttribute; 98 99 /** 100 * Text color. 101 * @since 7 102 */ 103 fontColor(value: ResourceColor): ButtonAttribute; 104 105 /** 106 * Text size. 107 * @since 7 108 */ 109 fontSize(value: Length): ButtonAttribute; 110 111 /** 112 * Font weight. 113 * @since 7 114 */ 115 fontWeight(value: number | FontWeight | string): ButtonAttribute; 116 117 /** 118 * Font style. 119 * @since 8 120 */ 121 fontStyle(value: FontStyle): ButtonAttribute; 122 123 /** 124 * Font family. 125 * @since 8 126 */ 127 fontFamily(value: string | Resource): ButtonAttribute; 128} 129 130declare const Button: ButtonInterface; 131declare const ButtonInstance: ButtonAttribute; 132