Skip to content

Commit 25a9464

Browse files
- remove invalid rule;
- fix error-text color; - rollback hintText logic;
1 parent f939ab0 commit 25a9464

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

core/src/components/checkbox/checkbox.ionic.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ input {
117117
}
118118

119119
.checkbox-bottom .error-text {
120-
color: globals.$ion-text-danger;
120+
color: globals.$ion-semantics-danger-800;
121121
}
122122

123123
.checkbox-bottom .helper-text {
@@ -197,9 +197,9 @@ input {
197197

198198
// Ionic Design Checkbox Invalid
199199
// --------------------------------------------------
200-
:host(.ion-invalid:not(.checkbox-checked)) {
200+
:host(.ion-invalid) {
201201
--focus-ring-color: #{globals.$ion-border-focus-error};
202-
202+
203203
.native-wrapper {
204204
border-color: globals.$ion-border-danger-default;
205205
}

core/src/components/checkbox/checkbox.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,30 +239,25 @@ export class Checkbox implements ComponentInterface {
239239
* This element should only be rendered if hint text is set.
240240
*/
241241
private renderHintText() {
242-
const { helperText, errorText, helperTextId, errorTextId, checked } = this;
242+
const { helperText, errorText, helperTextId, errorTextId } = this;
243243

244244
/**
245245
* undefined and empty string values should
246246
* be treated as not having helper/error text.
247247
*/
248-
const hasHelperText = !!helperText;
249-
const hasErrorText = !!errorText && !checked;
250-
if (!hasHelperText && !hasErrorText) {
248+
const hasHintText = !!helperText || !!errorText;
249+
if (!hasHintText) {
251250
return;
252251
}
253252

254253
return (
255254
<div class="checkbox-bottom">
256-
{hasHelperText && (
257-
<div id={helperTextId} class="helper-text" part="supporting-text helper-text">
258-
{helperText}
259-
</div>
260-
)}
261-
{hasErrorText && (
262-
<div id={errorTextId} class="error-text" part="supporting-text error-text">
263-
{errorText}
264-
</div>
265-
)}
255+
<div id={helperTextId} class="helper-text" part="supporting-text helper-text">
256+
{helperText}
257+
</div>
258+
<div id={errorTextId} class="error-text" part="supporting-text error-text">
259+
{errorText}
260+
</div>
266261
</div>
267262
);
268263
}

0 commit comments

Comments
 (0)