diff --git a/api/@ohos.arkui.advanced.ChipV2.d.ets b/api/@ohos.arkui.advanced.ChipV2.d.ets new file mode 100644 index 0000000000000000000000000000000000000000..56e2218270944c3b463fc170a6e0eb76d2eaa24f --- /dev/null +++ b/api/@ohos.arkui.advanced.ChipV2.d.ets @@ -0,0 +1,712 @@ +/* +* Copyright (C) 2025 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** + * @file + * @kit ArkUI + */ + +import { SymbolGlyphModifier } from './@ohos.arkui.modifier'; + +/** + * Enum for AccessibilitySelectedType + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export declare enum ChipV2AccessibilitySelectedType { + /** + * Default type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + CLICKED = 0, + + /** + * Checked type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + CHECKED = 1, + + /** + * Selected type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + SELECTED = 2 +} + +/** + * Defines the icon common option. + * + * @interface ChipV2IconCommonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2IconCommonOptions { + /** + * Image resource. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + src: ResourceStr; + + /** + * Image size option. + * + * @type { ?SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + size?: SizeOptions; + + /** + * Image filled color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + fillColor?: ResourceColor; + + /** + * Image filled color when chip is activated. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + activatedFillColor?: ResourceColor; +} + +/** + * Defines the suffix icon option. + * + * @interface ChipV2SuffixIconOptions + * @extends ChipV2IconCommonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2SuffixIconOptions extends ChipV2IconCommonOptions { + /** + * Called when the suffix icon is clicked. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + action?: Callback; + + /** + * Set accessibility text for icon. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityText?: ResourceStr; + + /** + * Set accessibility description for icon. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityDescription?: ResourceStr; + + /** + * Set accessibility level for icon. + * + * @type { ?string } + * @default "auto" + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityLevel?: string; +} + +/** + * Defines the prefix icon option. + * + * @interface ChipV2PrefixIconOptions + * @extends ChipV2IconCommonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2PrefixIconOptions extends ChipV2IconCommonOptions {} + +/** + * Defines accessibility icon options. + * + * @interface ChipV2AccessibilityOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2AccessibilityOptions { + /** + * Set accessibility level for accessibility icon. + * + * @type { ?string } + * @default "auto" + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityLevel?: string; + + /** + * Set accessibility text for accessibility icon. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityText?: ResourceStr; + + /** + * Set accessibility description for accessibility icon. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityDescription?: ResourceStr; +} + +/** + * Defines accessibility options of default close icon. + * + * @interface ChipV2CloseOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2CloseOptions extends ChipV2AccessibilityOptions {} + +/** + * Defines chip symbolglyph options. + * + * @interface ChipV2SymbolGlyphOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ +export interface ChipV2SymbolGlyphOptions { + /** + * Symbol normal. + * + * @type { ?SymbolGlyphModifier } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + normal?: SymbolGlyphModifier; + + /** + * Symbol activated. + * + * @type { ?SymbolGlyphModifier } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + activated?: SymbolGlyphModifier; +} + +/** + * Defines accessibility options of suffix symbol. + * + * @interface ChipV2SuffixSymbolGlyphOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2SuffixSymbolGlyphOptions { + /** + * Set normal accessibility options for suffix symbol. + * + * @type { ?ChipV2AccessibilityOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + normalAccessibility?: ChipV2AccessibilityOptions; + + /** + * Set activated accessibility options for suffix symbol. + * + * @type { ?ChipV2AccessibilityOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + activatedAccessibility?: ChipV2AccessibilityOptions; + + /** + * Called when the suffix symbol is clicked. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + action?: Callback; +} + +/** + * Defines label margin. + * + * @interface ChipV2LabelMarginOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2LabelMarginOptions { + /** + * Left label margin length. + * + * @type { ?LengthMetrics } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + left?: LengthMetrics; + + /** + * Right label margin length. + * + * @type { ?LengthMetrics } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + right?: LengthMetrics; +} + +/** + * Defines localized label margin. + * + * @interface ChipV2LocalizedLabelMarginOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2LocalizedLabelMarginOptions { + /** + * start localized label margin length. + * + * @type { ?LengthMetrics } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + start?: LengthMetrics; + + /** + * end localized label margin length. + * + * @type { ?LengthMetrics } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + end?: LengthMetrics; +} + +/** + * Defines label option. + * + * @interface ChipV2LabelOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2LabelOptions { + /** + * Text content. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + text: string; + + /** + * Text font size. + * + * @type { ?LengthMetrics } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + fontSize?: LengthMetrics; + + /** + * Text font color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + fontColor?: ResourceColor; + + /** + * Text font color when chip is activated. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + activatedFontColor?: ResourceColor; + + /** + * Text font family. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + fontFamily?: string; + + /** + * Label margin. + * + * @type { ?ChipV2LabelMarginOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + labelMargin?: ChipV2LabelMarginOptions; + + /** + * Localized label margin. + * + * @type { ?ChipV2LocalizedLabelMarginOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + localizedLabelMargin?: ChipV2LocalizedLabelMarginOptions; +} + +/** + * Defines chip options. + * + * @interface ChipV2Options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +export interface ChipV2Options { + /** + * Chip prefix icon. + * + * @type { ?ChipV2PrefixIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + prefixIcon?: ChipV2PrefixIconOptions; + + /** + * Chip prefix symbol. + * + * @type { ?ChipV2SymbolGlyphOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + prefixSymbol?: ChipV2SymbolGlyphOptions; + + /** + * Chip label. + * + * @type { ChipV2LabelOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + label: ChipV2LabelOptions; + + /** + * Chip suffix icon. + * + * @type { ?ChipV2SuffixIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + suffixIcon?: ChipV2SuffixIconOptions; + + /** + * Chip suffix symbol. + * + * @type { ?ChipV2SymbolGlyphOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + suffixSymbol?: ChipV2SymbolGlyphOptions; + + /** + * Set options for suffix symbol. + * + * @type { ?ChipV2SuffixSymbolGlyphOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + suffixSymbolOptions?: ChipV2SuffixSymbolGlyphOptions; + + /** + * Show close icon. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + allowClose?: boolean; + + /** + * Set options for default close icon when 'allowClose' is true. + * + * @type { ?ChipV2CloseOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + closeOptions?: ChipV2CloseOptions; + + /** + * Enable chip. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + enabled?: boolean; + + /** + * Set whether chip is active or not. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + activated?: boolean; + + /** + * Chip background color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + backgroundColor?: ResourceColor; + + /** + * Chip background color when chip is activated. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + activatedBackgroundColor?: ResourceColor; + + /** + * Chip radius. + * + * @type { ?LengthMetrics } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + borderRadius?: LengthMetrics; + + /** + * Chip size. + * + * @type { ?ControlSize | SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + size?: ControlSize | SizeOptions; + + /** + * On close action. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onClose?: Callback; + + /** + * On clicked action. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + onClicked?: Callback; + + /** + * Indicates the attribute of the current chip direction. + * + * @type { ?Direction } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + direction?: Direction; + + /** + * Set accessibility description for Chip. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityDescription?: ResourceStr; + + /** + * Set accessibility level for Chip. + * + * @type { ?string } + * @default "auto" + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilityLevel?: string; + + /** + * Set accessibility selected type for Chip. + * + * @type { ?ChipV2AccessibilitySelectedType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + accessibilitySelectedType?: ChipV2AccessibilitySelectedType; +} + +/** + * Build function of Chip. + * + * @param { ChipV2Options } options - chip option. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +@Builder +export declare function ChipV2(options: ChipV2Options): void; \ No newline at end of file diff --git a/kits/@kit.ArkUI.d.ts b/kits/@kit.ArkUI.d.ts index 5330da3d78dade9e8afec248b9bead3d7feff9f1..bab7ec2fd081825b5a465240be3a988cc6b3e24e 100644 --- a/kits/@kit.ArkUI.d.ts +++ b/kits/@kit.ArkUI.d.ts @@ -224,6 +224,12 @@ import { MultiCapsuleSegmentButtonV2 } from '@ohos.arkui.advanced.SegmentButtonV2'; import { HalfScreenLaunchComponent } from '@ohos.atomicservice.HalfScreenLaunchComponent'; +import { + ChipV2, ChipV2Options, ChipV2AccessibilitySelectedType, ChipV2AccessibilityOptions, + ChipV2IconCommonOptions, ChipV2PrefixIconOptions, ChipV2SuffixIconOptions, + ChipV2SymbolGlyphOptions, ChipV2SuffixSymbolGlyphOptions, ChipV2CloseOptions, + ChipV2LabelOptions, ChipV2LabelMarginOptions, ChipV2LocalizedLabelMarginOptions +} from '@ohos.arkui.advanced.ChipV2'; export { AtomicServiceSearch, InputFilterParams, SearchButtonParams, MenuAlignParams, SearchParams, SelectParams, OperationParams, AddFormMenuItem, AddFormOptions, AlertDialog, Animator, AnimatorOptions, AnimatorResult, SimpleAnimatorOptions, App, AppResponse, AtomicServiceBar, @@ -296,5 +302,8 @@ export { SegmentButtonV2ItemOptions, OnSelectedIndexChange, OnSelectedIndexesChange, SegmentButtonV2Item, SegmentButtonV2Items, TabSegmentButtonV2, CapsuleSegmentButtonV2, MultiCapsuleSegmentButtonV2, AlertDialogV2, AdvancedDialogV2Button, AdvancedDialogV2ButtonOptions, AdvancedDialogV2ButtonAction, AdvancedDialogV2OnCheckedChange, ConfirmDialogV2, LoadingDialogV2, SelectDialogV2, TipsDialogV2, CustomContentDialogV2, PopoverDialogV2, PopoverDialogV2OnVisibleChange, PopoverDialogV2Options, ExpandMode, - HalfScreenLaunchComponent, ArcSliderPosition, ArcSwiper, ArcSwiperAttribute, ArcDotIndicator, ArcDirection, ArcSwiperController, TargetInfo, + HalfScreenLaunchComponent, ArcSliderPosition, ArcSwiper, ArcSwiperAttribute, ArcDotIndicator, ArcDirection, ArcSwiperController, TargetInfo, ChipV2, ChipV2Options, ChipV2AccessibilitySelectedType, ChipV2AccessibilityOptions, + ChipV2IconCommonOptions, ChipV2PrefixIconOptions, ChipV2SuffixIconOptions, + ChipV2SymbolGlyphOptions, ChipV2SuffixSymbolGlyphOptions, ChipV2CloseOptions, + ChipV2LabelOptions, ChipV2LabelMarginOptions, ChipV2LocalizedLabelMarginOptions, };