Skip to content

feat(input): add disabled state #26227

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 73 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 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
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
7670a27
chore(): padding is set on wrapper
liamdebeasi Nov 2, 2022
0a66283
chore(): use mixin
liamdebeasi Nov 2, 2022
3408223
fix(input): padding applied to input wrapper
liamdebeasi Nov 2, 2022
10d2af3
fix(input): fixed label does not have end margin
liamdebeasi Nov 2, 2022
0dceaf6
chore(): add updated snapshots
Ionitron Nov 2, 2022
49c7563
refactor(input): move label class to host
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
04e17bb
chore(): add updated snapshots
Ionitron Nov 3, 2022
d12f1d4
test(input): add disabled and readonly test
liamdebeasi Nov 3, 2022
3def77c
feat(input): add disabled and readonly support
liamdebeasi Nov 3, 2022
9a42953
chore(): add updated snapshots
Ionitron Nov 3, 2022
9ea07ee
chore(): lint
liamdebeasi Nov 3, 2022
8c4ff88
Merge branch '2591-disabled-readonly' of https://github.com/ionic-tea…
liamdebeasi Nov 3, 2022
1f51f42
chore(): sync
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
25 changes: 12 additions & 13 deletions core/src/components/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@
}
}

.native-input[disabled] {
opacity: .4;
}

:host(.legacy-input) .native-input[disabled],
:host([disabled]) {
opacity: 0.4;
}


// Input Cover: Unfocused
Expand Down Expand Up @@ -295,12 +296,11 @@

.input-wrapper label {
/**
* The padding on the label adds visual
* space between the label and the input.
* We use padding so that this space can still
* be clicked to focus the input.
* The margin between the label and
* the input should be on the end
* when the label sits at the start.
*/
@include padding(0, 8px, 0, 0);
@include margin(0, 8px, 0, 0);

/**
* This causes the label to take up
Expand Down Expand Up @@ -343,13 +343,12 @@
}

/**
* The padding on the label adds visual
* space between the label and the input.
* We use padding so that this space can still
* be clicked to focus the input.
* 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 {
@include padding(0, 0, 0, 8px);
@include margin(0, 0, 0, 8px);
}

/**
Expand Down
64 changes: 64 additions & 0 deletions core/src/components/input/test/states/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Input - Disabled</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
<script src="../../../../../scripts/testing/scripts.js"></script>
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
<style>
.grid {
display: grid;
grid-template-columns: repeat(3, minmax(250px, 1fr));
grid-row-gap: 20px;
grid-column-gap: 20px;
}
h2 {
font-size: 12px;
font-weight: normal;

color: #6f7378;

margin-top: 10px;
}
@media screen and (max-width: 800px) {
.grid {
grid-template-columns: 1fr;
padding: 0;
}
}
</style>
</head>

<body>
<ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Input - Disabled</ion-title>
</ion-toolbar>
</ion-header>

<ion-content id="content" class="ion-padding">
<div class="grid">
<div class="grid-item">
<h2>Readonly</h2>

<ion-input label="Email" value="[email protected]" readonly="true"></ion-input>
</div>

<div class="grid-item">
<h2>Disabled</h2>

<ion-input label="Email" value="[email protected]" disabled="true"></ion-input>
</div>
</div>
</ion-content>
</ion-app>
</body>
</html>
26 changes: 26 additions & 0 deletions core/src/components/input/test/states/input.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { expect } from '@playwright/test';
import { test } from '@utils/test/playwright';

test.describe('input: states', () => {
test.beforeEach(({ skip }) => {
skip.rtl();
});

test('should render readonly input correctly', async ({ page }) => {
await page.setContent(`
<ion-input label="Email" value="[email protected]" readonly="true"></ion-input>
`);

const input = page.locator('ion-input');
expect(await input.screenshot()).toMatchSnapshot(`input-readonly-${page.getSnapshotSettings()}.png`);
});

test('should render disabled input correctly', async ({ page }) => {
await page.setContent(`
<ion-input label="Email" value="[email protected]" disabled="true"></ion-input>
`);

const input = page.locator('ion-input');
expect(await input.screenshot()).toMatchSnapshot(`input-disabled-${page.getSnapshotSettings()}.png`);
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.