diff --git a/core/api.txt b/core/api.txt index a8e0fadfeb..02e065844e 100644 --- a/core/api.txt +++ b/core/api.txt @@ -629,7 +629,7 @@ ion-input,prop,placeholder,string | undefined,undefined,false,false ion-input,prop,readonly,boolean,false,false,true ion-input,prop,required,boolean,false,false,false ion-input,prop,shape,"round" | undefined,undefined,false,false -ion-input,prop,size,"large" | undefined,undefined,false,false +ion-input,prop,size,"large" | "medium" | undefined,'medium',false,false ion-input,prop,spellcheck,boolean,false,false,false ion-input,prop,step,string | undefined,undefined,false,false ion-input,prop,theme,"ios" | "md" | "ionic",undefined,false,false diff --git a/core/src/components.d.ts b/core/src/components.d.ts index f67e78f8ed..bc80ba2c67 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -1475,9 +1475,9 @@ export namespace Components { */ "shape"?: 'round'; /** - * The size of the input. If "large", it will have an increased height. By default the size is unset. This property only applies to the `"ionic"` theme. + * The size of the input. If "large", it will have an increased height. By default the size is medium. This property only applies to the `"ionic"` theme. */ - "size"?: 'large'; + "size"?: 'medium' | 'large'; /** * If `true`, the element will have its spelling and grammar checked. */ @@ -6747,9 +6747,9 @@ declare namespace LocalJSX { */ "shape"?: 'round'; /** - * The size of the input. If "large", it will have an increased height. By default the size is unset. This property only applies to the `"ionic"` theme. + * The size of the input. If "large", it will have an increased height. By default the size is medium. This property only applies to the `"ionic"` theme. */ - "size"?: 'large'; + "size"?: 'medium' | 'large'; /** * If `true`, the element will have its spelling and grammar checked. */ diff --git a/core/src/components/input/input.ionic.scss b/core/src/components/input/input.ionic.scss index 52f5c6a0b4..26eae66371 100644 --- a/core/src/components/input/input.ionic.scss +++ b/core/src/components/input/input.ionic.scss @@ -19,10 +19,46 @@ // Ionic Input Sizes // -------------------------------------------------- +:host(.input-size-medium) .native-wrapper { + min-height: 40px; +} + :host(.input-size-large) .native-wrapper { min-height: 48px; } +// Target area +// -------------------------------------------------- +:host .native-wrapper::after { + @include position(50%, 0, null, 0); + + position: absolute; + + height: 100%; + min-height: 48px; + + transform: translateY(-50%); + + content: ""; + + // Cursor should match the native input when hovering over the target area. + cursor: text; + + z-index: 1; +} + +::slotted([slot="start"]), +::slotted([slot="end"]), +.input-clear-icon { + /** + * The target area has a z-index of 1, so the slotted elements + * should be higher. Otherwise, the slotted elements will not + * be interactable. This is especially important for the clear + * button, which should be clickable. + */ + z-index: 2; +} + // Input Clear Button // ---------------------------------------------------------------- diff --git a/core/src/components/input/input.tsx b/core/src/components/input/input.tsx index 9e90cfc517..4649ab818e 100644 --- a/core/src/components/input/input.tsx +++ b/core/src/components/input/input.tsx @@ -263,9 +263,9 @@ export class Input implements ComponentInterface { /** * The size of the input. If "large", it will have an increased height. By default the - * size is unset. This property only applies to the `"ionic"` theme. + * size is medium. This property only applies to the `"ionic"` theme. */ - @Prop() size?: 'large'; + @Prop() size?: 'medium' | 'large' = 'medium'; /** * The type of control to display. The default type is text. diff --git a/core/src/components/input/test/size/index.html b/core/src/components/input/test/size/index.html index 0990d7c614..b993cebee5 100644 --- a/core/src/components/input/test/size/index.html +++ b/core/src/components/input/test/size/index.html @@ -58,6 +58,18 @@ +
+

No Fill: No Size, Round Shape

+ +
+ +
+

Outline: No Size, Round Shape

+ +
+ + +

No Fill: Large Size

diff --git a/core/src/components/input/test/size/input.e2e.ts b/core/src/components/input/test/size/input.e2e.ts index 5c52ceca4f..1a31633180 100644 --- a/core/src/components/input/test/size/input.e2e.ts +++ b/core/src/components/input/test/size/input.e2e.ts @@ -6,6 +6,71 @@ import { configs, test } from '@utils/test/playwright'; */ configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { test.describe(title('input: size'), () => { + test.describe('input: size medium', () => { + test('should not have visual regressions', async ({ page }) => { + await page.setContent( + ` + + `, + config + ); + + const input = page.locator('ion-input'); + await expect(input).toHaveScreenshot(screenshot(`input-size-medium`)); + }); + test('should render correctly with stacked label', async ({ page }) => { + await page.setContent( + ` + + `, + config + ); + + const input = page.locator('ion-input'); + await expect(input).toHaveScreenshot(screenshot(`input-size-medium-label-stacked`)); + }); + test('should not have visual regressions with fill outline', async ({ page }) => { + await page.setContent( + ` + + `, + config + ); + + const input = page.locator('ion-input'); + await expect(input).toHaveScreenshot(screenshot(`input-size-medium-outline`)); + }); + test('should not have visual regressions with fill outline and round shape', async ({ page }) => { + await page.setContent( + ` + + `, + config + ); + + const input = page.locator('ion-input'); + await expect(input).toHaveScreenshot(screenshot(`input-size-medium-outline-round`)); + }); + }); + test.describe('input: size large', () => { test('should not have visual regressions', async ({ page }) => { await page.setContent( diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..4058af67be Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..27f7bb274d Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..2e3d33757d Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-ionic-md-ltr-light-Mobile-Safari-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..4058af67be Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..27f7bb274d Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..2e3d33757d Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-label-stacked-ionic-md-ltr-light-Mobile-Safari-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..f0da2416e7 Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..ae1c00c477 Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..07b04022c5 Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-ionic-md-ltr-light-Mobile-Safari-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..82db020ab8 Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..234f2820bc Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..171e0514c5 Binary files /dev/null and b/core/src/components/input/test/size/input.e2e.ts-snapshots/input-size-medium-outline-round-ionic-md-ltr-light-Mobile-Safari-linux.png differ