Skip to content

Commit 2d07c55

Browse files
committed
refactor(textarea): convert Light DOM LESS to SCSS
1 parent 9567de1 commit 2d07c55

File tree

7 files changed

+54
-51
lines changed

7 files changed

+54
-51
lines changed

docs/components/_index.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
/// load styles needed to test component visuals
66
@import "menu/spec";
77
@import "popover/spec";
8+
@import "textarea/spec";
89
@import "text-input/spec";
10+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@import "components/form/mixins/textControl";
2+
3+
.textarea-spec {
4+
hx-textarea-control {
5+
// ----- Pristine ---------------
6+
> textarea.mock-focus {
7+
@include hxTextControl($focused: true);
8+
}
9+
10+
// ----- Disabled ---------------
11+
> textarea:disabled.mock-focus {
12+
@include hxTextControl(disabled, $focused: true);
13+
}
14+
15+
// ----- Changed / Touched ---------------
16+
&[hx-dirty] {
17+
> textarea:invalid.mock-focus {
18+
@include hxTextControl(invalid, $focused: true);
19+
}
20+
}
21+
22+
// ----- Styled Invalid ---------------
23+
&.hxInvalid > textarea:enabled.mock-focus {
24+
@include hxTextControl(invalid, $focused: true);
25+
}
26+
}
27+
}

docs/docs.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ min-version {
319319
@import 'spec/file-input-spec';
320320
@import 'spec/panel-spec';
321321
@import 'spec/radio-spec';
322-
@import 'spec/textarea-spec';
323322

324323
/* ---------------------------------------- *\
325324
* OVERRIDES (a.k.a. "shame")

docs/styles/spec/textarea-spec.less

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/less/components.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@
2929
@import 'components/dropdown-select/index';
3030
@import 'components/file/index';
3131
@import 'components/form/index';
32-
@import 'components/textarea/index';

src/scss/components/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
@import "toast/index";
2525
@import "table/index";
2626
@import "tabset/index";
27+
@import "textarea/index";
2728
@import "text-input/index";
2829
@import "tooltip/index";
2930
@import "typography/index";

src/less/components/textarea/index.less renamed to src/scss/components/textarea/_index.scss

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
@import (reference) "mixins";
2-
@import (reference) "components/form/index";
1+
@import "mixins";
2+
@import "components/form/config";
3+
4+
/// ----- LAYOUT ----------
5+
/// (flexbox - column layout)
6+
/// +-------------+
7+
/// | label |
8+
/// +-------------+
9+
/// | textarea |
10+
/// +-------------+
11+
///
312

4-
// ----- LAYOUT ----------
5-
/* (columnar-flexbox)
6-
+-------------+
7-
| label |
8-
+-------------+
9-
| textarea |
10-
+-------------+
11-
*/
1213
hx-textarea-control {
1314
display: flex;
1415
flex-direction: column;
@@ -42,41 +43,42 @@ hx-textarea-control {
4243
// ----- PRISTINE ----------
4344
hx-textarea-control {
4445
> label {
45-
.FieldName();
46+
@include hxFieldName;
4647
}
4748

4849
> textarea {
49-
.TextControl(pristine);
50+
@include hxTextControl;
5051

5152
&:focus {
52-
.TextControl(pristine-focus);
53+
@include hxTextControl($focused: true);
5354
}
5455
}
55-
}//hx-textarea-control
56+
}
5657

5758
// ----- INVALID ----------
58-
/*
59-
1. Prevent IE from incorrectly matching textarea:disabled:invalid
60-
*/
59+
//
60+
// 1. Prevent IE from incorrectly matching textarea:disabled:invalid
61+
//
6162
hx-textarea-control[hx-dirty] > textarea:enabled:invalid, /* 1 */
6263
hx-textarea-control.hxInvalid > textarea:enabled {
63-
.TextControl(invalid);
64+
@include hxTextControl(invalid);
6465

6566
&:focus {
66-
.TextControl(invalid-focus);
67+
@include hxTextControl(invalid, $focused: true);
6768
}
6869
}
6970

7071
// ----- DISABLED ----------
7172
hx-textarea-control > textarea:disabled {
72-
.TextControl(disabled);
73+
@include hxTextControl(disabled);
74+
7375
resize: none;
7476

7577
~ label {
76-
.FieldName(disabled);
78+
@include hxFieldName(disabled);
7779
}
7880

7981
&:focus {
80-
.TextControl(disabled-focus);
82+
@include hxTextControl(disabled, $focused: true);
8183
}
8284
}

0 commit comments

Comments
 (0)