Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
bd68bfa
fix(ios): updates to disabled label opacity for ios
brandyscarney May 3, 2023
ea2e49a
fix(range): use proper opacity for disabled range
brandyscarney May 4, 2023
9d6b872
fix(checkbox): use proper opacity for disabled checkbox
brandyscarney May 4, 2023
a5d1fbc
fix(radio): use proper opacity for disabled radio
brandyscarney May 4, 2023
85454c1
fix(select): use proper opacity for disabled select
brandyscarney May 4, 2023
575619b
fix(toggle): use proper opacity for disabled toggle
brandyscarney May 4, 2023
499910c
fix(input): use proper opacity for disabled input
brandyscarney May 4, 2023
c955958
fix: swap the opacity variable so it is consistent with the label
brandyscarney May 4, 2023
3cedb5d
test(item): add missing radio from states
brandyscarney May 4, 2023
3d75a0d
style: wording
brandyscarney May 4, 2023
af30668
Merge branch 'main' into FW-4037
brandyscarney May 4, 2023
dd43a60
Merge branch 'main' into FW-4037
brandyscarney May 4, 2023
02ecf75
test(range): improve states test to include value and ticks
brandyscarney May 4, 2023
01ba4dd
test(checkbox): migrate disabled and checked tests to states
brandyscarney May 4, 2023
352c884
test(radio): add missing unchecked disabled test
brandyscarney May 4, 2023
b26e776
Merge branch 'main' into FW-4037
brandyscarney May 4, 2023
131b78d
Merge branch 'main' into FW-4037
brandyscarney May 10, 2023
e20ed78
Merge branch 'main' into FW-4037
brandyscarney May 11, 2023
2c4fdad
chore(): add updated snapshots
Ionitron May 11, 2023
c3e6b64
Merge branch 'main' into FW-4037
brandyscarney May 11, 2023
04385af
fix(textarea): split up disabled opacity by mode
brandyscarney May 12, 2023
0458b73
fix(many): assign md disabled opacity to a shared variable
brandyscarney May 12, 2023
64c129f
fix(many): assign ios disabled opacity to a shared variable
brandyscarney May 12, 2023
e01099c
fix(checkbox/radio): assign the disabled opacity to a var
brandyscarney May 12, 2023
9d8c2d4
test(item): add disabled textarea
brandyscarney May 12, 2023
4996faf
Merge branch 'main' into FW-4037
brandyscarney May 12, 2023
1f27e94
fix(checkbox, radio): legacy checkbox/radio should disable entirely
brandyscarney May 12, 2023
d03c666
Revert "chore(): add updated snapshots"
brandyscarney May 12, 2023
10e7da5
style: combine rules
brandyscarney May 12, 2023
aacb8e2
chore(): add updated snapshots
Ionitron May 12, 2023
bace43c
fix(checkbox, radio): use same disabled opacity as label for the icons
brandyscarney May 15, 2023
1980528
fix(many): update disabled opacity to 0.38 per md spec
brandyscarney May 15, 2023
31cd79d
test(checkbox): remove migrated tests
brandyscarney May 15, 2023
493d4b2
Revert "chore(): add updated snapshots"
brandyscarney May 15, 2023
9339b84
chore(): add updated snapshots
Ionitron May 15, 2023
4b1357c
Revert "chore(): add updated snapshots"
brandyscarney May 16, 2023
3546264
Revert "test(checkbox): remove migrated tests"
brandyscarney May 16, 2023
98ac0f5
Merge branch 'main' into FW-4037
brandyscarney May 16, 2023
b43455b
test: remove screenshots from deleted tests
brandyscarney May 16, 2023
4e7bcd6
chore(): add updated snapshots
Ionitron May 16, 2023
82d3e88
Revert "fix(checkbox, radio): use same disabled opacity as label for …
brandyscarney May 16, 2023
07a66cd
style(checkbox, radio): add comments explaining 0.63 value
brandyscarney May 16, 2023
7d4ccb3
Revert "chore(): add updated snapshots"
brandyscarney May 16, 2023
d2d6939
style: extra comment
brandyscarney May 16, 2023
660d0b3
chore(): add updated snapshots
Ionitron May 16, 2023
a2d6b1b
style: clarify comment on range opacity
brandyscarney May 16, 2023
28bc2e9
Merge branch 'main' into FW-4037
brandyscarney May 16, 2023
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
3 changes: 3 additions & 0 deletions core/src/components/checkbox/checkbox.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

// iOS Checkbox: Disabled
// -----------------------------------------
// The checkbox and label should use the
// same opacity and match the other form
// controls

:host(.checkbox-disabled) {
opacity: $checkbox-ios-disabled-opacity;
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/checkbox/checkbox.ios.vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ $checkbox-ios-checkmark-width: math.div($checkbox-ios-icon-size, 6) +
$checkbox-ios-checkmark-height: $checkbox-ios-icon-size * 0.5 !default;

/// @prop - Opacity of the disabled checkbox
$checkbox-ios-disabled-opacity: .3 !default;
$checkbox-ios-disabled-opacity: $form-control-ios-disabled-opacity !default;

/// @prop - Margin top of the left checkbox item
$checkbox-ios-item-start-margin-top: 8px !default;
Expand Down
10 changes: 9 additions & 1 deletion core/src/components/checkbox/checkbox.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@

// Material Design Checkbox: Disabled
// --------------------------------------------------------
// The checkbox itself should use the disabled
// opacity set by its spec, while the label
// should match the other form controls

:host(.checkbox-disabled) {
:host(.legacy-checkbox.checkbox-disabled),
:host(.checkbox-disabled) .label-text-wrapper {
opacity: $checkbox-md-disabled-opacity;
}

:host(.checkbox-disabled) .native-wrapper {
opacity: $checkbox-md-icon-disabled-opacity;
}


// Material Design Checkbox Within An Item
// TODO(FW-3100): remove this
Expand Down
13 changes: 11 additions & 2 deletions core/src/components/checkbox/checkbox.md.vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// Material Design Checkbox
// --------------------------------------------------

/// @prop - Opacity of the disabled checkbox
$checkbox-md-disabled-opacity: .3 !default;
/// @prop - Opacity of the disabled checkbox label
$checkbox-md-disabled-opacity: $form-control-md-disabled-opacity !default;

/// @prop - Background color of the checkbox icon when off
$checkbox-md-icon-background-color-off: $item-md-background !default;
Expand Down Expand Up @@ -72,3 +72,12 @@ $checkbox-md-item-end-margin-bottom: $checkbox-md-item-end-margin-top !defau

/// @prop - Margin start of the end checkbox item
$checkbox-md-item-end-margin-start: 0 !default;

/// @prop - Opacity of the disabled checkbox
/// This value is used because the checkbox color is set to
/// `rgb(0, 0, 0, 0.60)` when enabled and we need it to be
/// `rgb(0, 0, 0, 0.38)` when disabled but the disabled
/// opacity is applied on top of the transparent color so
/// this opacity gets us the equivalent of applying `0.38`
/// on top of an opaque checkbox `rgb(0, 0, 0, 1.0)`
$checkbox-md-icon-disabled-opacity: 0.63 !default;
36 changes: 0 additions & 36 deletions core/src/components/checkbox/test/basic/checkbox.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,6 @@ import { configs, test } from '@utils/test/playwright';

configs().forEach(({ title, screenshot, config }) => {
test.describe(title('checkbox: basic visual tests'), () => {
test('should render unchecked checkbox correctly', async ({ page }) => {
await page.setContent(
`
<ion-checkbox>Unchecked</ion-checkbox>
`,
config
);

const checkbox = page.locator('ion-checkbox');
await expect(checkbox).toHaveScreenshot(screenshot(`checkbox-unchecked`));
});

test('should render checked checkbox correctly', async ({ page }) => {
await page.setContent(
`
<ion-checkbox checked>Checked</ion-checkbox>
`,
config
);

const checkbox = page.locator('ion-checkbox');
await expect(checkbox).toHaveScreenshot(screenshot(`checkbox-checked`));
});

test('should render disabled checkbox correctly', async ({ page }) => {
await page.setContent(
`
<ion-checkbox checked disabled>Disabled</ion-checkbox>
`,
config
);

const checkbox = page.locator('ion-checkbox');
await expect(checkbox).toHaveScreenshot(screenshot(`checkbox-disabled`));
});
Comment thread
brandyscarney marked this conversation as resolved.
Resolved

test('should render custom checkmark-width correctly', async ({ page }) => {
await page.setContent(
`
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
54 changes: 54 additions & 0 deletions core/src/components/checkbox/test/states/checkbox.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('checkbox: states'), () => {
test('should render disabled checkbox correctly', async ({ page }) => {
await page.setContent(
`
<ion-checkbox disabled>Label</ion-checkbox>
`,
config
);

const checkbox = page.locator('ion-checkbox');
expect(await checkbox.screenshot()).toMatchSnapshot(screenshot(`checkbox-disabled`));
});

test('should render disabled checked checkbox correctly', async ({ page }) => {
await page.setContent(
`
<ion-checkbox checked disabled>Label</ion-checkbox>
`,
config
);
Comment thread
brandyscarney marked this conversation as resolved.
Resolved

const checkbox = page.locator('ion-checkbox');
expect(await checkbox.screenshot()).toMatchSnapshot(screenshot(`checkbox-checked-disabled`));
});

test('should render checked checkbox correctly', async ({ page }) => {
await page.setContent(
`
<ion-checkbox checked>Label</ion-checkbox>
`,
config
);

const checkbox = page.locator('ion-checkbox');
expect(await checkbox.screenshot()).toMatchSnapshot(screenshot(`checkbox-checked`));
});

test('should render unchecked checkbox correctly', async ({ page }) => {
await page.setContent(
`
<ion-checkbox>Label</ion-checkbox>
`,
config
);

const checkbox = page.locator('ion-checkbox');
expect(await checkbox.screenshot()).toMatchSnapshot(screenshot(`checkbox-unchecked`));
});
});
});
78 changes: 78 additions & 0 deletions core/src/components/checkbox/test/states/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<title>Checkbox - States</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(4, 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;
}
}

ion-checkbox {
width: 100%;
}
</style>
</head>

<body>
<ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Checkbox - States</ion-title>
</ion-toolbar>
</ion-header>

<ion-content id="content" class="ion-padding">
<div class="grid">
<div class="grid-item">
<h2>Unchecked</h2>
<ion-checkbox>Enable Notifications</ion-checkbox>
</div>

<div class="grid-item">
<h2>Checked</h2>
<ion-checkbox checked>Enable Notifications</ion-checkbox>
</div>

<div class="grid-item">
<h2>Disabled, Unchecked</h2>
<ion-checkbox disabled="true">Enable Notifications</ion-checkbox>
</div>

<div class="grid-item">
<h2>Disabled, Checked</h2>
<ion-checkbox disabled="true" checked>Enable Notifications</ion-checkbox>
</div>
</div>
</ion-content>
</ion-app>
</body>
</html>
11 changes: 11 additions & 0 deletions core/src/components/input/input.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,14 @@
:host(.input-label-placement-stacked) {
min-height: 56px;
}


// Input - Disabled
// ----------------------------------------------------------------
// The input, label, helper text, char counter and placeholder
// should use the same opacity and match the other form controls

:host(.legacy-input) .native-input[disabled],
:host(.input-disabled) {
opacity: #{$input-ios-disabled-opacity};
}
3 changes: 3 additions & 0 deletions core/src/components/input/input.ios.vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ $input-ios-highlight-color-valid: ion-color(success, base) !default;

/// @prop - Color of the input highlight when invalid
$input-ios-highlight-color-invalid: ion-color(danger, base) !default;

/// @prop - The opacity of the input text, label, helper text, char counter and placeholder of a disabled input
$input-ios-disabled-opacity: $form-control-ios-disabled-opacity !default;
4 changes: 4 additions & 0 deletions core/src/components/input/input.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@

// Input - Disabled
// ----------------------------------------------------------------
// The input, label, helper text, char counter and placeholder
// should use the same opacity and match the other form controls

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

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

/**
* If the input has a validity state, the
* border and label should reflect that as a color.
Expand Down
6 changes: 2 additions & 4 deletions core/src/components/input/input.md.vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,5 @@ $input-md-inset-margin-start: $item-md-padding-start !default;
/// @prop - The amount of whitespace to display on either side of the floating label
$input-md-floating-label-padding: 4px !default;

/// @prop - The disabled opacity of the input text, the label, helper text, char counter and placeholder of a disabled input.
/// This value comes from the Material Design spec:
/// - https://github.com/material-components/material-web/pull/549
$input-md-disabled-opacity: 0.37 !default;
/// @prop - The opacity of the input text, label, helper text, char counter and placeholder of a disabled input
$input-md-disabled-opacity: $form-control-md-disabled-opacity !default;
8 changes: 0 additions & 8 deletions core/src/components/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,6 @@
}
}


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


// Input Cover: Unfocused
// --------------------------------------------------
// The input cover is the div that actually receives the
Expand All @@ -193,7 +186,6 @@
opacity: 1;
}


// Clear Input Icon
// --------------------------------------------------

Expand Down
10 changes: 10 additions & 0 deletions core/src/components/item/test/disabled/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<ion-input label="Disabled Input" placeholder="Disabled" disabled></ion-input>
</ion-item>

<ion-item>
<ion-textarea label="Disabled Textarea" placeholder="Disabled" disabled></ion-textarea>
Comment thread
brandyscarney marked this conversation as resolved.
Resolved
</ion-item>

<ion-item>
<ion-toggle disabled checked> Disabled Toggle </ion-toggle>
</ion-item>
Expand All @@ -63,6 +67,12 @@
<ion-checkbox disabled checked> Disabled Checkbox </ion-checkbox>
</ion-item>

<ion-radio-group value="radio">
<ion-item>
<ion-radio disabled value="radio"> Disabled Radio </ion-radio>
</ion-item>
</ion-radio-group>

Comment thread
brandyscarney marked this conversation as resolved.
Resolved
<ion-item>
<ion-range disabled value="10">
<span slot="label">Disabled Range</span>
Expand Down
12 changes: 12 additions & 0 deletions core/src/components/item/test/legacy/disabled/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
<ion-input placeholder="Disabled" disabled></ion-input>
</ion-item>

<ion-item>
<ion-label>Disabled Textarea</ion-label>
<ion-textarea placeholder="Disabled" disabled></ion-textarea>
</ion-item>

<ion-item>
<ion-label>Disabled Toggle</ion-label>
<ion-toggle disabled checked slot="end"></ion-toggle>
Expand All @@ -67,6 +72,13 @@
<ion-checkbox disabled checked slot="start"></ion-checkbox>
</ion-item>

<ion-radio-group value="radio">
<ion-item>
<ion-label>Disabled Radio</ion-label>
<ion-radio disabled value="radio" slot="start"></ion-radio>
</ion-item>
</ion-radio-group>

<ion-item>
<ion-label>Disabled Range</ion-label>
<ion-range disabled value="10"></ion-range>
Expand Down
3 changes: 3 additions & 0 deletions core/src/components/radio/radio.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@

// iOS Radio: Disabled
// -----------------------------------------
// The radio and label should use the
// same opacity and match the other form
// controls

:host(.radio-disabled) {
opacity: $radio-ios-disabled-opacity;
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/radio/radio.ios.vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $radio-ios-icon-border-width: 2px !default;
$radio-ios-icon-border-style: solid !default;

/// @prop - Opacity of the disabled radio
$radio-ios-disabled-opacity: .3 !default;
$radio-ios-disabled-opacity: $form-control-ios-disabled-opacity !default;

/// @prop - Margin top of the item-start in a radio
$radio-ios-item-start-margin-top: 8px !default;
Expand Down
Loading