Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 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
9f98f60
chore(): add updated snapshots
Ionitron 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
c0d97b2
chore(): sync
liamdebeasi Nov 8, 2022
f6f37eb
Merge remote-tracking branch 'origin/FW-2591' into 2591-fill
liamdebeasi Nov 8, 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
158 changes: 158 additions & 0 deletions core/src/components/input/input.md.outline.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
// Input Fill: Outline
// ----------------------------------------------------------------

:host(.input-fill-outline) {
--border-color: #{$background-color-step-300};
--border-radius: 4px;
--padding-start: 16px;
--padding-end: 16px;
}

:host(.input-fill-outline.input-shape-round) {
--border-radius: 9999px;
--padding-start: 32px;
--padding-end: 32px;
}

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

/**
* The bottom content should never have
* a border with the outline style.
*/
:host(.input-fill-outline) .input-bottom {
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
* input + label.
*/
:host(.input-fill-outline) .input-wrapper {
border-bottom: none;
}

:host(.input-fill-outline.input-label-placement-stacked) label,
:host(.input-fill-outline.input-label-placement-floating) label {
@include transform-origin(center, top);
}

/**
* The label should appear on top of an outline
* container that overlaps it so it is always clickable.
*/
:host(.input-fill-outline) label,
:host(.input-fill-outline) label {
position: relative;

z-index: 1;
}

/**
* This makes the label sit above the input.
*/
:host(.has-focus.input-fill-outline.input-label-placement-floating) label,
:host(.has-value.input-fill-outline.input-label-placement-floating) label,
:host(.input-fill-outline.input-label-placement-stacked) label,
:host(.input-fill-outline.input-label-placement-stacked) label {
@include transform(translateY(-32%), scale(.75));
@include margin(0);
}

/**
* This ensures that the input does not
* overlap the floating label while still
* remaining visually centered.
*/
:host(.input-fill-outline.input-label-placement-stacked) input,
:host(.input-fill-outline.input-label-placement-floating) input {
@include margin(6px, 0, 6px, 0);
}

// Input Fill: Outline Outline Container
// ----------------------------------------------------------------

:host(.input-fill-outline) .input-outline-container {
@include position(0, 0, 0, 0);

display: flex;

position: absolute;

width: 100%;
height: 100%;
}

:host(.input-fill-outline) .input-outline-start,
:host(.input-fill-outline) .input-outline-end {
pointer-events: none;
}

/**
* By default, each piece of the container should have
* a top and bottom border. This gives the appearance
* of a unified container with a border.
*/
:host(.input-fill-outline) .input-outline-start,
:host(.input-fill-outline) .input-outline-notch,
:host(.input-fill-outline) .input-outline-end {
border-top: var(--border-width) var(--border-style) var(--border-color);
border-bottom: var(--border-width) var(--border-style) var(--border-color);
}

:host(.input-fill-outline) .input-outline-start {
@include border-radius(var(--border-radius), 0px, 0px, var(--border-radius));
@include border(null, null, null, var(--border-width) var(--border-style) var(--border-color));

width: 12px;
}

/**
* When shape="round", the starting outline fragment
* should appear with a pill shape.
*/
:host(.input-fill-outline.input-shape-round) .input-outline-start {
@include border-radius(28px, 0px, 0px, 28px);
width: 28px;
}

:host(.input-fill-outline) .input-outline-end {
@include border(null, var(--border-width) var(--border-style) var(--border-color), null, null);
@include border-radius(0px, var(--border-radius), var(--border-radius), 0px);

/**
* The ending outline fragment
* should take up the remaining free space.
*/
flex-grow: 1;
}

/**
* When the input either has focus or a value,
* there should be a "cut out" at the top for
* the floating/stacked label. We simulate this "cut out"
* by removing the top border from the notch fragment.
*/
:host(.has-focus.input-fill-outline.input-label-placement-floating) .input-outline-notch,
:host(.has-value.input-fill-outline.input-label-placement-floating) .input-outline-notch,
:host(.input-fill-outline.input-label-placement-stacked) .input-outline-notch,
:host(.input-fill-outline.input-label-placement-stacked) .input-outline-notch {
border-top: none;
}
10 changes: 9 additions & 1 deletion core/src/components/input/input.md.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import "./input";
@import "./input.md.vars";

@import "./input.md.solid.scss";
@import "./input.md.outline.scss";

// Material Design Input
// --------------------------------------------------
Expand Down Expand Up @@ -47,3 +48,10 @@
.input-wrapper {
min-height: 56px;
}

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

:host(.input-shape-round) {
--border-radius: 16px;
}
52 changes: 52 additions & 0 deletions core/src/components/input/input.md.solid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Input Fill: Solid
// ----------------------------------------------------------------

:host(.input-fill-solid) {
--background: #{$background-color-step-50};
--border-color: #{$background-color-step-500};
--border-radius: 4px;
--padding-start: 16px;
--padding-end: 16px;
}

/**
* The solid fill style has a border
* at the bottom of the input wrapper.
* As a result, the border on the "bottom
* content" is not needed.
*/
:host(.input-fill-solid) .input-wrapper {
border-bottom: var(--border-width) var(--border-style) var(--border-color);
}

:host(.input-fill-solid) .input-bottom {
border-top: none;
}

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

/**
* Background and border should be
* much darker on focus.
*/
:host(.input-fill-solid.has-focus) {
--background: #{$background-color-step-150};
--border-color: #{$background-color-step-750};
}

:host(.input-fill-solid) .input-wrapper {
/**
* Only the top left and top right borders should.
* have a radius when using a solid fill.
*/
@include border-radius(var(--border-radius), var(--border-radius), 0px, 0px);
}
32 changes: 28 additions & 4 deletions core/src/components/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
/* stylelint-disable-next-line all */
padding: 0 !important;

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

font-family: $font-family-base;
Expand All @@ -65,10 +64,13 @@

flex: 1;
align-items: center;

background: var(--background);
}

:host(.legacy-input) .native-input {
@include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
@include border-radius(var(--border-radius));
}

:host-context(ion-item:not(.item-label)) {
Expand All @@ -83,12 +85,13 @@
// --------------------------------------------------

.native-input {
@include border-radius(var(--border-radius));
@include padding(0, 0, 0, 0);
@include text-inherit();

display: inline-block;

position: relative;

flex: 1;

width: 100%;
Expand All @@ -104,6 +107,17 @@
box-sizing: border-box;
appearance: none;

/**
* This ensures the input
* remains on top of any decoration
* that we render (particularly the
* outline border when fill="outline").
* If we did not do this then Axe would
* be unable to determine the color
* contrast of the input.
*/
z-index: 1;

&::placeholder {
color: var(--placeholder-color);

Expand Down Expand Up @@ -220,23 +234,33 @@

.input-wrapper {
@include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
@include border-radius(var(--border-radius));

display: flex;

position: relative;

flex-grow: 1;

align-items: stretch;

height: 100%;

background: inherit;
transition: background-color 15ms linear;

background: var(--background);
}

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

.input-bottom {
@include padding(5px, 0, 0, 0);
/**
* 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;

Expand Down
52 changes: 50 additions & 2 deletions core/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,54 @@ export class Input implements ComponentInterface {
);
}

private renderLabel() {
const { label } = this;
if (label === undefined) {
return;
}

return <label htmlFor={this.inputId}>{this.label}</label>;
}

/**
* Renders the border container
* when fill="outline".
*/
private renderLabelContainer() {
const { labelPlacement } = this;
const hasOutlineFill = this.fill === 'outline';
const needsNotch = labelPlacement === 'floating' || labelPlacement === 'stacked';

if (hasOutlineFill) {
/**
* The outline fill has a special outline
* that appears around the input and the label.
* Certain label placements cause the
* label to translate up and create a "cut out"
* inside of that border. When this happens, we need
* to render the label inside of the input-outline-notch
* element. Otherwise, we can render it as a sibling
* of the outline container.
*/
return [
<div class="input-outline-container">
<div class="input-outline-start"></div>
<div class="input-outline-notch">{needsNotch && this.renderLabel()}</div>
<div class="input-outline-end"></div>
</div>,
!needsNotch && this.renderLabel(),
];
}

/**
* If not using the outline style,
* we can render just the label.
*/
return this.renderLabel();
}

private renderInput() {
const { disabled, label, readonly, inputId, labelPlacement } = this;
const { disabled, fill, readonly, shape, inputId, labelPlacement } = this;
const mode = getIonMode(this);
const value = this.getValue();

Expand All @@ -566,11 +612,13 @@ export class Input implements ComponentInterface {
[mode]: true,
'has-value': this.hasValue(),
'has-focus': this.hasFocus,
[`input-fill-${fill}`]: fill !== undefined,
[`input-shape-${shape}`]: shape !== undefined,
[`input-label-placement-${labelPlacement}`]: true,
})}
>
<div class="input-wrapper">
{label !== undefined && <label htmlFor={inputId}>{label}</label>}
{this.renderLabelContainer()}
<input
class="native-input"
ref={(input) => (this.nativeInput = input)}
Expand Down
Loading