Skip to content

Commit 38927f3

Browse files
committed
feat(accordion-group): add shape property
1 parent 6ef3529 commit 38927f3

File tree

6 files changed

+42
-4
lines changed

6 files changed

+42
-4
lines changed

core/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ion-accordion-group,prop,expand,"compact" | "inset",'compact',false,false
1818
ion-accordion-group,prop,mode,"ios" | "md",undefined,false,false
1919
ion-accordion-group,prop,multiple,boolean | undefined,undefined,false,false
2020
ion-accordion-group,prop,readonly,boolean,false,false,false
21+
ion-accordion-group,prop,shape,"rectangular" | "round" | "soft" | undefined,undefined,false,false
2122
ion-accordion-group,prop,theme,"ios" | "md" | "ionic",undefined,false,false
2223
ion-accordion-group,prop,value,null | string | string[] | undefined,undefined,false,false
2324
ion-accordion-group,event,ionChange,AccordionGroupChangeEventDetail<any>,true

core/src/components.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ export namespace Components {
136136
* This method is used to ensure that the value of ion-accordion-group is being set in a valid way. This method should only be called in response to a user generated action.
137137
*/
138138
"requestAccordionToggle": (accordionValue: string | undefined, accordionExpand: boolean) => Promise<void>;
139+
/**
140+
* Set to `"soft"` for an accordion group with slightly rounded corners, `"round"` for an accordion group with fully rounded corners, or `"rectangular"` for an accordion group without rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes. Only applies when `expand` is set to `"inset"`.
141+
*/
142+
"shape"?: 'soft' | 'round' | 'rectangular';
139143
/**
140144
* The theme determines the visual appearance of the component.
141145
*/
@@ -5392,6 +5396,10 @@ declare namespace LocalJSX {
53925396
* If `true`, the accordion group cannot be interacted with, but does not alter the opacity.
53935397
*/
53945398
"readonly"?: boolean;
5399+
/**
5400+
* Set to `"soft"` for an accordion group with slightly rounded corners, `"round"` for an accordion group with fully rounded corners, or `"rectangular"` for an accordion group without rounded corners. Defaults to `"round"` for the `ionic` theme, undefined for all other themes. Only applies when `expand` is set to `"inset"`.
5401+
*/
5402+
"shape"?: 'soft' | 'round' | 'rectangular';
53955403
/**
53965404
* The theme determines the visual appearance of the component.
53975405
*/

core/src/components/accordion-group/accordion-group.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ export class AccordionGroup implements ComponentInterface {
6060
*/
6161
@Prop() expand: 'compact' | 'inset' = 'compact';
6262

63+
/**
64+
* Set to `"soft"` for an accordion group with slightly rounded corners,
65+
* `"round"` for an accordion group with fully rounded corners, or
66+
* `"rectangular"` for an accordion group without rounded corners.
67+
*
68+
* Defaults to `"round"` for the `ionic` theme, undefined for all other themes.
69+
* Only applies when `expand` is set to `"inset"`.
70+
*/
71+
@Prop() shape?: 'soft' | 'round' | 'rectangular';
72+
6373
/**
6474
* Emitted when the value property has changed as a result of a user action such as a click.
6575
*
@@ -278,9 +288,26 @@ export class AccordionGroup implements ComponentInterface {
278288
return Array.from(this.el.querySelectorAll(':scope > ion-accordion')) as HTMLIonAccordionElement[];
279289
}
280290

291+
private getShape(): string | undefined {
292+
const theme = getIonTheme(this);
293+
const { shape } = this;
294+
295+
// TODO(ROU-11328): Remove theme check when shapes are defined for all themes.
296+
if (theme !== 'ionic') {
297+
return undefined;
298+
}
299+
300+
if (shape === undefined) {
301+
return 'round';
302+
}
303+
304+
return shape;
305+
}
306+
281307
render() {
282308
const { disabled, readonly, expand } = this;
283309
const theme = getIonTheme(this);
310+
const shape = this.getShape();
284311

285312
return (
286313
<Host
@@ -289,6 +316,7 @@ export class AccordionGroup implements ComponentInterface {
289316
'accordion-group-disabled': disabled,
290317
'accordion-group-readonly': readonly,
291318
[`accordion-group-expand-${expand}`]: true,
319+
[`accordion-group-shape-${shape}`]: shape !== undefined,
292320
}}
293321
role="presentation"
294322
>

packages/angular/src/directives/proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ export declare interface IonAccordion extends Components.IonAccordion {}
3030

3131

3232
@ProxyCmp({
33-
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'theme', 'value']
33+
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'shape', 'theme', 'value']
3434
})
3535
@Component({
3636
selector: 'ion-accordion-group',
3737
changeDetection: ChangeDetectionStrategy.OnPush,
3838
template: '<ng-content></ng-content>',
3939
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
40-
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'theme', 'value'],
40+
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'shape', 'theme', 'value'],
4141
})
4242
export class IonAccordionGroup {
4343
protected el: HTMLElement;

packages/angular/standalone/src/directives/proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ export declare interface IonAccordion extends Components.IonAccordion {}
103103

104104
@ProxyCmp({
105105
defineCustomElementFn: defineIonAccordionGroup,
106-
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'theme', 'value']
106+
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'shape', 'theme', 'value']
107107
})
108108
@Component({
109109
selector: 'ion-accordion-group',
110110
changeDetection: ChangeDetectionStrategy.OnPush,
111111
template: '<ng-content></ng-content>',
112112
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
113-
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'theme', 'value'],
113+
inputs: ['animated', 'disabled', 'expand', 'mode', 'multiple', 'readonly', 'shape', 'theme', 'value'],
114114
standalone: true
115115
})
116116
export class IonAccordionGroup {

packages/vue/src/proxies.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export const IonAccordionGroup = /*@__PURE__*/ defineContainer<JSX.IonAccordionG
9797
'disabled',
9898
'readonly',
9999
'expand',
100+
'shape',
100101
'ionChange',
101102
'ionValueChange'
102103
],

0 commit comments

Comments
 (0)