-
Notifications
You must be signed in to change notification settings - Fork 599
/
Copy pathtext-area.styles.ts
138 lines (124 loc) · 3.24 KB
/
text-area.styles.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import { css, ElementStyles } from "@microsoft/fast-element";
import {
disabledCursor,
display,
focusVisible,
forcedColorsStylesheetBehavior,
FoundationElementTemplate,
} from "@microsoft/fast-foundation";
import {
accentFillActive,
accentFillHover,
accentFillRest,
bodyFont,
controlCornerRadius,
designUnit,
disabledOpacity,
focusStrokeOuter,
neutralFillHover,
neutralFillInputActive,
neutralFillInputHover,
neutralFillInputRest,
neutralFillRest,
neutralForegroundRest,
neutralStrokeRest,
strokeWidth,
typeRampBaseFontSize,
typeRampBaseLineHeight,
} from "../design-tokens";
import { heightNumber } from "../styles/index";
/**
* Styles for Text Area
* @public
*/
export const textAreaStyles: FoundationElementTemplate<ElementStyles> = (
context,
definition
) =>
css`
${display("inline-block")} :host {
font-family: ${bodyFont};
outline: none;
user-select: none;
}
.control {
box-sizing: border-box;
position: relative;
color: ${neutralForegroundRest};
background: ${neutralFillInputRest};
border-radius: calc(${controlCornerRadius} * 1px);
border: calc(${strokeWidth} * 1px) solid ${accentFillRest};
height: calc(${heightNumber} * 2px);
font: inherit;
font-size: ${typeRampBaseFontSize};
line-height: ${typeRampBaseLineHeight};
padding: calc(${designUnit} * 2px + 1px);
width: 100%;
resize: none;
}
.control:hover:enabled {
background: ${neutralFillInputHover};
border-color: ${accentFillHover};
}
.control:active:enabled {
background: ${neutralFillInputActive};
border-color: ${accentFillActive};
}
.control:hover,
.control:${focusVisible},
.control:disabled,
.control:active {
outline: none;
}
:host(:focus-within) .control {
border-color: ${focusStrokeOuter};
box-shadow: 0 0 0 1px ${focusStrokeOuter} inset;
}
:host([appearance="filled"]) .control {
background: ${neutralFillRest};
}
:host([appearance="filled"]:hover:not([disabled])) .control {
background: ${neutralFillHover};
}
:host([resize="both"]) .control {
resize: both;
}
:host([resize="horizontal"]) .control {
resize: horizontal;
}
:host([resize="vertical"]) .control {
resize: vertical;
}
.label {
display: block;
color: ${neutralForegroundRest};
cursor: pointer;
font-size: ${typeRampBaseFontSize};
line-height: ${typeRampBaseLineHeight};
margin-bottom: 4px;
}
.label__hidden {
display: none;
visibility: hidden;
}
:host([disabled]) .label,
:host([readonly]) .label,
:host([readonly]) .control,
:host([disabled]) .control {
cursor: ${disabledCursor};
}
:host([disabled]) {
opacity: ${disabledOpacity};
}
:host([disabled]) .control {
border-color: ${neutralStrokeRest};
}
`.withBehaviors(
forcedColorsStylesheetBehavior(
css`
:host([disabled]) {
opacity: 1;
}
`
)
);