Skip to content

Commit 7f1c5c1

Browse files
- update textarea css vars;
- add styles for disabled textarea; - add styles for readonly textarea;
1 parent 839969e commit 7f1c5c1

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

core/src/components/textarea/textarea.ionic.scss

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
// --------------------------------------------------
77

88
:host {
9+
--border-color: #{globals.$ion-primitives-neutral-500};
910
--color: #{globals.$ion-primitives-neutral-1200};
10-
--highlight-color-valid: #{globals.$ion-semantics-success-base};
11-
--highlight-color-invalid: #{globals.$ion-semantics-danger-base};
11+
--highlight-color-valid: #{globals.$ion-semantics-success-900};
12+
--highlight-color-invalid: #{globals.$ion-semantics-danger-800};
1213
--placeholder-color: #{globals.$ion-primitives-neutral-800};
1314
--placeholder-opacity: 1;
1415
--background: #{globals.$ion-primitives-base-white};
@@ -138,6 +139,13 @@ ion-icon {
138139
--border-width: #{globals.$ion-border-size-025};
139140
}
140141

142+
// Textarea - Readonly
143+
// ----------------------------------------------------------------
144+
145+
:host(.textarea-readonly) {
146+
--background: #{globals.$ion-primitives-neutral-100};
147+
}
148+
141149
// Textarea Highlight
142150
// ----------------------------------------------------------------
143151

@@ -166,3 +174,41 @@ ion-icon {
166174
:host(.has-focus) .textarea-highlight {
167175
transform: scale(1);
168176
}
177+
178+
// Textarea - Disabled
179+
// ----------------------------------------------------------------
180+
181+
:host(.textarea-disabled) {
182+
// color for the text within the textarea
183+
--color: #{globals.$ion-primitives-neutral-500};
184+
--background: #{globals.$ion-primitives-neutral-100};
185+
--border-color: #{globals.$ion-primitives-neutral-300};
186+
--placeholder-color: #{globals.$ion-primitives-neutral-500};
187+
188+
pointer-events: none;
189+
}
190+
191+
:host(.textarea-disabled:not(.ion-valid)) .textarea-bottom .helper-text,
192+
:host(.textarea-disabled) .textarea-bottom .counter,
193+
:host(.textarea-disabled) .label-text-wrapper {
194+
color: globals.$ion-primitives-neutral-500;
195+
}
196+
197+
:host(.textarea-disabled.has-focus.ion-valid) {
198+
--border-color: rgba(#{globals.$ion-semantics-success-base-rgb}, 0.6);
199+
}
200+
201+
:host(.textarea-disabled.ion-touched.ion-invalid) {
202+
--border-color: rgba(#{globals.$ion-semantics-danger-base-rgb}, 0.6);
203+
}
204+
205+
:host(.textarea-disabled.ion-color) {
206+
--border-color: #{current-color(base, 0.6)};
207+
}
208+
209+
:host(.textarea-disabled.has-focus.ion-valid) .textarea-bottom .helper-text,
210+
:host(.textarea-disabled.ion-touched.ion-invalid) .error-text,
211+
:host(.textarea-disabled.ion-color) .textarea-bottom .helper-text,
212+
:host(.textarea-disabled.ion-color) .helper-text {
213+
opacity: 0.6;
214+
}

core/src/components/textarea/textarea.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ export class Textarea implements ComponentInterface {
676676
}
677677

678678
render() {
679-
const { inputId, disabled, size, labelPlacement, el, hasFocus } = this;
679+
const { inputId, disabled, readonly, size, labelPlacement, el, hasFocus } = this;
680680
const fill = this.getFill();
681681
const theme = getIonTheme(this);
682682
const shape = this.getShape();
@@ -719,6 +719,7 @@ export class Textarea implements ComponentInterface {
719719
[`textarea-size-${size}`]: true,
720720
[`textarea-label-placement-${labelPlacement}`]: true,
721721
'textarea-disabled': disabled,
722+
'textarea-readonly': readonly,
722723
})}
723724
>
724725
{/**

0 commit comments

Comments
 (0)