Skip to content

Commit fe821e2

Browse files
committed
Merge branch 'next' of github.com:ionic-team/ionic-framework into ROU-11318
2 parents c5cf023 + bc3d30c commit fe821e2

File tree

40 files changed

+187
-48
lines changed

40 files changed

+187
-48
lines changed

core/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ ion-select,prop,name,string,this.inputId,false,false
20642064
ion-select,prop,okText,string,'OK',false,false
20652065
ion-select,prop,placeholder,string | undefined,undefined,false,false
20662066
ion-select,prop,selectedText,null | string | undefined,undefined,false,false
2067-
ion-select,prop,shape,"round" | undefined,undefined,false,false
2067+
ion-select,prop,shape,"rectangular" | "round" | "soft" | undefined,undefined,false,false
20682068
ion-select,prop,size,"large" | "medium" | "small" | undefined,undefined,false,false
20692069
ion-select,prop,theme,"ios" | "md" | "ionic",undefined,false,false
20702070
ion-select,prop,toggleIcon,string | undefined,undefined,false,false

core/src/components.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,9 +3280,9 @@ export namespace Components {
32803280
*/
32813281
"selectedText"?: string | null;
32823282
/**
3283-
* The shape of the select. If "round" it will have an increased border radius.
3283+
* Set to `"soft"` for a select with slightly rounded corners, `"round"` for a select with fully rounded corners, or `"rectangular"` for a select without rounded corners. Defaults to `"round"` for the `"ionic"` theme, undefined for all other themes.
32843284
*/
3285-
"shape"?: 'round';
3285+
"shape"?: 'soft' | 'round' | 'rectangular';
32863286
/**
32873287
* Set to `"small"` for a select with less height, `"medium"` for the default select height, or `"large"` for a select with more height. Defaults to `"medium"` for the ionic theme, and undefined for all other themes.
32883288
*/
@@ -8708,9 +8708,9 @@ declare namespace LocalJSX {
87088708
*/
87098709
"selectedText"?: string | null;
87108710
/**
8711-
* The shape of the select. If "round" it will have an increased border radius.
8711+
* Set to `"soft"` for a select with slightly rounded corners, `"round"` for a select with fully rounded corners, or `"rectangular"` for a select without rounded corners. Defaults to `"round"` for the `"ionic"` theme, undefined for all other themes.
87128712
*/
8713-
"shape"?: 'round';
8713+
"shape"?: 'soft' | 'round' | 'rectangular';
87148714
/**
87158715
* Set to `"small"` for a select with less height, `"medium"` for the default select height, or `"large"` for a select with more height. Defaults to `"medium"` for the ionic theme, and undefined for all other themes.
87168716
*/

core/src/components/select/select.ionic.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// TODO(ROU-10778, ROU-10875): Sync the color names to the design system of
1111
// ios and md. This will allow us to have a single color map.
1212
--border-color: #{globals.current-color(neutral)};
13-
--border-radius: #{globals.$ion-border-radius-400};
1413
--border-width: #{globals.$ion-border-size-025};
1514
--padding-start: #{globals.$ion-space-400};
1615
--padding-end: #{globals.$ion-space-400};
@@ -168,7 +167,7 @@
168167
// ----------------------------------------------------------------
169168

170169
// Disabled
171-
// ----------------------------------------------------------------
170+
// ---------------------------------------------
172171

173172
:host(.select-disabled) {
174173
--background: #{globals.$ion-primitives-neutral-100};
@@ -182,6 +181,21 @@
182181
color: globals.$ion-primitives-neutral-500;
183182
}
184183

184+
// Shapes
185+
// ----------------------------------------------------------------
186+
187+
:host(.select-shape-soft) {
188+
--border-radius: #{globals.$ion-border-radius-200};
189+
}
190+
191+
:host(.select-shape-round) {
192+
--border-radius: #{globals.$ion-border-radius-400};
193+
}
194+
195+
:host(.select-shape-rectangular) {
196+
--border-radius: #{globals.$ion-border-radius-0};
197+
}
198+
185199
// Sizes
186200
// ----------------------------------------------------------------
187201

@@ -196,3 +210,4 @@
196210
:host(.select-size-large) .select-wrapper-inner {
197211
height: globals.$ion-scale-1400;
198212
}
213+

core/src/components/select/select.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,13 @@ export class Select implements ComponentInterface {
191191
@Prop() expandedIcon?: string;
192192

193193
/**
194-
* The shape of the select. If "round" it will have an increased border radius.
194+
* Set to `"soft"` for a select with slightly rounded corners,
195+
* `"round"` for a select with fully rounded corners,
196+
* or `"rectangular"` for a select without rounded corners.
197+
*
198+
* Defaults to `"round"` for the `"ionic"` theme, undefined for all other themes.
195199
*/
196-
@Prop() shape?: 'round';
200+
@Prop() shape?: 'soft' | 'round' | 'rectangular';
197201

198202
/**
199203
* The value of the select.
@@ -1015,6 +1019,18 @@ export class Select implements ComponentInterface {
10151019
);
10161020
}
10171021

1022+
private getShape(): string | undefined {
1023+
const theme = getIonTheme(this);
1024+
const { shape } = this;
1025+
1026+
// TODO(ROU-11366): Remove theme check when shapes are defined for all themes.
1027+
if (theme === 'ionic' && shape === undefined) {
1028+
return 'round';
1029+
}
1030+
1031+
return shape;
1032+
}
1033+
10181034
/**
10191035
* Get the icon to use for the expand icon.
10201036
* If an icon is set on the component, use that.
@@ -1071,9 +1087,9 @@ export class Select implements ComponentInterface {
10711087
}
10721088

10731089
render() {
1074-
const { disabled, el, isExpanded, expandedIcon, labelPlacement, justify, placeholder, fill, shape, name, value } =
1075-
this;
1090+
const { disabled, el, isExpanded, expandedIcon, labelPlacement, justify, placeholder, fill, name, value } = this;
10761091
const theme = getIonTheme(this);
1092+
const shape = this.getShape();
10771093
const hasFloatingOrStackedLabel = labelPlacement === 'floating' || labelPlacement === 'stacked';
10781094
const shouldRenderOuterIcon = theme !== 'ionic' && hasFloatingOrStackedLabel;
10791095
const shouldRenderInnerIcon = theme === 'ionic' || !hasFloatingOrStackedLabel;

core/src/components/select/test/fill/select.e2e.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -89,24 +89,6 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
8989
const select = page.locator('ion-select');
9090
await expect(select).toHaveScreenshot(screenshot(`select-fill-solid-label-floating`));
9191
});
92-
test('should not have visual regressions with shaped solid', async ({ page }) => {
93-
await page.setContent(
94-
`
95-
<ion-select
96-
shape="round"
97-
fill="solid"
98-
label="Fruit"
99-
value="apple"
100-
>
101-
<ion-select-option value="apple">Apple</ion-select-option>
102-
</ion-select>
103-
`,
104-
config
105-
);
106-
107-
const select = page.locator('ion-select');
108-
await expect(select).toHaveScreenshot(screenshot(`select-fill-shaped-solid`));
109-
});
11092
test('padding and border radius should be customizable', async ({ page }) => {
11193
await page.setContent(
11294
`
@@ -153,25 +135,6 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
153135
const select = page.locator('ion-select');
154136
await expect(select).toHaveScreenshot(screenshot(`select-fill-outline-label-floating`));
155137
});
156-
157-
test('should not have visual regressions with shaped outline', async ({ page }) => {
158-
await page.setContent(
159-
`
160-
<ion-select
161-
shape="round"
162-
fill="outline"
163-
label="Fruit"
164-
value="apple"
165-
>
166-
<ion-select-option value="apple">Apple</ion-select-option>
167-
</ion-select>
168-
`,
169-
config
170-
);
171-
172-
const select = page.locator('ion-select');
173-
await expect(select).toHaveScreenshot(screenshot(`select-fill-shaped-outline`));
174-
});
175138
});
176139
});
177140
});

0 commit comments

Comments
 (0)