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"):  - 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 | | ---| ---| |  |  | ## 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>
@@ -15,11 +15,16 @@ This is a comprehensive list of the breaking changes introduced in the major ver
|
||||
## Version 9.x
|
||||
|
||||
- [Components](#version-9x-components)
|
||||
- [Button](#version-9x-button)
|
||||
- [Card](#version-9x-card)
|
||||
- [Chip](#version-9x-chip)
|
||||
|
||||
<h2 id="version-9x-components">Components</h2>
|
||||
|
||||
<h4 id="version-9x-button">Button</h4>
|
||||
|
||||
- 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.
|
||||
|
||||
<h4 id="version-9x-card">Card</h4>
|
||||
|
||||
- The `border-radius` of the `ios` and `md` card now defaults to `14px` and `12px` instead of `8px` and `4px`, respectively, in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set the `shape` to `"soft"`, or override the `--border-radius` CSS variable to specify a different value.
|
||||
|
||||
@@ -234,7 +234,7 @@ ion-button,prop,mode,"ios" | "md",undefined,false,false
|
||||
ion-button,prop,rel,string | undefined,undefined,false,false
|
||||
ion-button,prop,routerAnimation,((baseEl: any, opts?: any) => Animation) | undefined,undefined,false,false
|
||||
ion-button,prop,routerDirection,"back" | "forward" | "root",'forward',false,false
|
||||
ion-button,prop,shape,"rectangular" | "round" | undefined,undefined,false,true
|
||||
ion-button,prop,shape,"rectangular" | "round" | "soft" | undefined,undefined,false,true
|
||||
ion-button,prop,size,"default" | "large" | "small" | "xlarge" | "xsmall" | undefined,undefined,false,true
|
||||
ion-button,prop,strong,boolean,false,false,false
|
||||
ion-button,prop,target,string | undefined,undefined,false,false
|
||||
|
||||
8
core/src/components.d.ts
vendored
@@ -543,9 +543,9 @@ export namespace Components {
|
||||
*/
|
||||
"routerDirection": RouterDirection;
|
||||
/**
|
||||
* Set to `"round"` for a button with more rounded corners.
|
||||
* Set to `"soft"` for a button with slightly rounded corners, `"round"` for a button with fully rounded corners, or `"rectangular"` for a button without rounded corners. Defaults to `"soft"` for the `"ios"` theme and `"round"` for all other themes.
|
||||
*/
|
||||
"shape"?: 'round' | 'rectangular';
|
||||
"shape"?: 'soft' | 'round' | 'rectangular';
|
||||
/**
|
||||
* Set to `"small"` for a button with less height and padding, to `"default"` for a button with the default height and padding, or to `"large"` for a button with more height and padding. By default the size is unset, unless the button is inside of an item, where the size is `"small"` by default. Set the size to `"default"` inside of an item to make it a standard size button.
|
||||
*/
|
||||
@@ -5791,9 +5791,9 @@ declare namespace LocalJSX {
|
||||
*/
|
||||
"routerDirection"?: RouterDirection;
|
||||
/**
|
||||
* Set to `"round"` for a button with more rounded corners.
|
||||
* Set to `"soft"` for a button with slightly rounded corners, `"round"` for a button with fully rounded corners, or `"rectangular"` for a button without rounded corners. Defaults to `"soft"` for the `"ios"` theme and `"round"` for all other themes.
|
||||
*/
|
||||
"shape"?: 'round' | 'rectangular';
|
||||
"shape"?: 'soft' | 'round' | 'rectangular';
|
||||
/**
|
||||
* Set to `"small"` for a button with less height and padding, to `"default"` for a button with the default height and padding, or to `"large"` for a button with more height and padding. By default the size is unset, unless the button is inside of an item, where the size is `"small"` by default. Set the size to `"default"` inside of an item to make it a standard size button.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@use "../../themes/ionic/ionic.globals.scss" as globals;
|
||||
@import "./button";
|
||||
@import "./button.ionic.vars";
|
||||
|
||||
@@ -5,11 +6,11 @@
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
:host {
|
||||
--border-radius: #{$button-ionic-border-radius};
|
||||
--padding-bottom: var(--padding-top);
|
||||
--padding-end: #{$button-ionic-padding-end};
|
||||
--padding-start: var(--padding-end);
|
||||
--padding-top: #{$button-ionic-padding-top};
|
||||
// TODO(FW-6187): set this to a design token when it is added
|
||||
--focus-ring-color: #9ec4fd;
|
||||
--focus-ring-width: 2px;
|
||||
|
||||
@@ -62,7 +63,6 @@
|
||||
|
||||
/* Extra Small Button */
|
||||
:host(.button-xsmall) {
|
||||
--border-radius: #{$button-ionic-xsmall-border-radius};
|
||||
--padding-top: #{$button-ionic-xsmall-padding-top};
|
||||
--padding-end: #{$button-ionic-xsmall-padding-end};
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
|
||||
/* Small Button */
|
||||
:host(.button-small) {
|
||||
--border-radius: #{$button-ionic-small-border-radius};
|
||||
--padding-top: #{$button-ionic-small-padding-top};
|
||||
--padding-end: #{$button-ionic-small-padding-end};
|
||||
|
||||
@@ -123,45 +122,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Button extra small */
|
||||
:host(.button-has-icon-only.button-xsmall) {
|
||||
--padding-end: #{$button-has-icon-only-padding-end-xsmall};
|
||||
}
|
||||
|
||||
/* Button small */
|
||||
:host(.button-has-icon-only.button-small) {
|
||||
--padding-end: #{$button-has-icon-only-padding-end-small};
|
||||
}
|
||||
|
||||
/* Default */
|
||||
:host(.button-has-icon-only) {
|
||||
--padding-end: #{$button-has-icon-only-padding-end};
|
||||
}
|
||||
--padding-end: var(--padding-top);
|
||||
|
||||
/* Button large */
|
||||
:host(.button-has-icon-only.button-large) {
|
||||
--padding-end: #{$button-has-icon-only-padding-end-large};
|
||||
}
|
||||
|
||||
/* Button extra large */
|
||||
:host(.button-has-icon-only.button-xlarge) {
|
||||
--padding-end: #{$button-has-icon-only-padding-end-xlarge};
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
|
||||
// Button Shapes
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
// Button Shape Rectangular
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
:host(.button-rectangular) {
|
||||
--border-radius: #{$button-ionic-rectangular-border};
|
||||
:host(.button-soft) {
|
||||
--border-radius: #{globals.$ionic-border-radius-rounded-medium};
|
||||
}
|
||||
|
||||
:host(.button-soft.button-xsmall),
|
||||
:host(.button-soft.button-small) {
|
||||
--border-radius: #{globals.$ionic-border-radius-rounded-small};
|
||||
}
|
||||
|
||||
// Button Shape Round
|
||||
// -------------------------------------------------------------------------------
|
||||
:host(.button-round) {
|
||||
--border-radius: #{$button-ionic-round-border};
|
||||
--border-radius: #{globals.$ionic-border-radius-rounded-full};
|
||||
}
|
||||
|
||||
:host(.button-rectangular) {
|
||||
--border-radius: #{globals.$ionic-border-radius-square};
|
||||
}
|
||||
|
||||
// Button Focused
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
--border-radius: #{$button-ios-border-radius};
|
||||
--padding-top: #{$button-ios-padding-top};
|
||||
--padding-bottom: #{$button-ios-padding-bottom};
|
||||
--padding-start: #{$button-ios-padding-start};
|
||||
@@ -23,7 +22,7 @@
|
||||
letter-spacing: #{$button-ios-letter-spacing};
|
||||
}
|
||||
|
||||
// iOS Solid Button
|
||||
// Solid Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-solid) {
|
||||
@@ -35,11 +34,10 @@
|
||||
--background-hover-opacity: 1;
|
||||
}
|
||||
|
||||
// iOS Outline Button
|
||||
// Outline Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-outline) {
|
||||
--border-radius: #{$button-ios-outline-border-radius};
|
||||
--border-width: #{$button-ios-outline-border-width};
|
||||
--border-style: #{$button-ios-outline-border-style};
|
||||
--background-activated: #{ion-color(primary, base)};
|
||||
@@ -49,7 +47,7 @@
|
||||
--color-activated: #{ion-color(primary, contrast)};
|
||||
}
|
||||
|
||||
// iOS Clear Button
|
||||
// Clear Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-clear) {
|
||||
@@ -63,7 +61,7 @@
|
||||
font-weight: #{$button-ios-clear-font-weight};
|
||||
}
|
||||
|
||||
// iOS Toolbar Buttons
|
||||
// Toolbar Buttons
|
||||
// --------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -81,11 +79,10 @@
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
// iOS Button Sizes
|
||||
// Button Sizes
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-large) {
|
||||
--border-radius: #{$button-ios-large-border-radius};
|
||||
--padding-top: #{$button-ios-large-padding-top};
|
||||
--padding-start: #{$button-ios-large-padding-start};
|
||||
--padding-end: #{$button-ios-large-padding-end};
|
||||
@@ -97,7 +94,6 @@
|
||||
}
|
||||
|
||||
:host(.button-small) {
|
||||
--border-radius: #{$button-ios-small-border-radius};
|
||||
--padding-top: #{$button-ios-small-padding-top};
|
||||
--padding-start: #{$button-ios-small-padding-start};
|
||||
--padding-end: #{$button-ios-small-padding-end};
|
||||
@@ -108,25 +104,37 @@
|
||||
font-size: #{$button-ios-small-font-size};
|
||||
}
|
||||
|
||||
// iOS Round Button
|
||||
// Button Shapes
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-round) {
|
||||
--border-radius: #{$button-ios-round-border-radius};
|
||||
--padding-top: #{$button-ios-round-padding-top};
|
||||
--padding-start: #{$button-ios-round-padding-start};
|
||||
--padding-end: #{$button-ios-round-padding-end};
|
||||
--padding-bottom: #{$button-ios-round-padding-bottom};
|
||||
:host(.button-soft) {
|
||||
--border-radius: 6px;
|
||||
}
|
||||
|
||||
// iOS Strong Button
|
||||
:host(.button-soft.button-large) {
|
||||
--border-radius: 8px;
|
||||
}
|
||||
|
||||
:host(.button-soft.button-small) {
|
||||
--border-radius: 4px;
|
||||
}
|
||||
|
||||
:host(.button-round) {
|
||||
--border-radius: 999px;
|
||||
}
|
||||
|
||||
:host(.button-rectangular) {
|
||||
--border-radius: 0px;
|
||||
}
|
||||
|
||||
// Strong Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-strong) {
|
||||
font-weight: #{$button-ios-strong-font-weight};
|
||||
}
|
||||
|
||||
// iOS Icon Only Button
|
||||
// Icon Only Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-has-icon-only) {
|
||||
@@ -148,7 +156,7 @@
|
||||
*
|
||||
* Since the `ion-button` uses `rem` for the font size, we can't
|
||||
* just pass the desired icon font size in `em` to the `
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* to account for the ion-button` font size.
|
||||
*
|
||||
* For example, if the default font size of `ion-button` is 16px
|
||||
@@ -172,7 +180,7 @@
|
||||
*
|
||||
* Since the `ion-button` uses `rem` for the font size, we can't
|
||||
* just pass the desired icon font size in `em` to the `
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* to account for the ion-button` font size.
|
||||
*
|
||||
* For example, if the default font size of `ion-button` is 13px
|
||||
@@ -196,7 +204,7 @@
|
||||
*
|
||||
* Since the `ion-button` uses `rem` for the font size, we can't
|
||||
* just pass the desired icon font size in `em` to the `
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* to account for the ion-button` font size.
|
||||
*
|
||||
* For example, if the default font size of `ion-button` is 20px
|
||||
|
||||
@@ -30,9 +30,6 @@ $button-ios-padding-start: $button-ios-padding-end;
|
||||
/// @prop - Minimum height of the button
|
||||
$button-ios-min-height: 3.1em;
|
||||
|
||||
/// @prop - Border radius of the button
|
||||
$button-ios-border-radius: 14px;
|
||||
|
||||
/// @prop - Font size of the button text
|
||||
/// The maximum font size is calculated by taking the default font size
|
||||
/// and multiplying it by 3, since 310% of the default is the maximum
|
||||
@@ -59,9 +56,6 @@ $button-ios-large-padding-start: $button-ios-large-padding-end;
|
||||
/// @prop - Minimum height of the large button
|
||||
$button-ios-large-min-height: 3.1em;
|
||||
|
||||
/// @prop - Border radius of the large button
|
||||
$button-ios-large-border-radius: 16px;
|
||||
|
||||
/// @prop - Font size of the large button
|
||||
/// The maximum font size is calculated by taking the default font size
|
||||
/// and multiplying it by 3, since 310% of the default is the maximum
|
||||
@@ -85,9 +79,6 @@ $button-ios-small-padding-start: $button-ios-small-padding-end;
|
||||
/// @prop - Minimum height of the small button
|
||||
$button-ios-small-min-height: 2.1em;
|
||||
|
||||
/// @prop - Border radius of the small button
|
||||
$button-ios-small-border-radius: 6px;
|
||||
|
||||
/// @prop - Font size of the small button
|
||||
/// The maximum font size is calculated by taking the default font size
|
||||
/// and multiplying it by 3, since 310% of the default is the maximum
|
||||
@@ -102,9 +93,6 @@ $button-ios-outline-border-width: 1px;
|
||||
/// @prop - Border style of the outline button
|
||||
$button-ios-outline-border-style: solid;
|
||||
|
||||
/// @prop - Border radius of the outline button
|
||||
$button-ios-outline-border-radius: $button-ios-border-radius;
|
||||
|
||||
// iOS Clear Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -125,24 +113,6 @@ $button-ios-clear-opacity-activated: 0.4;
|
||||
/// @prop - Opacity of the clear button on hover
|
||||
$button-ios-clear-opacity-hover: 0.6;
|
||||
|
||||
// iOS Round Button
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Padding top of the round button
|
||||
$button-ios-round-padding-top: $button-round-padding-top;
|
||||
|
||||
/// @prop - Padding end of the round button
|
||||
$button-ios-round-padding-end: $button-round-padding-end;
|
||||
|
||||
/// @prop - Padding bottom of the round button
|
||||
$button-ios-round-padding-bottom: $button-round-padding-bottom;
|
||||
|
||||
/// @prop - Padding start of the round button
|
||||
$button-ios-round-padding-start: $button-round-padding-start;
|
||||
|
||||
/// @prop - Border radius of the round button
|
||||
$button-ios-round-border-radius: $button-round-border-radius;
|
||||
|
||||
// iOS Decorator Button
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
// --------------------------------------------------
|
||||
|
||||
:host {
|
||||
--border-radius: #{$button-md-border-radius};
|
||||
--padding-top: #{$button-md-padding-top};
|
||||
--padding-bottom: #{$button-md-padding-bottom};
|
||||
--padding-start: #{$button-md-padding-start};
|
||||
@@ -24,7 +23,7 @@
|
||||
text-transform: #{$button-md-text-transform};
|
||||
}
|
||||
|
||||
// Material Design Solid Button
|
||||
// Solid Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-solid) {
|
||||
@@ -41,7 +40,7 @@
|
||||
--box-shadow: #{$button-md-box-shadow-activated};
|
||||
}
|
||||
|
||||
// Material Design Outline Button
|
||||
// Outline Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-outline) {
|
||||
@@ -60,7 +59,7 @@
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
// Material Design Clear Button
|
||||
// Clear Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-clear) {
|
||||
@@ -72,18 +71,22 @@
|
||||
--background-hover-opacity: 0.04;
|
||||
}
|
||||
|
||||
// Material Design Round Button
|
||||
// --------------------------------------------------
|
||||
// Button Shapes
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
:host(.button-round) {
|
||||
--border-radius: #{$button-md-round-border-radius};
|
||||
--padding-top: #{$button-md-round-padding-top};
|
||||
--padding-start: #{$button-md-round-padding-start};
|
||||
--padding-end: #{$button-md-round-padding-end};
|
||||
--padding-bottom: #{$button-md-round-padding-bottom};
|
||||
:host(.button-soft) {
|
||||
--border-radius: 4px;
|
||||
}
|
||||
|
||||
// Material Design Button Sizes
|
||||
:host(.button-round) {
|
||||
--border-radius: 999px;
|
||||
}
|
||||
|
||||
:host(.button-rectangular) {
|
||||
--border-radius: 0px;
|
||||
}
|
||||
|
||||
// Button Sizes
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-large) {
|
||||
@@ -108,14 +111,14 @@
|
||||
font-size: #{$button-md-small-font-size};
|
||||
}
|
||||
|
||||
// MD strong Button
|
||||
// Strong Button
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.button-strong) {
|
||||
font-weight: #{$button-md-strong-font-weight};
|
||||
}
|
||||
|
||||
// MD Icon Only Button
|
||||
// Icon Only Button
|
||||
//
|
||||
// MD does not specify a small size, these
|
||||
// styles are based on the iOS small size.
|
||||
@@ -144,7 +147,7 @@
|
||||
*
|
||||
* Since the `ion-button` uses `rem` for the font size, we can't
|
||||
* just pass the desired icon font size in `em` to the `
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* to account for the ion-button` font size.
|
||||
*
|
||||
* For example, if the default font size of `ion-button` is 14px
|
||||
@@ -169,7 +172,7 @@
|
||||
*
|
||||
* Since the `ion-button` uses `rem` for the font size, we can't
|
||||
* just pass the desired icon font size in `em` to the `
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* to account for the ion-button` font size.
|
||||
*
|
||||
* For example, if the default font size of `ion-button` is 13px
|
||||
@@ -194,7 +197,7 @@
|
||||
*
|
||||
* Since the `ion-button` uses `rem` for the font size, we can't
|
||||
* just pass the desired icon font size in `em` to the `
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* dynamic-font-clamp`. Instead, we need to adjust the base size
|
||||
* to account for the ion-button` font size.
|
||||
*
|
||||
* For example, if the default font size of `ion-button` is 20px
|
||||
@@ -204,7 +207,7 @@
|
||||
font-size: dynamic-font-clamp(0.67, 22.4px, 1.92, 1em);
|
||||
}
|
||||
|
||||
// Material Design Button: Hover
|
||||
// Button: Hover
|
||||
// --------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,9 +30,6 @@ $button-md-padding-start: 1.1em;
|
||||
/// @prop - Minimum height of the button
|
||||
$button-md-min-height: 36px;
|
||||
|
||||
/// @prop - Border radius of the button
|
||||
$button-md-border-radius: 4px;
|
||||
|
||||
/// @prop - Font size of the button text
|
||||
$button-md-font-size: dynamic-font(14px);
|
||||
|
||||
@@ -94,24 +91,6 @@ $button-md-small-min-height: 2.1em;
|
||||
/// @prop - Font size of the small button
|
||||
$button-md-small-font-size: dynamic-font(13px);
|
||||
|
||||
// Material Design Round Button
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Padding top of the round button
|
||||
$button-md-round-padding-top: $button-round-padding-top;
|
||||
|
||||
/// @prop - Padding end of the round button
|
||||
$button-md-round-padding-end: $button-round-padding-end;
|
||||
|
||||
/// @prop - Padding bottom of the round button
|
||||
$button-md-round-padding-bottom: $button-round-padding-bottom;
|
||||
|
||||
/// @prop - Padding start of the round button
|
||||
$button-md-round-padding-start: $button-round-padding-start;
|
||||
|
||||
/// @prop - Border radius of the round button
|
||||
$button-md-round-border-radius: $button-round-border-radius;
|
||||
|
||||
// Material Design Decorator Button
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
@@ -115,9 +115,11 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
|
||||
@Prop() rel: string | undefined;
|
||||
|
||||
/**
|
||||
* Set to `"round"` for a button with more rounded corners.
|
||||
* Set to `"soft"` for a button with slightly rounded corners, `"round"` for a button with fully
|
||||
* rounded corners, or `"rectangular"` for a button without rounded corners.
|
||||
* Defaults to `"soft"` for the `"ios"` theme and `"round"` for all other themes.
|
||||
*/
|
||||
@Prop({ reflect: true }) shape?: 'round' | 'rectangular';
|
||||
@Prop({ reflect: true }) shape?: 'soft' | 'round' | 'rectangular';
|
||||
|
||||
/**
|
||||
* Set to `"small"` for a button with less height and padding, to `"default"`
|
||||
@@ -216,6 +218,20 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
|
||||
return 'bounded';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the shape based on the theme
|
||||
*/
|
||||
private getShape(): string {
|
||||
const theme = getIonTheme(this);
|
||||
const { shape } = this;
|
||||
|
||||
if (shape === undefined) {
|
||||
return theme === 'ios' ? 'soft' : 'round';
|
||||
}
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the "xsmall" and "xlarge" sizes if the theme is "ios" or "md"
|
||||
*/
|
||||
@@ -333,23 +349,12 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
buttonType,
|
||||
type,
|
||||
disabled,
|
||||
rel,
|
||||
target,
|
||||
href,
|
||||
color,
|
||||
expand,
|
||||
hasIconOnly,
|
||||
shape,
|
||||
strong,
|
||||
inheritedAttributes,
|
||||
} = this;
|
||||
const { buttonType, type, disabled, rel, target, href, color, expand, hasIconOnly, strong, inheritedAttributes } =
|
||||
this;
|
||||
|
||||
const theme = getIonTheme(this);
|
||||
const finalSize = this.getSize();
|
||||
const size = this.getSize();
|
||||
const shape = this.getShape();
|
||||
const TagType = href === undefined ? 'button' : ('a' as any);
|
||||
const attrs =
|
||||
TagType === 'button'
|
||||
@@ -388,8 +393,8 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
|
||||
[theme]: true,
|
||||
[buttonType]: true,
|
||||
[`${buttonType}-${expand}`]: expand !== undefined,
|
||||
[`${buttonType}-${finalSize}`]: finalSize !== undefined,
|
||||
[`${buttonType}-${shape}`]: shape !== undefined,
|
||||
[`${buttonType}-${size}`]: size !== undefined,
|
||||
[`${buttonType}-${shape}`]: true,
|
||||
[`${buttonType}-${fill}`]: true,
|
||||
[`${buttonType}-strong`]: strong,
|
||||
'in-toolbar': hostContext('ion-toolbar', this.el),
|
||||
|
||||
@@ -2,18 +2,3 @@
|
||||
|
||||
// Button
|
||||
// --------------------------------------------------
|
||||
|
||||
/// @prop - Padding top of the round button
|
||||
$button-round-padding-top: 0;
|
||||
|
||||
/// @prop - Padding end of the round button
|
||||
$button-round-padding-end: 26px;
|
||||
|
||||
/// @prop - Padding bottom of the round button
|
||||
$button-round-padding-bottom: $button-round-padding-top;
|
||||
|
||||
/// @prop - Padding start of the round button
|
||||
$button-round-padding-start: $button-round-padding-end;
|
||||
|
||||
/// @prop - Border radius of the round button
|
||||
$button-round-border-radius: 999px;
|
||||
|
||||
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 125 KiB After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 31 KiB |
@@ -24,36 +24,36 @@
|
||||
|
||||
<ion-content class="ion-padding" id="content" no-bounce>
|
||||
<p>
|
||||
<ion-button expand="block">Block</ion-button>
|
||||
<ion-button expand="full">Full</ion-button>
|
||||
<ion-button shape="soft" expand="block">Block</ion-button>
|
||||
<ion-button shape="soft" expand="full">Full</ion-button>
|
||||
</p>
|
||||
<p>
|
||||
<ion-button expand="block">Button Block</ion-button>
|
||||
<ion-button expand="block" href="#">Anchor Block</ion-button>
|
||||
<ion-button shape="soft" expand="block">Button Block</ion-button>
|
||||
<ion-button shape="soft" expand="block" href="#">Anchor Block</ion-button>
|
||||
</p>
|
||||
<p>
|
||||
<ion-button expand="full">Button Full</ion-button>
|
||||
<ion-button expand="full" href="#">Anchor Full</ion-button>
|
||||
<ion-button shape="soft" expand="full">Button Full</ion-button>
|
||||
<ion-button shape="soft" expand="full" href="#">Anchor Full</ion-button>
|
||||
</p>
|
||||
<p>
|
||||
<ion-button expand="block" color="dark" fill="outline">Block + Outline</ion-button>
|
||||
<ion-button expand="full" color="dark" fill="outline">Full + Outline</ion-button>
|
||||
<ion-button shape="soft" expand="block" color="dark" fill="outline">Block + Outline</ion-button>
|
||||
<ion-button shape="soft" expand="full" color="dark" fill="outline">Full + Outline</ion-button>
|
||||
</p>
|
||||
<p>
|
||||
<ion-button expand="block" fill="clear">Block + Clear</ion-button>
|
||||
<ion-button expand="full" fill="clear">Full + Clear</ion-button>
|
||||
<ion-button shape="soft" expand="block" fill="clear">Block + Clear</ion-button>
|
||||
<ion-button shape="soft" expand="full" fill="clear">Full + Clear</ion-button>
|
||||
</p>
|
||||
<p>
|
||||
<ion-button expand="block" color="danger" size="small">Block + Small</ion-button>
|
||||
<ion-button expand="full" color="danger" size="small">Full + Small</ion-button>
|
||||
<ion-button shape="soft" expand="block" color="danger" size="small">Block + Small</ion-button>
|
||||
<ion-button shape="soft" expand="full" color="danger" size="small">Full + Small</ion-button>
|
||||
</p>
|
||||
<p>
|
||||
<ion-button expand="block" color="secondary" size="large">Block + Large</ion-button>
|
||||
<ion-button expand="full" color="secondary" size="large">Full + Large</ion-button>
|
||||
<ion-button shape="soft" expand="block" color="secondary" size="large">Block + Large</ion-button>
|
||||
<ion-button shape="soft" expand="full" color="secondary" size="large">Full + Large</ion-button>
|
||||
</p>
|
||||
<p>
|
||||
<ion-button expand="block" shape="round">Block + Round</ion-button>
|
||||
<ion-button expand="full" shape="round">Full + Round</ion-button>
|
||||
<ion-button shape="round" expand="block">Block + Round</ion-button>
|
||||
<ion-button shape="round" expand="full">Full + Round</ion-button>
|
||||
</p>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 40 KiB |
@@ -1,6 +1,7 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
// TODO(ROU-5474): add tests for ionic theme
|
||||
configs().forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('button: outline'), () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
|
||||
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 112 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 111 KiB |
@@ -1,111 +1,302 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
const styleTestHelpers = `
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
align-items: start;
|
||||
justify-items: start;
|
||||
grid-template-columns: repeat(3, auto);
|
||||
grid-gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
|
||||
/**
|
||||
* All content takes up the full width, so RTL has no effect.
|
||||
* This behavior does not vary across directions.
|
||||
*/
|
||||
// TODO: FW-6077 - Add ionic theme on MD mode to this test.
|
||||
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
configs({ modes: ['ionic-md', 'md', 'ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('button: shape'), () => {
|
||||
test.describe('round', () => {
|
||||
test.describe('default', () => {
|
||||
test.describe('soft shape', () => {
|
||||
test.describe('default fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/button/test/shape`, config);
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
await page.setIonViewport();
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="soft" size="small">Button</ion-button>
|
||||
<ion-button shape="soft">Button</ion-button>
|
||||
<ion-button shape="soft" size="large">Button</ion-button>
|
||||
<ion-button shape="soft" size="small">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="soft">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="soft" size="large">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#default');
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-round`));
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-soft-fill-default`));
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('outline', () => {
|
||||
test.describe('outline fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/button/test/shape`, config);
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
await page.setIonViewport();
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="soft" fill="outline" size="small">Button</ion-button>
|
||||
<ion-button shape="soft" fill="outline">Button</ion-button>
|
||||
<ion-button shape="soft" fill="outline" size="large">Button</ion-button>
|
||||
<ion-button shape="soft" size="small" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="soft" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="soft" size="large" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#outline');
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-outline-round`));
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-soft-fill-outline`));
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('clear', () => {
|
||||
// The clear buttons have the `ion-focused` class added to show their shape
|
||||
test.describe('clear fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/button/test/shape`, config);
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
await page.setIonViewport();
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="soft" fill="clear" size="small" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="soft" fill="clear" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="soft" fill="clear" size="large" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="soft" size="small" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="soft" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="soft" size="large" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#clear');
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-clear-round`));
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-soft-fill-clear`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('round shape', () => {
|
||||
test.describe('default fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="round" size="small">Button</ion-button>
|
||||
<ion-button shape="round">Button</ion-button>
|
||||
<ion-button shape="round" size="large">Button</ion-button>
|
||||
<ion-button shape="round" size="small">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="round">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="round" size="large">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-round-fill-default`));
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('color', () => {
|
||||
test.describe('outline fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/button/test/shape`, config);
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
await page.setIonViewport();
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="round" fill="outline" size="small">Button</ion-button>
|
||||
<ion-button shape="round" fill="outline">Button</ion-button>
|
||||
<ion-button shape="round" fill="outline" size="large">Button</ion-button>
|
||||
<ion-button shape="round" size="small" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="round" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="round" size="large" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#color');
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-color-round`));
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-round-fill-outline`));
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('expand', () => {
|
||||
// The clear buttons have the `ion-focused` class added to show their shape
|
||||
test.describe('clear fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/button/test/shape`, config);
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
await page.setIonViewport();
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="round" fill="clear" size="small" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="round" fill="clear" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="round" fill="clear" size="large" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="round" size="small" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="round" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="round" size="large" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#expand');
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-expand-round`));
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-round-fill-clear`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('rectangular shape', () => {
|
||||
test.describe('default fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="rectangular" size="small">Button</ion-button>
|
||||
<ion-button shape="rectangular">Button</ion-button>
|
||||
<ion-button shape="rectangular" size="large">Button</ion-button>
|
||||
<ion-button shape="rectangular" size="small">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="rectangular">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="rectangular" size="large">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-rectangular-fill-default`));
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('outline fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="rectangular" fill="outline" size="small">Button</ion-button>
|
||||
<ion-button shape="rectangular" fill="outline">Button</ion-button>
|
||||
<ion-button shape="rectangular" fill="outline" size="large">Button</ion-button>
|
||||
<ion-button shape="rectangular" size="small" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="rectangular" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="rectangular" size="large" fill="outline">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-rectangular-fill-outline`));
|
||||
});
|
||||
});
|
||||
|
||||
// The clear buttons have the `ion-focused` class added to show their shape
|
||||
test.describe('clear fill', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
${styleTestHelpers}
|
||||
|
||||
<div id="container" class="grid">
|
||||
<ion-button shape="rectangular" fill="clear" size="small" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="rectangular" fill="clear" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="rectangular" fill="clear" size="large" class="ion-focused">Button</ion-button>
|
||||
<ion-button shape="rectangular" size="small" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="rectangular" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button shape="rectangular" size="large" fill="clear" class="ion-focused">
|
||||
<ion-icon slot="icon-only" ios="logo-apple" md="settings-sharp"></ion-icon>
|
||||
</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-rectangular-fill-clear`));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Shape="rectangular" is only available in the Ionic theme.
|
||||
*/
|
||||
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('button: shape'), () => {
|
||||
test.describe('rectangular', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
ion-button {
|
||||
margin: 8px;
|
||||
}
|
||||
</style>
|
||||
<div id="container">
|
||||
<ion-button shape="rectangular" fill="solid">Rectangular Button, Solid</ion-button>
|
||||
<ion-button class="ion-focused" shape="rectangular" fill="solid">Rectangular Button, Solid, Focused</ion-button>
|
||||
<ion-button class="ion-activated" shape="rectangular" fill="solid">Rectangular Button, Solid, Activated</ion-button>
|
||||
|
||||
<ion-button shape="rectangular" fill="outline">Rectangular Button, Outline</ion-button>
|
||||
<ion-button class="ion-focused" shape="rectangular" fill="outline">Rectangular Button, Outline, Focused</ion-button>
|
||||
<ion-button class="ion-activated" shape="rectangular" fill="outline">Rectangular Button, Outline, Activated</ion-button>
|
||||
|
||||
<ion-button shape="rectangular" fill="clear">Rectangular Button</ion-button>
|
||||
<ion-button class="ion-focused" shape="rectangular" fill="clear">Rectangular Button, Focused</ion-button>
|
||||
<ion-button class="ion-activated" shape="rectangular" fill="clear">Rectangular Button, Activated</ion-button>
|
||||
</div>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const container = page.locator('#container');
|
||||
|
||||
await expect(container).toHaveScreenshot(screenshot(`button-shape-rectangular`));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Before Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 8.8 KiB |