Skip to content

Commit b91802f

Browse files
committed
fix(input-group): remove invalid styles when in readonly state
1 parent f3d9344 commit b91802f

17 files changed

+147
-115
lines changed

src/components/date-picker/themes/shared/date-picker.common.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ $input-theme: input-theme.$material;
9797
}
9898
}
9999

100-
:host(:not([disabled])[invalid]),
101-
:host(:not(:disabled)[invalid]) {
100+
:host(:not([disabled], [readonly])[invalid]),
101+
:host(:not(:disabled, [readonly])[invalid]) {
102102
::part(helper-text) {
103103
color: var-get($theme, 'error-secondary-color');
104104
}

src/components/date-picker/themes/shared/date-picker.material.scss

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
$theme: $material;
55

6-
:host(:not([invalid])[outlined][readonly]:hover) {
6+
:host([outlined][readonly]:hover) {
77
igc-date-time-input::part(start),
88
igc-date-time-input::part(end),
99
igc-date-time-input::part(filler) {
@@ -15,7 +15,7 @@ $theme: $material;
1515
}
1616
}
1717

18-
:host(:not([invalid])[outlined][readonly]) {
18+
:host([outlined][readonly]) {
1919
igc-date-time-input:focus-within {
2020
&::part(start),
2121
&::part(end),
@@ -35,7 +35,7 @@ $theme: $material;
3535
}
3636
}
3737

38-
:host(:not([outlined],[invalid])[readonly]) {
38+
:host(:not([outlined])[readonly]) {
3939
igc-date-time-input:hover {
4040
&::part(container) {
4141
border-bottom-color: var-get($theme, 'idle-bottom-line-color');
@@ -56,16 +56,3 @@ $theme: $material;
5656
}
5757
}
5858
}
59-
60-
:host(:not([outlined])[readonly][invalid]) {
61-
igc-date-time-input:hover,
62-
igc-date-time-input:focus-within {
63-
&::part(container) {
64-
border-color: var-get($theme, 'error-secondary-color');
65-
66-
&::after {
67-
border-color: var-get($theme, 'error-secondary-color');
68-
}
69-
}
70-
}
71-
}

src/components/date-range-picker/themes/shared/date-range-picker.bootstrap.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ $theme: $bootstrap;
3333
}
3434
}
3535

36+
:host(:not([disabled], [readonly])[invalid]) {
37+
igc-input::part(input) {
38+
border-color: var-get($theme, 'error-secondary-color');
39+
}
40+
}
41+
42+
:host(:not([disabled], [readonly])[invalid]:focus-within) {
43+
igc-input::part(input) {
44+
box-shadow: 0 0 0 rem(4px) var-get($theme, 'error-shadow-color');
45+
}
46+
}
47+
3648
[part='separator'] {
3749
@include type-style('body-1');
3850
}

src/components/date-range-picker/themes/shared/date-range-picker.common.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ $theme: $material;
9191
}
9292
}
9393

94-
:host(:not([disabled])[invalid]),
95-
:host(:not(:disabled)[invalid]) {
94+
:host(:not([disabled], [readonly])[invalid]),
95+
:host(:not(:disabled, [readonly])[invalid]) {
9696
::part(helper-text) {
9797
color: var-get($theme, 'error-secondary-color');
9898
}

src/components/date-range-picker/themes/shared/date-range-picker.fluent.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ $theme: $fluent;
4444
}
4545
}
4646

47+
:host(:not([disabled], [readonly])[invalid]) {
48+
igc-input::part(container) {
49+
&::before {
50+
box-shadow: inset 0 0 0 var(--input-border-size) var-get($theme, 'error-secondary-color');
51+
}
52+
}
53+
}
54+
55+
:host(:not([disabled], [readonly])[invalid]:focus-within) {
56+
igc-input::part(container) {
57+
&::before {
58+
box-shadow: inset 0 0 0 calc(var(--input-border-size) + #{rem(1px)}) var-get($theme, 'error-secondary-color');
59+
}
60+
}
61+
}
62+
4763
:host(:disabled),
4864
:host([disabled]) {
4965
::part(label)::after {

src/components/date-range-picker/themes/shared/date-range-picker.indigo.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ $theme: $indigo;
5353
}
5454
}
5555

56+
:host(:not([disabled], [readonly])[invalid]) {
57+
igc-input::part(container) {
58+
caret-color: initial;
59+
border-color: var-get($theme, 'error-secondary-color');
60+
61+
&::after {
62+
background: var-get($theme, 'error-secondary-color');
63+
}
64+
}
65+
}
66+
5667
:host(:not([disabled])[invalid]),
5768
:host(:not(:disabled)[invalid]) {
5869
::part(helper-text) {

src/components/date-range-picker/themes/shared/date-range-picker.material.scss

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
$theme: $material;
55

6-
:host(:not([invalid])[outlined][readonly]:hover) {
6+
:host([outlined][readonly]:hover) {
77
igc-input::part(start),
88
igc-input::part(end),
99
igc-input::part(filler),
@@ -19,7 +19,7 @@ $theme: $material;
1919
}
2020
}
2121

22-
:host(:not([invalid])[outlined][readonly]:focus-within) {
22+
:host([outlined][readonly]:focus-within) {
2323
igc-input::part(start),
2424
igc-input::part(end),
2525
igc-input::part(filler) {
@@ -31,7 +31,7 @@ $theme: $material;
3131
}
3232
}
3333

34-
:host(:not([invalid])[outlined][readonly]) {
34+
:host([outlined][readonly]) {
3535
igc-date-time-input:focus-within {
3636
&::part(start),
3737
&::part(end),
@@ -45,14 +45,26 @@ $theme: $material;
4545
}
4646
}
4747

48+
:host(:not([disabled],[readonly])[outlined][invalid]) {
49+
igc-input::part(start),
50+
igc-input::part(end),
51+
igc-input::part(filler) {
52+
border-color: var-get($theme, 'error-secondary-color');
53+
}
54+
55+
&::part(notch) {
56+
border-bottom-color: var-get($theme, 'error-secondary-color');
57+
}
58+
}
59+
4860
:host(:not([outlined],[disabled])[readonly]) {
4961
igc-input::part(container),
5062
igc-date-time-input::part(container) {
5163
background: var-get($theme, 'box-background-focus');
5264
}
5365
}
5466

55-
:host(:not([outlined],[invalid])[readonly]:hover) {
67+
:host(:not([outlined])[readonly]:hover) {
5668
igc-input::part(container) {
5769
border-bottom-color: var-get($theme, 'idle-bottom-line-color');
5870

@@ -62,7 +74,7 @@ $theme: $material;
6274
}
6375
}
6476

65-
:host(:not([outlined],[invalid])[readonly]:focus-within) {
77+
:host(:not([outlined])[readonly]:focus-within) {
6678
igc-input::part(container) {
6779
border-bottom-color: var-get($theme, 'focused-bottom-line-color');
6880

@@ -72,7 +84,7 @@ $theme: $material;
7284
}
7385
}
7486

75-
:host(:not([outlined],[invalid])[readonly]) {
87+
:host(:not([outlined])[readonly]) {
7688
igc-date-time-input:hover {
7789
&::part(container) {
7890
border-bottom-color: var-get($theme, 'idle-bottom-line-color');
@@ -94,26 +106,18 @@ $theme: $material;
94106
}
95107
}
96108

97-
:host(:not([outlined])[invalid][readonly]:hover),
98-
:host(:not([outlined])[invalid][readonly]:focus-within) {
109+
:host(:not([disabled],[readonly])[invalid]) {
110+
igc-input::part(label) {
111+
color: var-get($theme, 'error-secondary-color');
112+
}
113+
}
114+
115+
:host(:not([disabled],[readonly],[outlined])[invalid]) {
99116
igc-input::part(container) {
100117
border-color: var-get($theme, 'error-secondary-color');
101118

102119
&::after {
103-
border-color: var-get($theme, 'error-secondary-color');
120+
background: var-get($theme, 'error-secondary-color');
104121
}
105122
}
106123
}
107-
108-
:host(:not([outlined])[readonly][invalid]) {
109-
igc-date-time-input:hover,
110-
igc-date-time-input:focus-within {
111-
&::part(container) {
112-
border-color: var-get($theme, 'error-secondary-color');
113-
114-
&::after {
115-
border-color: var-get($theme, 'error-secondary-color');
116-
}
117-
}
118-
}
119-
}

src/components/input/themes/shared/input.bootstrap.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,17 @@ $theme: $bootstrap;
170170
}
171171
}
172172

173-
:host(:not([disabled])[invalid]) {
173+
:host(:not([disabled], [readonly])[invalid]),
174+
:host(:not([disabled])[role='combobox'][invalid]),
175+
:host(:not([disabled], [readonly])[aria-haspopup='dialog'][invalid]) {
174176
[part~='input'] {
175177
border-color: var-get($theme, 'error-secondary-color');
176178
}
177179
}
178180

179-
:host(:not([disabled])[invalid]:focus-within) {
181+
:host(:not([disabled], [readonly])[invalid]:focus-within),
182+
:host(:not([disabled])[role='combobox'][invalid]:focus-within),
183+
:host(:not([disabled], [readonly])[aria-haspopup='dialog'][invalid]:focus-within) {
180184
[part~='input'] {
181185
box-shadow: 0 0 0 rem(4px) var-get($theme, 'error-shadow-color');
182186
}

src/components/input/themes/shared/input.common.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $theme: $base;
6464
}
6565
}
6666

67-
:host([invalid]) {
67+
:host([invalid]:not([disabled], [readonly])) {
6868
::part(helper-text) {
6969
color: var-get($theme, 'error-secondary-color');
7070
}

src/components/input/themes/shared/input.fluent.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ $theme: $fluent;
189189
}
190190
}
191191

192-
:host([invalid]),
193-
:host([invalid]:hover),
194-
:host([readonly][invalid]:hover),
195-
:host([readonly][invalid]:focus-within) {
192+
:host(:not([disabled], [readonly])[invalid]),
193+
:host(:not([disabled], [readonly])[invalid]:hover),
194+
:host(:not([disabled])[role='combobox'][invalid]),
195+
:host(:not([disabled], [readonly])[aria-haspopup='dialog'][invalid]) {
196196
::part(helper-text) {
197197
color: var-get($theme, 'error-secondary-color');
198198
}
@@ -204,8 +204,9 @@ $theme: $fluent;
204204
}
205205
}
206206

207-
:host([invalid]:focus-within),
208-
:host([readonly][invalid]:focus-within) {
207+
:host(:not([disabled], [readonly])[invalid]:focus-within),
208+
:host(:not([disabled])[role='combobox'][invalid]:focus-within),
209+
:host(:not([disabled], [readonly])[aria-haspopup='dialog'][invalid]:focus-within) {
209210
[part~='container'] {
210211
&::before {
211212
box-shadow: inset 0 0 0 calc(var(--input-border-size) + #{rem(1px)}) var-get($theme, 'error-secondary-color');

0 commit comments

Comments
 (0)