Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ ion-input,css-prop,--border-width,md
ion-input,css-prop,--color,ionic
ion-input,css-prop,--color,ios
ion-input,css-prop,--color,md
ion-input,css-prop,--highlight-color-focused,ionic
ion-input,css-prop,--highlight-color-focused,ios
ion-input,css-prop,--highlight-color-focused,md
ion-input,css-prop,--highlight-color-invalid,ionic
Expand All @@ -962,7 +961,6 @@ ion-input,css-prop,--highlight-color-invalid,md
ion-input,css-prop,--highlight-color-valid,ionic
ion-input,css-prop,--highlight-color-valid,ios
ion-input,css-prop,--highlight-color-valid,md
ion-input,css-prop,--highlight-height,ionic
ion-input,css-prop,--highlight-height,ios
ion-input,css-prop,--highlight-height,md
ion-input,css-prop,--padding-bottom,ionic
Expand All @@ -989,9 +987,6 @@ ion-input,css-prop,--placeholder-font-weight,md
ion-input,css-prop,--placeholder-opacity,ionic
ion-input,css-prop,--placeholder-opacity,ios
ion-input,css-prop,--placeholder-opacity,md
ion-input,css-prop,--text-color-invalid,ionic
ion-input,css-prop,--text-color-invalid,ios
ion-input,css-prop,--text-color-invalid,md

ion-input-password-toggle,shadow
ion-input-password-toggle,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record<never, never> | undefined,undefined,false,true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "./input.vars";
@import "../../themes/mixins";

// Input
// Input: Common
// --------------------------------------------------

:host {
Expand All @@ -19,11 +19,8 @@
* @prop --placeholder-font-weight: Font weight of the input placeholder text
* @prop --placeholder-opacity: Opacity of the input placeholder text
*
* @prop --highlight-height: The height of the highlight on the input. Only applies to md mode.
* @prop --highlight-color-focused: The color of the highlight on the input when focused
* @prop --highlight-color-valid: The color of the highlight on the input when valid
* @prop --highlight-color-invalid: The color of the highlight on the input when invalid
* @prop --text-color-invalid: The color of the error text on the input when invalid. Only applies to ionic theme.
*
* @prop --border-color: Color of the border below the input when using helper text, error text, or counter
* @prop --border-radius: Radius of the input. A large radius may display unevenly when using fill="outline"; if needed, use shape="round" instead or increase --padding-start.
Expand All @@ -33,17 +30,11 @@
--placeholder-color: initial;
--placeholder-font-style: initial;
--placeholder-font-weight: initial;
--placeholder-opacity: #{$placeholder-opacity};
--padding-top: 0px;
--padding-end: 0px;
--padding-bottom: 0px;
--padding-start: 0px;
--background: transparent;
--color: initial;
--border-style: solid;
--highlight-color-focused: #{ion-color(primary, base)};
--highlight-color-valid: #{ion-color(success, base)};
--highlight-color-invalid: #{ion-color(danger, base)};

/**
* This is a private API that is used to switch
Expand All @@ -59,16 +50,10 @@

width: 100%;

min-height: 44px;

/* stylelint-disable-next-line all */
padding: 0 !important;

color: var(--color);

font-family: $font-family-base;

z-index: $z-index-item-input;
}

:host-context(ion-item)[slot="start"],
Expand All @@ -80,19 +65,6 @@
--highlight-color-focused: #{current-color(base)};
}

// Input Wrapper
// ----------------------------------------------------------------

/**
* Since the label sits on top of the element,
* the component needs to be taller otherwise the
* label will appear too close to the input text.
*/
:host(.input-label-placement-floating),
:host(.input-label-placement-stacked) {
min-height: 56px;
}

// Native Text Input
// --------------------------------------------------

Expand Down Expand Up @@ -191,18 +163,13 @@
align-items: center;
justify-content: center;

width: 30px;
height: 30px;

border: 0;

outline: none;

background-color: transparent;
background-repeat: no-repeat;

color: $text-color-step-400;

visibility: hidden;
appearance: none;
}
Expand All @@ -211,17 +178,6 @@
color: inherit;
}

/**
* Normally, we would not want to use :focus
* here because that would mean tapping the button
* on mobile would focus it (and keep it focused).
* However, the clear button always disappears after
* being activated, so we never get to that state.
*/
.input-clear-icon:focus {
opacity: 0.5;
}

:host(.has-value) .input-clear-icon {
visibility: visible;
}
Expand Down Expand Up @@ -293,21 +249,12 @@
// ----------------------------------------------------------------

.input-bottom {
/**
* The bottom content should take on the start and end
* padding so it is always aligned with either the label
* or the start of the text input.
*/
@include padding(5px, var(--padding-end), 0, var(--padding-start));

display: flex;

justify-content: space-between;

border-top: var(--border-width) var(--border-style) var(--border-color);

font-size: dynamic-font(12px);

white-space: normal;
}

Expand Down Expand Up @@ -342,8 +289,6 @@

.input-bottom .helper-text {
display: block;

color: $text-color-step-300;
}

:host(.ion-touched.ion-invalid) .input-bottom .error-text {
Expand All @@ -365,11 +310,7 @@
*/
@include margin-horizontal(auto, null);

color: $text-color-step-300;

white-space: nowrap;

padding-inline-start: 16px;
}

// Input Native
Expand Down Expand Up @@ -464,15 +405,6 @@
flex-direction: row;
}

:host(.input-label-placement-start) .label-text-wrapper {
/**
* The margin between the label and
* the input should be on the end
* when the label sits at the start.
*/
@include margin(0, $form-control-label-margin, 0, 0);
}

// Input Label Placement - End
// ----------------------------------------------------------------

Expand All @@ -484,27 +416,9 @@
flex-direction: row-reverse;
}

/**
* The margin between the label and
* the input should be on the start
* when the label sits at the end.
*/
:host(.input-label-placement-end) .label-text-wrapper {
@include margin(0, 0, 0, $form-control-label-margin);
}

// Input Label Placement - Fixed
// ----------------------------------------------------------------

:host(.input-label-placement-fixed) .label-text-wrapper {
/**
* The margin between the label and
* the input should be on the end
* when the label sits at the start.
*/
@include margin(0, $form-control-label-margin, 0, 0);
}

/**
* Label is on the left of the input in LTR and
* on the right in RTL. Label also has a fixed width.
Expand Down Expand Up @@ -583,32 +497,9 @@
opacity: 1;
}

/**
* This makes the label sit above the input.
*/
:host(.label-floating) .label-text-wrapper {
@include transform(translateY(50%), scale(#{$form-control-label-stacked-scale}));

/**
* Label text should not extend
* beyond the bounds of the input.
*/
max-width: calc(100% / #{$form-control-label-stacked-scale});
}

// Start/End Slots
// Input Password Toggle
// ----------------------------------------------------------------

::slotted([slot="start"]:last-of-type) {
margin-inline-end: $form-control-label-margin;
margin-inline-start: 0;
}

::slotted([slot="end"]:first-of-type) {
margin-inline-start: $form-control-label-margin;
margin-inline-end: 0;
}

/**
* The input password toggle component should be hidden when the input is readonly/disabled
* because it is not possible to edit a password.
Expand Down
19 changes: 5 additions & 14 deletions core/src/components/input/input.ionic.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "../../themes/ionic/ionic.globals.scss" as globals;
@import "./input";
@import "./input.common";
@import "./input.ionic.outline.scss";

// Ionic Input
Expand All @@ -13,7 +13,6 @@
--highlight-color-invalid: #{globals.$ion-semantics-danger-800};
--placeholder-color: #{globals.$ion-primitives-neutral-800};
--placeholder-opacity: 1;
--text-color-invalid: #{globals.$ion-semantics-danger-800};
--background: #{globals.$ion-primitives-base-white};

font-size: globals.$ion-font-size-350;
Expand Down Expand Up @@ -140,8 +139,7 @@

.input-bottom {
@include padding(globals.$ion-space-100, 0, 0, 0);

font-weight: globals.$ion-font-weight-medium;
@include globals.typography(globals.$ion-body-sm-medium);
}

.input-bottom .helper-text,
Expand All @@ -150,11 +148,7 @@
}

:host(.has-focus.ion-valid) .helper-text {
color: globals.$ion-semantics-success-900;
}

:host(.ion-touched.ion-invalid) .error-text {
color: var(--text-color-invalid);
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 code can be removed because the common file has this:

.input-bottom .error-text {
  color: var(--highlight-color-invalid);
}

color: var(--highlight-color-valid);
}

:host(.has-focus.ion-valid),
Expand All @@ -175,7 +169,6 @@
// ----------------------------------------------------------------

:host(.input-disabled) {
// color for the text within the input
--color: #{globals.$ion-primitives-neutral-500};
--background: #{globals.$ion-primitives-neutral-100};
--border-color: #{globals.$ion-primitives-neutral-300};
Expand All @@ -187,7 +180,7 @@
:host(.input-disabled:not(.ion-valid)) .input-bottom .helper-text,
:host(.input-disabled) .input-bottom .counter,
:host(.input-disabled) .label-text-wrapper {
color: globals.$ion-primitives-neutral-500;
color: globals.$ion-text-disabled;
}

:host(.input-disabled.has-focus.ion-valid) {
Expand All @@ -203,9 +196,7 @@
}

:host(.input-disabled.has-focus.ion-valid) .input-bottom .helper-text,
:host(.input-disabled.ion-touched.ion-invalid) .error-text,
:host(.input-disabled.ion-color) .input-bottom .helper-text,
:host(.input-disabled.ion-color) .helper-text {
:host(.input-disabled.ion-touched.ion-invalid) .error-text {
opacity: 0.6;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/components/input/input.ios.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "./input";
@import "./input.native";
@import "./input.ios.vars";

:host {
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/input/input.md.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "./input";
@import "./input.native";
@import "./input.md.vars";
@import "./input.md.solid.scss";
@import "./input.md.outline.scss";
Expand Down
Loading
Loading