feat(datetime-button): update design to match iOS 17 spec (#28730)
Issue number: N/A --------- ## What is the current behavior? Datetime button combines Material Design and iOS styles. ## What is the new behavior? - Splits the styles into their own mode files for Material Design & iOS and updates the iOS styles to match iOS 17. - Updates the basic test to include a screenshot test in both modes & directions. I removed all of the datetime button screenshots before running the action to generate screenshots. Some screenshots were not added back but this is correct for the following reasons: - [datetime-button-disabled](https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/datetime-button/test/disabled/datetime-button.e2e.ts#L4) does not run for `ios` or `rtl` so those were removed - [datetime-overlay-modal and datetime-overlay-popover](https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/datetime-button/test/overlays/datetime-button.e2e.ts#L9) do not run for `rtl` so those were removed - [datetime-overlay-popover](https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/datetime-button/test/overlays/datetime-button.e2e.ts#L31) skips the test in firefox so that was removed I can add these back if you want since they aren't part of this PR but they should have probably been removed when the test was updated to exclude directions/modes. ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information I compared the datetime button against native iOS 17.1.2: | iOS 17 | Ionic | | ---| ---| |  |  | |  |  | Diff:  --------- Co-authored-by: ionitron <hi@ionicframework.com>
12
core/src/components/datetime-button/datetime-button.ios.scss
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
@import "./datetime-button";
|
||||||
|
|
||||||
|
// iOS Datetime Button
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
:host button {
|
||||||
|
@include padding(7px, 13px, 7px, 13px);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host button.ion-activated {
|
||||||
|
color: $text-color-step-400;
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
@import "./datetime-button";
|
||||||
|
|
||||||
|
// Material Design Datetime Button
|
||||||
|
// --------------------------------------------------
|
||||||
|
|
||||||
|
:host button {
|
||||||
|
@include padding(6px, 12px, 6px, 12px);
|
||||||
|
}
|
||||||
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
:host button {
|
:host button {
|
||||||
@include border-radius(8px);
|
@include border-radius(8px);
|
||||||
@include padding(6px, 12px, 6px, 12px);
|
|
||||||
@include margin(0px, 2px, 0px, 2px);
|
@include margin(0px, 2px, 0px, 2px);
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -22,8 +22,8 @@ import { parseDate } from '../datetime/utils/parse';
|
|||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-datetime-button',
|
tag: 'ion-datetime-button',
|
||||||
styleUrls: {
|
styleUrls: {
|
||||||
ios: 'datetime-button.scss',
|
ios: 'datetime-button.ios.scss',
|
||||||
md: 'datetime-button.scss',
|
md: 'datetime-button.md.scss',
|
||||||
},
|
},
|
||||||
shadow: true,
|
shadow: true,
|
||||||
})
|
})
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.7 KiB |
@ -1,6 +1,23 @@
|
|||||||
import { expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
import { configs, test } from '@utils/test/playwright';
|
import { configs, test } from '@utils/test/playwright';
|
||||||
|
|
||||||
|
configs().forEach(({ config, screenshot, title }) => {
|
||||||
|
test.describe(title('datetime-button: basic'), () => {
|
||||||
|
test('should not have visual regressions', async ({ page }) => {
|
||||||
|
await page.setContent(
|
||||||
|
`
|
||||||
|
<ion-datetime-button locale="en-US" datetime="datetime"></ion-datetime-button>
|
||||||
|
<ion-datetime id="datetime" value="2022-01-01T06:30:00" presentation="date-time"></ion-datetime>
|
||||||
|
`,
|
||||||
|
config
|
||||||
|
);
|
||||||
|
const datetimeButton = page.locator('ion-datetime-button');
|
||||||
|
|
||||||
|
await expect(datetimeButton).toHaveScreenshot(screenshot(`datetime-button-basic`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The tested behavior does not
|
* The tested behavior does not
|
||||||
* vary across modes/directions
|
* vary across modes/directions
|
||||||
|
|||||||
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 22 KiB |