feat(button): set default shape to soft for ios and round for md and ionic themes (#29404)

Issue number: internal

---------

## What is the current behavior?
The `shape` property defaults to `"soft"` for `ios` and `"round"` for
the `md` and `ionic` themes.

**Default button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `8px`  | `14px`      | `4px`      |
| `"round"`       | `999px` | unsupported | unsupported |
| `"rectangular"` | `0px`  | unsupported | unsupported |

**Large button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `8px`  | `16px`      | `4px`      |

**Small button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `undefined`     | `4px`  | `6px`      | `4px`      |

## What is the new behavior?
The `shape` property defaults to `undefined` which evaluates to the
"Soft" shape for all themes.


**Default button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------- | ------ | -------- |
| `"soft"`        | `8px`   | `6px`   | `4px`   |
| `"round"`       | `999px` | `999px` | `999px` |
| `"rectangular"` | `0px`   | `0px`   | `0px`   |

**Large button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `soft`     | `8px`  | `8px`      | `4px`      |

**Small button size**:

| Property Value | CSS Value (`ionic`) | CSS Value (`ios`) | CSS Value
(`md`) |
| --------------- | ------ | ----------- | ----------- |
| `soft`     | `4px`  | `4px`      | `4px`      |

- Adds support for the `"soft"` shape in the `ionic` theme using the
existing values for `undefined`
- Adds support for the `"rectangular"` and `"round"` shapes in `ios` and
`md` using `0px` and `999px` border radius
- Sets the default shape property to `"round"` for the `ionic` and `md`
themes and `"soft"` for `ios` and updates the `border-radius` to apply
to the shape classes instead of `:host`
- Updates the `"soft"` shape border radius for `ios` in the various
sizes to match the buttons created in SwiftUI (their "rounded" is our
"soft"):

![rounded-ios-buttons](https://github.com/ionic-team/ionic-framework/assets/6577830/230edf21-de68-4c41-9b89-8ea310ce42f2)
- Fixed the icon only buttons in the `"ionic"` theme so that they are
not styled based on the size while always following the proper aspect
ratio. This was broken for the default size due to an incorrect padding
value & I made it so we don't have to specify the padding for each size:

| Before | After |
| ---| ---|
|
![before](https://github.com/ionic-team/ionic-framework/assets/6577830/1e8d1a82-ad58-4372-be69-09175362c810)
|
![after](https://github.com/ionic-team/ionic-framework/assets/6577830/06cf6e22-a606-4ccc-ae4b-df69cf9c1e1e)
|

## Does this introduce a breaking change?

- [x] Yes
- [ ] No

BREAKING CHANGE:

The `border-radius` of the `ios` and `md` button now defaults to `6px`
and `999px` instead of `14px` and `4px`, respectively, in accordance
with the iOS and Material Design 3 guidelines. To revert to the previous
appearance, set the `shape` to `"soft"` for `md` and override the
`--border-radius` CSS variable for `ios` to `14px`, or set it to a
different value entirely.

---------

Co-authored-by: ionitron <hi@ionicframework.com>
This commit is contained in:
Brandy Carney
2024-05-08 16:05:59 -04:00
committed by GitHub
parent c78d2e6ec8
commit 4dae03f2ac
451 changed files with 573 additions and 380 deletions

View File

@ -3,9 +3,6 @@
// Ionic Button
// -------------------------------------------------------------------------------
/// @prop - Border radius of the button
$button-ionic-border-radius: px-to-rem(8);
/// @prop - Padding top of the button
$button-ionic-padding-top: px-to-rem(12);
@ -29,9 +26,6 @@ $button-ionic-font-size: dynamic-font-max(14px, 3);
// Ionic Extra Small Button
// -------------------------------------------------------------------------------
/// @prop - Border radius of the extra small button
$button-ionic-xsmall-border-radius: px-to-rem(4);
/// @prop - Padding top of the extra small button
$button-ionic-xsmall-padding-top: px-to-rem(4);
@ -55,9 +49,6 @@ $button-ionic-xsmall-font-size: dynamic-font-max(12px, 3);
// Ionic Small Button
// -------------------------------------------------------------------------------
/// @prop - Border radius of the small button
$button-ionic-small-border-radius: px-to-rem(4);
/// @prop - Padding top of the small button
$button-ionic-small-padding-top: px-to-rem(8);
@ -124,18 +115,6 @@ $button-ionic-xlarge-min-height: px-to-rem(56);
/// and multiplying it by 3, since 310% of the default is the maximum
$button-ionic-xlarge-font-size: dynamic-font-max(20px, 3);
// Ionic Rectangular Button
// -------------------------------------------------------------------------------
/// @prop - Border radius of the rectangular button
$button-ionic-rectangular-border: 0;
// Ionic Round Button
// -------------------------------------------------------------------------------
/// @prop - Border radius of the round button
$button-ionic-round-border: px-to-rem(999);
// Ionic Outline Button
// -------------------------------------------------------------------------------
@ -144,21 +123,3 @@ $button-ionic-outline-border-width: 1px;
/// @prop - Border style of the outline button
$button-ionic-outline-border-style: solid;
// Ionic Icon Only Button
// -------------------------------------------------------------------------------
/// @prop - Padding end of the icon only button
$button-has-icon-only-padding-end: px-to-rem(13);
/// @prop - Padding end of the icon only extra small button
$button-has-icon-only-padding-end-xsmall: px-to-rem(6);
/// @prop - Padding end of the icon only small button
$button-has-icon-only-padding-end-small: px-to-rem(10);
/// @prop - Padding end of the icon only large button
$button-has-icon-only-padding-end-large: px-to-rem(16);
/// @prop - Padding end of the icon only extra large button
$button-has-icon-only-padding-end-xlarge: px-to-rem(18);