1/*
2* Copyright (C) 2024 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
22import { ChipSize, ChipSymbolGlyphOptions } from '@ohos.arkui.advanced.Chip';
23import { SymbolGlyphModifier } from './@ohos.arkui.modifier';
24
25/**
26 * Defines icon options.
27 *
28 * @interface IconOptions
29 * @syscap SystemCapability.ArkUI.ArkUI.Full
30 * @crossplatform
31 * @atomicservice
32 * @since 12
33 */
34export interface IconOptions {
35
36    /**
37     * Image resource.
38     *
39     * @type { ResourceStr }
40     * @syscap SystemCapability.ArkUI.ArkUI.Full
41     * @crossplatform
42     * @atomicservice
43     * @since 12
44     */
45    src: ResourceStr;
46
47    /**
48     * Image size option.
49     *
50     * @type { ?SizeOptions }
51     * @syscap SystemCapability.ArkUI.ArkUI.Full
52     * @crossplatform
53     * @atomicservice
54     * @since 12
55     */
56    size?: SizeOptions;
57}
58
59/**
60 * Defines label options.
61 *
62 * @interface LabelOptions
63 * @syscap SystemCapability.ArkUI.ArkUI.Full
64 * @crossplatform
65 * @atomicservice
66 * @since 12
67 */
68export interface LabelOptions {
69
70    /**
71     * Text content.
72     *
73     * @type { string }
74     * @syscap SystemCapability.ArkUI.ArkUI.Full
75     * @crossplatform
76     * @atomicservice
77     * @since 12
78     */
79    text: string;
80}
81
82
83/**
84 * Defines chipItem options.
85 *
86 * @interface ChipGroupItemOptions
87 * @syscap SystemCapability.ArkUI.ArkUI.Full
88 * @crossplatform
89 * @atomicservice
90 * @since 12
91 */
92export interface ChipGroupItemOptions {
93
94    /**
95     * Prefix icon.
96     *
97     * @type { ?IconOptions }
98     * @syscap SystemCapability.ArkUI.ArkUI.Full
99     * @crossplatform
100     * @atomicservice
101     * @since 12
102     */
103    prefixIcon?: IconOptions;
104
105    /**
106     * Prefix symbol.
107     *
108     * @type { ?ChipSymbolGlyphOptions }
109     * @syscap SystemCapability.ArkUI.ArkUI.Full
110     * @crossplatform
111     * @atomicservice
112     * @since 12
113     */
114    prefixSymbol?: ChipSymbolGlyphOptions;
115
116    /**
117     * Chip label.
118     *
119     * @type { LabelOptions }
120     * @syscap SystemCapability.ArkUI.ArkUI.Full
121     * @crossplatform
122     * @atomicservice
123     * @since 12
124     */
125    label: LabelOptions;
126
127    /**
128     * Suffix icon.
129     *
130     * @type { ?IconOptions }
131     * @syscap SystemCapability.ArkUI.ArkUI.Full
132     * @crossplatform
133     * @atomicservice
134     * @since 12
135     */
136    suffixIcon?: IconOptions;
137
138    /**
139     * suffix symbol.
140     *
141     * @type { ?ChipSymbolGlyphOptions }
142     * @syscap SystemCapability.ArkUI.ArkUI.Full
143     * @crossplatform
144     * @atomicservice
145     * @since 12
146     */
147    suffixSymbol?: ChipSymbolGlyphOptions;
148
149    /**
150     * Allow close.
151     *
152     * @type { ?boolean }
153     * @syscap SystemCapability.ArkUI.ArkUI.Full
154     * @crossplatform
155     * @atomicservice
156     * @since 12
157     */
158    allowClose?: boolean;
159}
160
161
162/**
163 * Defines ChipItemStyle.
164 *
165 * @interface ChipItemStyle
166 * @syscap SystemCapability.ArkUI.ArkUI.Full
167 * @crossplatform
168 * @atomicservice
169 * @since 12
170 */
171export interface ChipItemStyle {
172
173    /**
174     * Chip size.
175     *
176     * @type { ?(ChipSize | SizeOptions) }
177     * @syscap SystemCapability.ArkUI.ArkUI.Full
178     * @crossplatform
179     * @atomicservice
180     * @since 12
181     */
182    size?: ChipSize | SizeOptions;
183
184    /**
185     * ChipItem background color.
186     *
187     * @type { ?ResourceColor }
188     * @syscap SystemCapability.ArkUI.ArkUI.Full
189     * @crossplatform
190     * @atomicservice
191     * @since 12
192     */
193    backgroundColor?: ResourceColor;
194
195    /**
196     * Text font color.
197     *
198     * @type { ?ResourceColor }
199     * @syscap SystemCapability.ArkUI.ArkUI.Full
200     * @crossplatform
201     * @atomicservice
202     * @since 12
203     */
204    fontColor?: ResourceColor;
205
206    /**
207     * Selected Text font color.
208     *
209     * @type { ?ResourceColor }
210     * @syscap SystemCapability.ArkUI.ArkUI.Full
211     * @crossplatform
212     * @atomicservice
213     * @since 12
214     */
215    selectedFontColor?: ResourceColor;
216
217    /**
218     * Selected chip item background color.
219     *
220     * @type { ?ResourceColor }
221     * @syscap SystemCapability.ArkUI.ArkUI.Full
222     * @crossplatform
223     * @atomicservice
224     * @since 12
225     */
226    selectedBackgroundColor?: ResourceColor;
227}
228
229
230/**
231 * Defines chip group space.
232 *
233 * @interface ChipGroupSpaceOptions
234 * @syscap SystemCapability.ArkUI.ArkUI.Full
235 * @crossplatform
236 * @atomicservice
237 * @since 12
238 */
239export interface ChipGroupSpaceOptions {
240
241    /**
242     * Space between items.
243     *
244     * @type { ?(string | number) }
245     * @syscap SystemCapability.ArkUI.ArkUI.Full
246     * @crossplatform
247     * @atomicservice
248     * @since 12
249     */
250    itemSpace?: string | number;
251
252    /**
253     * Start space.
254     *
255     * @type { ?Length }
256     * @syscap SystemCapability.ArkUI.ArkUI.Full
257     * @crossplatform
258     * @atomicservice
259     * @since 12
260     */
261    startSpace?: Length;
262
263    /**
264     * End space.
265     *
266     * @type { ?Length }
267     * @syscap SystemCapability.ArkUI.ArkUI.Full
268     * @crossplatform
269     * @atomicservice
270     * @since 12
271     */
272    endSpace?: Length;
273}
274
275/**
276 * Defines IconItemOptions.
277 *
278 * @interface IconItemOptions
279 * @syscap SystemCapability.ArkUI.ArkUI.Full
280 * @crossplatform
281 * @atomicservice
282 * @since 12
283 */
284export interface IconItemOptions {
285    /**
286     * IconOptions.
287     *
288     * @type { IconOptions }
289     * @syscap SystemCapability.ArkUI.ArkUI.Full
290     * @crossplatform
291     * @atomicservice
292     * @since 12
293     */
294    icon: IconOptions;
295
296    /**
297     * Icon Action.
298     *
299     * @type { Callback<void> }
300     * @syscap SystemCapability.ArkUI.ArkUI.Full
301     * @crossplatform
302     * @atomicservice
303     * @since 12
304     */
305    action: Callback<void>;
306}
307
308/**
309 * Defines ChipGroupPaddingOptions.
310 *
311 * @interface ChipGroupPaddingOptions
312 * @syscap SystemCapability.ArkUI.ArkUI.Full
313 * @crossplatform
314 * @atomicservice
315 * @since 12
316 */
317export interface ChipGroupPaddingOptions {
318    /**
319     * Top of chip group padding.
320     *
321     * @type { Length }
322     * @syscap SystemCapability.ArkUI.ArkUI.Full
323     * @crossplatform
324     * @atomicservice
325     * @since 12
326     */
327    top: Length;
328
329    /**
330     * Bottom of chip group padding.
331     *
332     * @type { Length }
333     * @syscap SystemCapability.ArkUI.ArkUI.Full
334     * @crossplatform
335     * @atomicservice
336     * @since 12
337     */
338    bottom: Length;
339}
340
341/**
342 * Defines IconGroupSuffix.
343 *
344 * @interface IconGroupSuffix
345 * @syscap SystemCapability.ArkUI.ArkUI.Full
346 * @crossplatform
347 * @atomicservice
348 * @since 12
349 */
350@Component
351export declare struct IconGroupSuffix {
352    /**
353     * Suffix item.
354     *
355     * @type { Array<IconItemOptions | SymbolGlyphModifier> }
356     * @syscap SystemCapability.ArkUI.ArkUI.Full
357     * @crossplatform
358     * @atomicservice
359     * @since 12
360     */
361    @Require @Prop
362    items: Array<IconItemOptions | SymbolGlyphModifier>;
363}
364
365
366/**
367 * Defines chipGroup.
368 *
369 * @struct ChipGroup
370 * @syscap SystemCapability.ArkUI.ArkUI.Full
371 * @crossplatform
372 * @atomicservice
373 * @since 12
374 */
375@Component
376export declare struct ChipGroup {
377
378    /**
379     * Chip item.
380     *
381     * @type { ChipGroupItemOptions[] }
382     * @syscap SystemCapability.ArkUI.ArkUI.Full
383     * @crossplatform
384     * @atomicservice
385     * @since 12
386     */
387    @Require @Prop
388    items: ChipGroupItemOptions[];
389
390    /**
391     * Chip item style.
392     *
393     * @type { ?ChipItemStyle }
394     * @syscap SystemCapability.ArkUI.ArkUI.Full
395     * @crossplatform
396     * @atomicservice
397     * @since 12
398     */
399    @Prop
400    itemStyle?: ChipItemStyle;
401
402    /**
403     * Default selected chip item indexes.
404     *
405     * @type { ?Array<number> }
406     * @syscap SystemCapability.ArkUI.ArkUI.Full
407     * @crossplatform
408     * @atomicservice
409     * @since 12
410     */
411    @Prop
412    selectedIndexes?: Array<number>;
413
414    /**
415     * Support multiple chip item selection.
416     *
417     * @type { ?boolean }
418     * @syscap SystemCapability.ArkUI.ArkUI.Full
419     * @crossplatform
420     * @atomicservice
421     * @since 12
422     */
423    @Prop
424    multiple?: boolean;
425
426    /**
427     * Chip group space.
428     *
429     * @type { ?ChipGroupSpaceOptions }
430     * @syscap SystemCapability.ArkUI.ArkUI.Full
431     * @crossplatform
432     * @atomicservice
433     * @since 12
434     */
435    @Prop
436    chipGroupSpace?: ChipGroupSpaceOptions;
437
438     /**
439     * Chip group padding (only support top and bottom).
440     *
441     * @type { ?ChipGroupPaddingOptions }
442     * @syscap SystemCapability.ArkUI.ArkUI.Full
443     * @crossplatform
444     * @atomicservice
445     * @since 12
446     */
447    @Prop
448    chipGroupPadding?: ChipGroupPaddingOptions;
449
450    /**
451     * Chip group callback.
452     *
453     * @type { ?Callback<Array<number>> }
454     * @syscap SystemCapability.ArkUI.ArkUI.Full
455     * @crossplatform
456     * @atomicservice
457     * @since 12
458     */
459    onChange?: Callback<Array<number>>;
460
461    /**
462     * The builder function which will be rendered in the suffix of ChipGroup.
463     *
464     * @type { ?Callback<void> }
465     * @syscap SystemCapability.ArkUI.ArkUI.Full
466     * @crossplatform
467     * @atomicservice
468     * @since 12
469     */
470    @BuilderParam
471    suffix?: Callback<void>;
472}