Skip to content

feat(input): add form highlighting #26231

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

Merged
merged 148 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
621dc13
feat(input): add new js and css props
liamdebeasi Oct 31, 2022
d24428c
chore(): copy updates
liamdebeasi Oct 31, 2022
0402ae8
test(input): move old tests to legacy directory
liamdebeasi Oct 31, 2022
7643d2d
feat(input): add legacy vs modern template rendering
liamdebeasi Oct 31, 2022
259a3a2
refactor(form): add form controller
liamdebeasi Oct 31, 2022
a989e94
chore(): update comments
liamdebeasi Oct 31, 2022
2a80a5f
chore(): update tests
liamdebeasi Oct 31, 2022
08ea3a0
chore(): add moved screenshots
liamdebeasi Oct 31, 2022
bd80054
chore(): add moved screenshots
liamdebeasi Oct 31, 2022
19f4994
chore(): fix test file
liamdebeasi Oct 31, 2022
d02c144
chore(): prettier
liamdebeasi Oct 31, 2022
cea5615
feat(input): add base functionality and tests
liamdebeasi Oct 31, 2022
8d7f0c4
feat(input): add missing fixed label
liamdebeasi Oct 31, 2022
6eabc11
feat(input): add basic help text rendering
liamdebeasi Oct 31, 2022
0259004
feat(input): add helper and error text
liamdebeasi Oct 31, 2022
5f765a0
chore(): update descriptions for clarity
liamdebeasi Oct 31, 2022
3e4f70c
test(input): make sure correct content is rendered
liamdebeasi Oct 31, 2022
232d868
test(input): make sure error color can be customized
liamdebeasi Oct 31, 2022
2f6019b
chore(): update test
liamdebeasi Oct 31, 2022
5c3bb0c
chore(): add updated snapshots
Ionitron Oct 31, 2022
f8dc97f
refactor(item): deprecate helper and error slots
liamdebeasi Nov 1, 2022
23af9da
Merge branch '2591-helper' of https://github.com/ionic-team/ionic-fra…
liamdebeasi Nov 1, 2022
eeb7124
feat(input): add counter support
liamdebeasi Nov 1, 2022
b9da66c
refactor(item): deprecate counter and counterFormatter
liamdebeasi Nov 1, 2022
516a615
chore(): a few tweaks
liamdebeasi Nov 1, 2022
2d07367
test(input): clean up tests
liamdebeasi Nov 1, 2022
4a4aca7
Merge remote-tracking branch 'origin/2591-helper' into 2591-counter
liamdebeasi Nov 1, 2022
f855134
test(input): add counter tests
liamdebeasi Nov 1, 2022
a7e4426
chore(): update prop description
liamdebeasi Nov 1, 2022
fff8ed1
Merge remote-tracking branch 'origin/FW-2591' into 2591-props
liamdebeasi Nov 1, 2022
563f177
Update core/src/components/input/input.tsx
liamdebeasi Nov 1, 2022
e1696af
chore(): run build
liamdebeasi Nov 1, 2022
a17a9ae
Merge remote-tracking branch 'origin/2591-props' into 2591-template
liamdebeasi Nov 1, 2022
b458fe7
Merge remote-tracking branch 'origin/2591-template' into 2591-base
liamdebeasi Nov 1, 2022
eace2ec
Merge branch '2591-base' into 2591-helper
liamdebeasi Nov 1, 2022
8be3a58
Merge remote-tracking branch 'origin/2591-helper' into 2591-counter
liamdebeasi Nov 1, 2022
f556aee
chore(input): remove justify property
liamdebeasi Nov 1, 2022
f65f289
chore(): add updated snapshots
Ionitron Nov 1, 2022
e93d734
feat(input): add wip placement
liamdebeasi Nov 1, 2022
71cec98
chore(): clean up styles
liamdebeasi Nov 1, 2022
3a2e063
test(input): add label placement to a11y test
liamdebeasi Nov 1, 2022
d3d10db
test(input): add label placement template
liamdebeasi Nov 1, 2022
9ac44c1
fix(input): adjust input sizing for platform specs
liamdebeasi Nov 1, 2022
b2f5879
test(input): add tests for label placement
liamdebeasi Nov 1, 2022
55092f1
Merge remote-tracking branch 'origin/2591-counter' into 2591-placement
liamdebeasi Nov 1, 2022
661be60
chore(): add updated snapshots
Ionitron Nov 1, 2022
786e3ea
test(input): add base fill html
liamdebeasi Nov 2, 2022
6b8131a
Update core/src/components/input/input.tsx
liamdebeasi Nov 2, 2022
e0b5cd6
feat(input): add missing fill property
liamdebeasi Nov 2, 2022
5a0f812
refactor(): explicitly add element type
liamdebeasi Nov 2, 2022
2bf7b10
test(input): mask test uses new syntax
liamdebeasi Nov 2, 2022
1cc337a
refactor(input): access props once
liamdebeasi Nov 2, 2022
9f04dd1
Merge branch '2591-base' into 2591-helper
liamdebeasi Nov 2, 2022
4272366
chore(): fix el type
liamdebeasi Nov 2, 2022
6d09ad6
Merge remote-tracking branch 'origin/2591-props' into 2591-template
liamdebeasi Nov 2, 2022
9632c22
Merge remote-tracking branch 'origin/2591-template' into 2591-base
liamdebeasi Nov 2, 2022
79ff704
Merge remote-tracking branch 'origin/2591-base' into 2591-helper
liamdebeasi Nov 2, 2022
aa7edae
Merge remote-tracking branch 'origin/2591-helper' into 2591-counter
liamdebeasi Nov 2, 2022
15b1ab6
chore(): sync
liamdebeasi Nov 2, 2022
40e2e54
Merge remote-tracking branch 'origin/2591-placement' into 2591-fill
liamdebeasi Nov 2, 2022
fe20efa
feat(input): add base solid + shape implementation
liamdebeasi Nov 2, 2022
7670a27
chore(): padding is set on wrapper
liamdebeasi Nov 2, 2022
0a66283
chore(): use mixin
liamdebeasi Nov 2, 2022
9d13fbe
Merge remote-tracking branch 'origin/2591-placement' into 2591-fill
liamdebeasi Nov 2, 2022
3408223
fix(input): padding applied to input wrapper
liamdebeasi Nov 2, 2022
21f32a1
chore(): sync
liamdebeasi Nov 2, 2022
9d77a37
chore(): border radius is set on native input for legacy
liamdebeasi Nov 2, 2022
bf7d77c
fix(input): bottom is adjusted for padding
liamdebeasi Nov 2, 2022
c87f89b
chore(): add more examples
liamdebeasi Nov 2, 2022
10d2af3
fix(input): fixed label does not have end margin
liamdebeasi Nov 2, 2022
d4ff322
Merge remote-tracking branch 'origin/2591-placement' into 2591-fill
liamdebeasi Nov 2, 2022
056c4f4
chore(): test clean up
liamdebeasi Nov 2, 2022
71a9bdb
chore(): deprecate fill and shape on item
liamdebeasi Nov 2, 2022
9e1ce71
chore(): lint
liamdebeasi Nov 2, 2022
18662d1
test(input): add solid tests
liamdebeasi Nov 2, 2022
db83b9f
chore(): lint
liamdebeasi Nov 2, 2022
0dceaf6
chore(): add updated snapshots
Ionitron Nov 2, 2022
629f189
refactor(input): label container is now rendered in separate fn
liamdebeasi Nov 3, 2022
f3582fa
test(input): add more outline examples
liamdebeasi Nov 3, 2022
cc209d5
feat(input): first pass at outline style
liamdebeasi Nov 3, 2022
4af53c3
fix(input): shaped outline has correct padding
liamdebeasi Nov 3, 2022
5406b62
test(input): add more examples
liamdebeasi Nov 3, 2022
24626dc
chore(): update test file
liamdebeasi Nov 3, 2022
a6149ff
test(input): add outline tests
liamdebeasi Nov 3, 2022
9c52ef7
fix(input): bottom input padding is now correct
liamdebeasi Nov 3, 2022
c7d26e9
test(input): update a11y test
liamdebeasi Nov 3, 2022
b619254
fix(input): resolve a11y issues with outline style
liamdebeasi Nov 3, 2022
3803513
chore(): clean up, comments
liamdebeasi Nov 3, 2022
f1927bb
chore(): add updated snapshots
Ionitron Nov 3, 2022
e676edc
refactor(input): begin work on input taking up full container
liamdebeasi Nov 3, 2022
b167b01
Merge branch '2591-fill' of https://github.com/ionic-team/ionic-frame…
liamdebeasi Nov 3, 2022
21820dd
Revert "chore(): add updated snapshots"
liamdebeasi Nov 3, 2022
49c7563
refactor(input): move label class to host
liamdebeasi Nov 3, 2022
c4ad092
chore(): sync
liamdebeasi Nov 3, 2022
fbfd775
fix(input): inputs now take up full container
liamdebeasi Nov 3, 2022
a85ca3b
Revert "chore(): add updated snapshots"
liamdebeasi Nov 3, 2022
e58033b
fix(input): adjust size and label offset
liamdebeasi Nov 3, 2022
7e9849a
Merge remote-tracking branch 'origin/2591-placement' into 2591-fill
liamdebeasi Nov 3, 2022
f2c6c42
chore(): add updated snapshots
Ionitron Nov 3, 2022
04e17bb
chore(): add updated snapshots
Ionitron Nov 3, 2022
d825070
refactor(input): split css out into separate files, add comments
liamdebeasi Nov 3, 2022
8bc3bc8
chore(): add empty line
liamdebeasi Nov 3, 2022
ea608fa
Merge branch '2591-fill' of https://github.com/ionic-team/ionic-frame…
liamdebeasi Nov 3, 2022
6de0562
chore(): revert padding fix
liamdebeasi Nov 3, 2022
474366a
Revert "chore(): add updated snapshots"
liamdebeasi Nov 3, 2022
9ded038
Merge remote-tracking branch 'origin/2591-placement' into 2591-fill
liamdebeasi Nov 3, 2022
d5d1947
chore(): add updated snapshots
Ionitron Nov 3, 2022
4e86dea
Revert "chore(): add updated snapshots"
liamdebeasi Nov 4, 2022
26976e8
fix(input): remove bottom border from normal input
liamdebeasi Nov 4, 2022
a14c6b7
chore(): add updated snapshots
Ionitron Nov 4, 2022
1584994
fix(input): outline border thickens on focus
liamdebeasi Nov 4, 2022
ecad98e
Merge branch '2591-fill' of https://github.com/ionic-team/ionic-frame…
liamdebeasi Nov 4, 2022
64b53fc
Revert "chore(): add updated snapshots"
liamdebeasi Nov 4, 2022
8be58c1
chore(): add initial examples
liamdebeasi Nov 4, 2022
9f98f60
chore(): add updated snapshots
Ionitron Nov 4, 2022
6edf8e6
feat(input): add base highlight styles for non outline input
liamdebeasi Nov 4, 2022
74c1b10
fix(input): using color adjusts highlight, add valid/invalid
liamdebeasi Nov 4, 2022
ad86cef
fix(input): add outline styles
liamdebeasi Nov 4, 2022
d553d6b
test(input): add more highlight examples
liamdebeasi Nov 4, 2022
817f3e0
fix(input): highlight and state now shows correctly on all inputs
liamdebeasi Nov 4, 2022
11a64bf
chore(): lint
liamdebeasi Nov 4, 2022
095724a
fix(input): validity only shows up after touch
liamdebeasi Nov 4, 2022
149b980
fix(input): validation colors show up always after touch
liamdebeasi Nov 4, 2022
1897a06
fix(input): account for label too
liamdebeasi Nov 4, 2022
3f548fa
fix(input): move old styles to legacy
liamdebeasi Nov 4, 2022
b1bc5af
fix(input): outline appears on ios, animation is md
liamdebeasi Nov 4, 2022
23bcf45
fix(input): fix highlight height
liamdebeasi Nov 4, 2022
fd6201d
fix(input): highlight only appears on MD
liamdebeasi Nov 4, 2022
98754f1
fix(input): highlight styles moved to MD
liamdebeasi Nov 4, 2022
8a2e998
chore(): fix typo
liamdebeasi Nov 4, 2022
8144701
chore(): remove color for now
liamdebeasi Nov 4, 2022
d3b4eac
test(input): add screenshot tests
liamdebeasi Nov 4, 2022
417a278
chore(): code clean up
liamdebeasi Nov 4, 2022
2e2310c
chore(): add updated snapshots
Ionitron Nov 4, 2022
42a13e7
Merge branch '2591-highlight' of https://github.com/ionic-team/ionic-…
liamdebeasi Nov 4, 2022
0c85bb1
test(input): fix shape naming
liamdebeasi Nov 7, 2022
570d4de
Revert "chore(): add updated snapshots"
liamdebeasi Nov 7, 2022
6226556
chore(): add updated snapshots
Ionitron Nov 7, 2022
802063d
chore(): sync
liamdebeasi Nov 8, 2022
eba2d07
Revert "chore(): add updated snapshots"
liamdebeasi Nov 8, 2022
c0d97b2
chore(): sync
liamdebeasi Nov 8, 2022
8c8661a
chore(): add updated snapshots
Ionitron Nov 8, 2022
f6f37eb
Merge remote-tracking branch 'origin/FW-2591' into 2591-fill
liamdebeasi Nov 8, 2022
cb0a03a
Merge remote-tracking branch 'origin/2591-fill' into 2591-highlight
liamdebeasi Nov 8, 2022
caf07ea
Revert "chore(): add updated snapshots"
liamdebeasi Nov 8, 2022
b8181af
test(input): clean up higlight test
liamdebeasi Nov 8, 2022
21de21f
chore(): add updated snapshots
Ionitron Nov 8, 2022
aaa67cb
chore(): sync
liamdebeasi Nov 11, 2022
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
33 changes: 22 additions & 11 deletions core/src/components/input/input.md.outline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,32 @@
}

/**
* The border should get thicker when
* If the input has a validity state, the
* border should reflect that as a color.
*/
:host(.input-fill-outline.ion-touched.ion-valid),
:host(.input-fill-outline.ion-touched.ion-invalid) {
--border-color: var(--highlight-color);
}

/**
* Border should be
* slightly darker on hover.
*/
@media (any-hover: hover) {
:host(.input-fill-outline:hover) {
--border-color: #{$background-color-step-750};
}
}

/**
* The border should get thicker
* and take on component color when
* the input is focused.
*/
:host(.input-fill-outline.has-focus) {
--border-width: 2px;
--border-color: var(--highlight-color);
}

/**
Expand All @@ -30,16 +51,6 @@
border-top: none;
}

/**
* Border should be
* slightly darker on hover.
*/
@media (any-hover: hover) {
:host(.input-fill-outline:hover) {
--border-color: #{$background-color-step-750};
}
}

/**
* Outline inputs do not have a bottom border.
* Instead, they have a border that wraps the
Expand Down
33 changes: 33 additions & 0 deletions core/src/components/input/input.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,39 @@
min-height: 56px;
}

// Input Label
// ----------------------------------------------------------------

/**
* When the input is focused the label should
* take on the highlight color.
*/
:host(.has-focus) label {
color: var(--highlight-color);
}

// Input Highlight
// ----------------------------------------------------------------

.input-highlight {
@include position(null, null, -1px, 0);

position: absolute;

width: 100%;
height: 2px;

transform: scale(0);

transition: transform 200ms;

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

:host(.has-focus) .input-highlight {
transform: scale(1);
}

// Input Shape Rounded
// ----------------------------------------------------------------

Expand Down
9 changes: 9 additions & 0 deletions core/src/components/input/input.md.solid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
border-bottom: var(--border-width) var(--border-style) var(--border-color);
}

/**
* If the input has a validity state, the
* border should reflect that as a color.
*/
:host(.input-fill-solid.ion-touched.ion-valid) .input-wrapper,
:host(.input-fill-solid.ion-touched.ion-invalid) .input-wrapper {
--border-color: var(--highlight-color);
}

:host(.input-fill-solid) .input-bottom {
border-top: none;
}
Expand Down
50 changes: 48 additions & 2 deletions core/src/components/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
--highlight-color-valid: #{ion-color(success, base)};
--highlight-color-invalid: #{ion-color(danger, base)};

/**
* This is a private API that is used to switch
* out the highlight color based on the state
* of the component without having to write
* different selectors for different fill variants.
*/
--highlight-color: var(--highlight-color-focused);

display: block;

position: relative;
Expand Down Expand Up @@ -77,10 +85,14 @@
--padding-start: 0;
}

:host(.ion-color) {
:host(.legacy-input.ion-color) {
color: current-color(base);
}

:host(.ion-color) {
--highlight-color-focused: #{current-color(base)};
}

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

Expand Down Expand Up @@ -251,6 +263,17 @@
background: var(--background);
}

// Input Highlight
// ----------------------------------------------------------------

:host(.ion-touched.ion-invalid) {
--highlight-color: var(--highlight-color-invalid);
}

:host(.ion-touched.ion-valid) {
--highlight-color: var(--highlight-color-valid);
}

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

Expand All @@ -271,6 +294,20 @@
font-size: 12px;
}

/**
* If the input has a validity state, the
* border and label should reflect that as a color.
*/
:host(.ion-touched.ion-valid) .input-bottom,
:host(.ion-touched.ion-invalid) .input-bottom {
--border-color: var(--highlight-color);
}

:host(.ion-touched.ion-valid) label,
:host(.ion-touched.ion-invalid) label {
color: var(--highlight-color);
}

// Input Hint Text
// ----------------------------------------------------------------

Expand Down Expand Up @@ -347,7 +384,7 @@
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

// Input Label Placement
// Input Label Placement - Start
// ----------------------------------------------------------------

/**
Expand All @@ -358,6 +395,9 @@
flex-direction: row;
}

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

/**
* Label is on the right of the input in LTR and
* on the left in RTL.
Expand All @@ -375,6 +415,9 @@
@include margin(0, 0, 0, 8px);
}

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

/**
* Label is on the left of the input in LTR and
* on the right in RTL. Label also has a fixed width.
Expand All @@ -389,6 +432,9 @@
max-width: 200px;
}

// Input Label Placement - Stacked and Floating
// ----------------------------------------------------------------

/**
* Stacked: Label sits above the input and is scaled down.
* Floating: Label sits over the input when the input has no
Expand Down
2 changes: 2 additions & 0 deletions core/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ export class Input implements ComponentInterface {
const { disabled, fill, readonly, shape, inputId, labelPlacement } = this;
const mode = getIonMode(this);
const value = this.getValue();
const shouldRenderHighlight = mode === 'md' && fill !== 'outline';

return (
<Host
Expand Down Expand Up @@ -669,6 +670,7 @@ export class Input implements ComponentInterface {
onClick={this.onClearButtonClick}
/>
)}
{shouldRenderHighlight && <div class="input-highlight"></div>}
</div>
{this.renderBottomContent()}
</Host>
Expand Down
Loading