Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(input): only apply the shape to the outline fill in ionic theme #29482

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ export namespace Components {
*/
"setFocus": () => Promise<void>;
/**
* Set to `"soft"` for an input with slightly rounded corners, `"round"` for an input with fully rounded corners, or `"rectangular"` for an input without rounded corners. Defaults to `"round"` for the ionic theme, and `undefined` for all other themes.
* Set to `"soft"` for an input with slightly rounded corners, `"round"` for an input with fully rounded corners, or `"rectangular"` for an input without rounded corners. Defaults to `"round"` for the ionic theme, and `undefined` for all other themes. Only applies when the fill is set to `"solid"` or `"outline"`.
*/
"shape"?: 'soft' | 'round' | 'rectangular';
/**
Expand Down Expand Up @@ -6751,7 +6751,7 @@ declare namespace LocalJSX {
*/
"required"?: boolean;
/**
* Set to `"soft"` for an input with slightly rounded corners, `"round"` for an input with fully rounded corners, or `"rectangular"` for an input without rounded corners. Defaults to `"round"` for the ionic theme, and `undefined` for all other themes.
* Set to `"soft"` for an input with slightly rounded corners, `"round"` for an input with fully rounded corners, or `"rectangular"` for an input without rounded corners. Defaults to `"round"` for the ionic theme, and `undefined` for all other themes. Only applies when the fill is set to `"solid"` or `"outline"`.
*/
"shape"?: 'soft' | 'round' | 'rectangular';
/**
Expand Down
34 changes: 23 additions & 11 deletions core/src/components/input/input.ionic.outline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
* input + label.
*/
border-bottom: none;

/**
* Do not show a background on the input wrapper as
* this includes the label, instead we apply the
* background to the native wrapper.
*/
background: transparent;
}

:host(.input-fill-outline.input-shape-round) .label-text-wrapper {
Expand Down Expand Up @@ -80,9 +87,16 @@
}

:host(.input-fill-outline) .native-wrapper {
@include border-radius(inherit);
@include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));

min-height: 40px;

/**
* Apply the background to the native input
* wrapper to only style the input.
*/
background: var(--background);
}

// Input Fill: Outline, Outline Container
Expand Down Expand Up @@ -128,21 +142,19 @@
margin-inline-start: 8px;
}

// Input - Disabled
// ----------------------------------------------------------------
// Input Shapes
// --------------------------------------------------

:host(.input-fill-outline.input-disabled) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed because it is covered by the :host(.input-disabled) class since I moved the --background variable assignment to the proper element

// color for the text within the input
--color: #{$ionic-color-neutral-400};
--background: transparent;
:host(.input-fill-outline.input-shape-soft) {
--border-radius: #{$ionic-border-radius-rounded-medium};
}

:host(.input-fill-outline.input-disabled) .native-wrapper {
--background: #{$ionic-color-neutral-10};

@include border-radius(inherit);
:host(.input-fill-outline.input-shape-round) {
--border-radius: #{$ionic-border-radius-rounded-full};
}

background: var(--background);
:host(.input-fill-outline.input-shape-rectangular) {
--border-radius: #{$ionic-border-radius-square};
}

// Input Focus
Expand Down
15 changes: 0 additions & 15 deletions core/src/components/input/input.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,6 @@
display: none;
}

// Ionic Input Shapes
// --------------------------------------------------

:host(.input-shape-soft) {
--border-radius: #{$ionic-border-radius-rounded-medium};
}

:host(.input-shape-round) {
--border-radius: #{$ionic-border-radius-rounded-full};
}

:host(.input-shape-rectangular) {
--border-radius: #{$ionic-border-radius-square};
}

// Input Bottom Content
// ----------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions core/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export class Input implements ComponentInterface {
* Set to `"soft"` for an input with slightly rounded corners, `"round"` for an input with fully
* rounded corners, or `"rectangular"` for an input without rounded corners.
* Defaults to `"round"` for the ionic theme, and `undefined` for all other themes.
* Only applies when the fill is set to `"solid"` or `"outline"`.
*/
@Prop() shape?: 'soft' | 'round' | 'rectangular';

Expand Down