@atlaskit/textarea 4.3.11 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/styles.js +65 -54
- package/dist/cjs/text-area.js +24 -22
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/styles.js +68 -67
- package/dist/es2019/text-area.js +13 -10
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/styles.js +64 -54
- package/dist/esm/text-area.js +23 -21
- package/dist/esm/types.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/styles.d.ts +3 -4
- package/dist/types/text-area.d.ts +2 -95
- package/dist/types/types.d.ts +96 -0
- package/dist/types-ts4.0/index.d.ts +1 -0
- package/dist/types-ts4.0/styles.d.ts +3 -4
- package/dist/types-ts4.0/text-area.d.ts +2 -95
- package/dist/types-ts4.0/types.d.ts +96 -0
- package/extract-react-types/textarea-props.tsx +1 -1
- package/package.json +4 -4
- package/report.api.md +94 -34
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/textarea
|
|
2
2
|
|
|
3
|
+
## 4.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6612a236510`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6612a236510) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`32d761cfc1d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/32d761cfc1d) - [ux] Fix bug that prevented consumers from rendering a single line textarea
|
|
12
|
+
|
|
13
|
+
## 4.4.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`b8841384da6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b8841384da6) - Disabled background and border styles should not be applied to components that have either no background or transparent background to begin with. Textfield and textarea variants that do not have backgrounds (sublte or none) have no backgrounds or borders applied when disabled. As such, any comopnents that consume these will also be affected.
|
|
18
|
+
|
|
3
19
|
## 4.3.11
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/styles.js
CHANGED
|
@@ -9,6 +9,8 @@ exports.themeStyles = exports.getBaseStyles = exports.borderWidth = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
+
var _react = require("@emotion/react");
|
|
13
|
+
|
|
12
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
13
15
|
|
|
14
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -45,8 +47,8 @@ var borderBoxMinHeightCompact = function borderBoxMinHeightCompact(minimumRows,
|
|
|
45
47
|
return contentHeightCompact + compactVerticalPadding * 2 + borderHeight * 2;
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
var bgAndBorderColorStyles = function bgAndBorderColorStyles(props) {
|
|
49
|
-
return {
|
|
50
|
+
var bgAndBorderColorStyles = function bgAndBorderColorStyles(props, appearance) {
|
|
51
|
+
return (0, _react.css)(_objectSpread({
|
|
50
52
|
'&:focus': {
|
|
51
53
|
backgroundColor: props.backgroundColorFocus,
|
|
52
54
|
borderColor: props.borderColorFocus
|
|
@@ -55,112 +57,117 @@ var bgAndBorderColorStyles = function bgAndBorderColorStyles(props) {
|
|
|
55
57
|
backgroundColor: props.backgroundColor,
|
|
56
58
|
borderColor: props.borderColor
|
|
57
59
|
},
|
|
58
|
-
|
|
59
|
-
backgroundColor: props.disabledRules.backgroundColorFocus,
|
|
60
|
-
borderColor: props.disabledRules.borderColorFocus
|
|
61
|
-
},
|
|
62
|
-
'&:disabled:not(:focus)': {
|
|
63
|
-
backgroundColor: props.disabledRules.backgroundColor,
|
|
64
|
-
borderColor: props.disabledRules.borderColor
|
|
65
|
-
},
|
|
60
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
66
61
|
'&[data-invalid]:focus': {
|
|
67
62
|
backgroundColor: props.invalidRules.backgroundColorFocus,
|
|
68
63
|
borderColor: props.invalidRules.borderColorFocus
|
|
69
64
|
},
|
|
65
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
70
66
|
'&[data-invalid]:not(:focus)': {
|
|
71
67
|
backgroundColor: props.invalidRules.backgroundColor,
|
|
72
68
|
borderColor: props.invalidRules.borderColor
|
|
73
69
|
}
|
|
74
|
-
}
|
|
70
|
+
}, appearance === 'standard' ? {
|
|
71
|
+
'&:disabled:focus': {
|
|
72
|
+
backgroundColor: props.disabledRules.backgroundColorFocus,
|
|
73
|
+
borderColor: props.disabledRules.borderColorFocus
|
|
74
|
+
},
|
|
75
|
+
'&:disabled:not(:focus)': {
|
|
76
|
+
backgroundColor: props.disabledRules.backgroundColor,
|
|
77
|
+
borderColor: props.disabledRules.borderColor
|
|
78
|
+
}
|
|
79
|
+
} : {}));
|
|
75
80
|
};
|
|
76
81
|
|
|
77
82
|
var placeholderStyle = function placeholderStyle(placeholderTextColor) {
|
|
78
|
-
return {
|
|
83
|
+
return (0, _react.css)({
|
|
79
84
|
'&::placeholder': {
|
|
80
85
|
color: placeholderTextColor
|
|
81
86
|
}
|
|
82
|
-
};
|
|
87
|
+
});
|
|
83
88
|
};
|
|
84
89
|
|
|
85
90
|
var hoverBackgroundAndBorderStyles = function hoverBackgroundAndBorderStyles(props) {
|
|
86
|
-
return {
|
|
91
|
+
return (0, _react.css)({
|
|
87
92
|
'&:hover:not(:read-only):not(:focus)': {
|
|
88
93
|
backgroundColor: props.backgroundColorHover,
|
|
89
94
|
borderColor: props.borderColorHover,
|
|
90
95
|
'&:disabled': {
|
|
91
96
|
backgroundColor: props.disabledRules.backgroundColorHover
|
|
92
97
|
},
|
|
98
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
93
99
|
'&[data-invalid]': {
|
|
94
100
|
backgroundColor: props.invalidRules.backgroundColorHover
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
|
-
};
|
|
103
|
+
});
|
|
98
104
|
};
|
|
99
105
|
|
|
100
106
|
var resizeStyle = function resizeStyle(resize) {
|
|
101
107
|
if (resize === 'horizontal' || resize === 'vertical') {
|
|
102
|
-
return {
|
|
108
|
+
return (0, _react.css)({
|
|
103
109
|
resize: resize
|
|
104
|
-
};
|
|
110
|
+
});
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
if (resize === 'auto') {
|
|
108
|
-
return {
|
|
114
|
+
return (0, _react.css)({
|
|
109
115
|
resize: 'both'
|
|
110
|
-
};
|
|
116
|
+
});
|
|
111
117
|
}
|
|
112
118
|
|
|
113
|
-
return {
|
|
119
|
+
return (0, _react.css)({
|
|
114
120
|
resize: 'none'
|
|
115
|
-
};
|
|
121
|
+
});
|
|
116
122
|
};
|
|
117
123
|
|
|
118
124
|
var borderStyle = function borderStyle(appearance) {
|
|
119
|
-
return {
|
|
125
|
+
return (0, _react.css)({
|
|
120
126
|
borderStyle: appearance === 'none' ? 'none' : 'solid'
|
|
121
|
-
};
|
|
127
|
+
});
|
|
122
128
|
};
|
|
123
129
|
|
|
124
130
|
var fontFamilyStyle = function fontFamilyStyle(isMonospaced) {
|
|
125
|
-
return {
|
|
131
|
+
return (0, _react.css)({
|
|
126
132
|
fontFamily: isMonospaced ? codeFontFamily : fontFamily
|
|
127
|
-
};
|
|
133
|
+
});
|
|
128
134
|
};
|
|
129
135
|
|
|
130
136
|
var borderPaddingAndHeightStyles = function borderPaddingAndHeightStyles() {
|
|
131
137
|
var minimumRows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
132
138
|
var horizontalPaddingWithoutBorderWidth = horizontalPadding - borderWidth;
|
|
133
139
|
var borderHeight = borderWidth;
|
|
134
|
-
return {
|
|
140
|
+
return (0, _react.css)({
|
|
141
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
135
142
|
'&[data-compact]': {
|
|
143
|
+
minHeight: borderBoxMinHeightCompact(minimumRows, borderHeight),
|
|
136
144
|
padding: "".concat(compactVerticalPadding, "px ").concat(horizontalPaddingWithoutBorderWidth, "px"),
|
|
137
|
-
lineHeight: lineHeightCompact / fontSize
|
|
138
|
-
minHeight: borderBoxMinHeightCompact(minimumRows, borderHeight)
|
|
145
|
+
lineHeight: lineHeightCompact / fontSize
|
|
139
146
|
},
|
|
140
147
|
'&:not([data-compact])': {
|
|
148
|
+
minHeight: borderBoxMinHeight(minimumRows, borderHeight),
|
|
141
149
|
padding: "".concat(verticalPadding, "px ").concat(horizontalPaddingWithoutBorderWidth, "px"),
|
|
142
|
-
lineHeight: lineHeightBase / fontSize
|
|
143
|
-
minHeight: borderBoxMinHeight(minimumRows, borderHeight)
|
|
150
|
+
lineHeight: lineHeightBase / fontSize
|
|
144
151
|
}
|
|
145
|
-
};
|
|
152
|
+
});
|
|
146
153
|
};
|
|
147
154
|
|
|
148
|
-
var staticStyles = {
|
|
149
|
-
|
|
150
|
-
position: 'relative',
|
|
151
|
-
borderRadius: borderRadius,
|
|
155
|
+
var staticStyles = (0, _react.css)({
|
|
156
|
+
display: 'block',
|
|
152
157
|
boxSizing: 'border-box',
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
wordWrap: 'break-word',
|
|
156
|
-
fontSize: fontSize,
|
|
157
|
-
borderWidth: borderWidth,
|
|
158
|
+
width: '100%',
|
|
159
|
+
minWidth: 0,
|
|
158
160
|
maxWidth: '100%',
|
|
159
|
-
display: 'block',
|
|
160
161
|
margin: 0,
|
|
161
|
-
|
|
162
|
+
position: 'relative',
|
|
163
|
+
flex: '1 1 100%',
|
|
164
|
+
borderRadius: borderRadius,
|
|
165
|
+
borderWidth: borderWidth,
|
|
166
|
+
fontSize: fontSize,
|
|
162
167
|
outline: 'none',
|
|
163
|
-
|
|
168
|
+
overflow: 'auto',
|
|
169
|
+
transition: "background-color ".concat(transitionDuration, " ease-in-out, \n border-color ").concat(transitionDuration, " ease-in-out"),
|
|
170
|
+
wordWrap: 'break-word',
|
|
164
171
|
'&:disabled': _objectSpread({
|
|
165
172
|
cursor: 'not-allowed'
|
|
166
173
|
}, overrideSafariDisabledStyles),
|
|
@@ -170,7 +177,7 @@ var staticStyles = {
|
|
|
170
177
|
'&:invalid': {
|
|
171
178
|
boxShadow: 'none'
|
|
172
179
|
}
|
|
173
|
-
};
|
|
180
|
+
});
|
|
174
181
|
|
|
175
182
|
var getBaseStyles = function getBaseStyles(_ref) {
|
|
176
183
|
var minimumRows = _ref.minimumRows,
|
|
@@ -178,20 +185,24 @@ var getBaseStyles = function getBaseStyles(_ref) {
|
|
|
178
185
|
appearance = _ref.appearance,
|
|
179
186
|
isMonospaced = _ref.isMonospaced,
|
|
180
187
|
maxHeight = _ref.maxHeight;
|
|
181
|
-
return
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
189
|
+
(0, _react.css)([staticStyles, borderPaddingAndHeightStyles(minimumRows), resizeStyle(resize), borderStyle(appearance), fontFamilyStyle(isMonospaced), {
|
|
190
|
+
maxHeight: maxHeight
|
|
191
|
+
}])
|
|
192
|
+
);
|
|
184
193
|
};
|
|
185
194
|
|
|
186
195
|
exports.getBaseStyles = getBaseStyles;
|
|
187
196
|
|
|
188
|
-
var themeStyles = function themeStyles(props) {
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
197
|
+
var themeStyles = function themeStyles(props, appearance) {
|
|
198
|
+
return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
199
|
+
(0, _react.css)([bgAndBorderColorStyles(props, appearance), hoverBackgroundAndBorderStyles(props), placeholderStyle(props.placeholderTextColor), {
|
|
200
|
+
color: props.textColor,
|
|
201
|
+
'&:disabled': {
|
|
202
|
+
color: props.disabledRules.textColor
|
|
203
|
+
}
|
|
204
|
+
}])
|
|
205
|
+
);
|
|
195
206
|
};
|
|
196
207
|
|
|
197
208
|
exports.themeStyles = themeStyles;
|
package/dist/cjs/text-area.js
CHANGED
|
@@ -19,11 +19,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _react2 = require("@emotion/react");
|
|
23
23
|
|
|
24
24
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
25
25
|
|
|
26
|
-
var _components =
|
|
26
|
+
var _components = require("@atlaskit/theme/components");
|
|
27
27
|
|
|
28
28
|
var _styles = require("./styles");
|
|
29
29
|
|
|
@@ -40,7 +40,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
40
40
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
var packageName = "@atlaskit/textarea";
|
|
43
|
-
var packageVersion = "4.
|
|
43
|
+
var packageVersion = "4.5.0";
|
|
44
44
|
var analyticsParams = {
|
|
45
45
|
componentName: 'textArea',
|
|
46
46
|
packageName: packageName,
|
|
@@ -75,7 +75,7 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
|
|
|
75
75
|
_props$isMonospaced = props.isMonospaced,
|
|
76
76
|
isMonospaced = _props$isMonospaced === void 0 ? false : _props$isMonospaced,
|
|
77
77
|
_props$minimumRows = props.minimumRows,
|
|
78
|
-
minimumRows = _props$minimumRows === void 0 ?
|
|
78
|
+
minimumRows = _props$minimumRows === void 0 ? 2 : _props$minimumRows,
|
|
79
79
|
theme = props.theme,
|
|
80
80
|
testId = props.testId,
|
|
81
81
|
_props$maxHeight = props.maxHeight,
|
|
@@ -142,9 +142,9 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
|
|
|
142
142
|
maxHeight: maxHeight
|
|
143
143
|
});
|
|
144
144
|
}, [minimumRows, resize, appearance, isMonospaced, maxHeight]);
|
|
145
|
-
var textAreaStyles = [baseStyles, // not memoizing themeStyles as `tokens` is an unstable reference
|
|
146
|
-
(0, _styles.themeStyles)(tokens)];
|
|
147
|
-
return (0,
|
|
145
|
+
var textAreaStyles = (0, _react2.css)([baseStyles, // not memoizing themeStyles as `tokens` is an unstable reference
|
|
146
|
+
(0, _styles.themeStyles)(tokens, appearance)]);
|
|
147
|
+
return (0, _react2.jsx)("textarea", (0, _extends2.default)({}, controlProps, {
|
|
148
148
|
value: value,
|
|
149
149
|
disabled: isDisabled,
|
|
150
150
|
readOnly: isReadOnly,
|
|
@@ -152,7 +152,9 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
|
|
|
152
152
|
ref: getTextAreaRef,
|
|
153
153
|
onChange: handleOnChange,
|
|
154
154
|
onBlur: onBlurWithAnalytics,
|
|
155
|
-
onFocus: onFocusWithAnalytics
|
|
155
|
+
onFocus: onFocusWithAnalytics,
|
|
156
|
+
rows: minimumRows // TODO refactor to follow emotion styling rules
|
|
157
|
+
// see: https://product-fabric.atlassian.net/browse/DSP-6060
|
|
156
158
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
157
159
|
,
|
|
158
160
|
css: textAreaStyles
|
|
@@ -169,21 +171,21 @@ var TextAreaWithTokens = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
|
|
|
169
171
|
*/
|
|
170
172
|
|
|
171
173
|
var TextArea = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function TextArea(props, ref) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
174
|
+
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
175
|
+
mode = _useGlobalTheme.mode;
|
|
176
|
+
|
|
177
|
+
return (0, _react2.jsx)(_theme.Theme.Provider, {
|
|
178
|
+
value: props.theme
|
|
179
|
+
}, (0, _react2.jsx)(_theme.Theme.Consumer, {
|
|
180
|
+
appearance: props.appearance || 'standard',
|
|
181
|
+
mode: mode
|
|
182
|
+
}, function (tokens) {
|
|
183
|
+
return (0, _react2.jsx)(TextAreaWithTokens, (0, _extends2.default)({
|
|
184
|
+
ref: ref
|
|
185
|
+
}, props, {
|
|
186
|
+
tokens: tokens
|
|
185
187
|
}));
|
|
186
|
-
});
|
|
188
|
+
}));
|
|
187
189
|
}));
|
|
188
190
|
TextArea.displayName = 'TextArea';
|
|
189
191
|
var _default = TextArea;
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/styles.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { css } from '@emotion/react';
|
|
2
3
|
import { codeFontFamily as getCodeFontFamily, fontFamily as getFontFamily, fontSize as getFontSize, gridSize } from '@atlaskit/theme/constants';
|
|
3
4
|
const grid = gridSize();
|
|
4
5
|
const borderRadius = 3;
|
|
@@ -29,7 +30,7 @@ const borderBoxMinHeightCompact = (minimumRows, borderHeight) => {
|
|
|
29
30
|
return contentHeightCompact + compactVerticalPadding * 2 + borderHeight * 2;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
const bgAndBorderColorStyles = props => ({
|
|
33
|
+
const bgAndBorderColorStyles = (props, appearance) => css({
|
|
33
34
|
'&:focus': {
|
|
34
35
|
backgroundColor: props.backgroundColorFocus,
|
|
35
36
|
borderColor: props.borderColorFocus
|
|
@@ -38,105 +39,111 @@ const bgAndBorderColorStyles = props => ({
|
|
|
38
39
|
backgroundColor: props.backgroundColor,
|
|
39
40
|
borderColor: props.borderColor
|
|
40
41
|
},
|
|
41
|
-
|
|
42
|
-
backgroundColor: props.disabledRules.backgroundColorFocus,
|
|
43
|
-
borderColor: props.disabledRules.borderColorFocus
|
|
44
|
-
},
|
|
45
|
-
'&:disabled:not(:focus)': {
|
|
46
|
-
backgroundColor: props.disabledRules.backgroundColor,
|
|
47
|
-
borderColor: props.disabledRules.borderColor
|
|
48
|
-
},
|
|
42
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
49
43
|
'&[data-invalid]:focus': {
|
|
50
44
|
backgroundColor: props.invalidRules.backgroundColorFocus,
|
|
51
45
|
borderColor: props.invalidRules.borderColorFocus
|
|
52
46
|
},
|
|
47
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
53
48
|
'&[data-invalid]:not(:focus)': {
|
|
54
49
|
backgroundColor: props.invalidRules.backgroundColor,
|
|
55
50
|
borderColor: props.invalidRules.borderColor
|
|
56
|
-
}
|
|
51
|
+
},
|
|
52
|
+
// Disabled background and border styles should not be applied to components that
|
|
53
|
+
// have either no background or transparent background to begin with
|
|
54
|
+
...(appearance === 'standard' ? {
|
|
55
|
+
'&:disabled:focus': {
|
|
56
|
+
backgroundColor: props.disabledRules.backgroundColorFocus,
|
|
57
|
+
borderColor: props.disabledRules.borderColorFocus
|
|
58
|
+
},
|
|
59
|
+
'&:disabled:not(:focus)': {
|
|
60
|
+
backgroundColor: props.disabledRules.backgroundColor,
|
|
61
|
+
borderColor: props.disabledRules.borderColor
|
|
62
|
+
}
|
|
63
|
+
} : {})
|
|
57
64
|
});
|
|
58
65
|
|
|
59
|
-
const placeholderStyle = placeholderTextColor => ({
|
|
66
|
+
const placeholderStyle = placeholderTextColor => css({
|
|
60
67
|
'&::placeholder': {
|
|
61
68
|
color: placeholderTextColor
|
|
62
69
|
}
|
|
63
70
|
});
|
|
64
71
|
|
|
65
|
-
const hoverBackgroundAndBorderStyles = props => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
72
|
+
const hoverBackgroundAndBorderStyles = props => css({
|
|
73
|
+
'&:hover:not(:read-only):not(:focus)': {
|
|
74
|
+
backgroundColor: props.backgroundColorHover,
|
|
75
|
+
borderColor: props.borderColorHover,
|
|
76
|
+
'&:disabled': {
|
|
77
|
+
backgroundColor: props.disabledRules.backgroundColorHover
|
|
78
|
+
},
|
|
79
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
80
|
+
'&[data-invalid]': {
|
|
81
|
+
backgroundColor: props.invalidRules.backgroundColorHover
|
|
76
82
|
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
79
85
|
|
|
80
86
|
const resizeStyle = resize => {
|
|
81
87
|
if (resize === 'horizontal' || resize === 'vertical') {
|
|
82
|
-
return {
|
|
88
|
+
return css({
|
|
83
89
|
resize
|
|
84
|
-
};
|
|
90
|
+
});
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
if (resize === 'auto') {
|
|
88
|
-
return {
|
|
94
|
+
return css({
|
|
89
95
|
resize: 'both'
|
|
90
|
-
};
|
|
96
|
+
});
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
return {
|
|
99
|
+
return css({
|
|
94
100
|
resize: 'none'
|
|
95
|
-
};
|
|
101
|
+
});
|
|
96
102
|
};
|
|
97
103
|
|
|
98
|
-
const borderStyle = appearance => ({
|
|
104
|
+
const borderStyle = appearance => css({
|
|
99
105
|
borderStyle: appearance === 'none' ? 'none' : 'solid'
|
|
100
106
|
});
|
|
101
107
|
|
|
102
|
-
const fontFamilyStyle = isMonospaced => ({
|
|
108
|
+
const fontFamilyStyle = isMonospaced => css({
|
|
103
109
|
fontFamily: isMonospaced ? codeFontFamily : fontFamily
|
|
104
110
|
});
|
|
105
111
|
|
|
106
112
|
const borderPaddingAndHeightStyles = (minimumRows = 1) => {
|
|
107
113
|
const horizontalPaddingWithoutBorderWidth = horizontalPadding - borderWidth;
|
|
108
114
|
const borderHeight = borderWidth;
|
|
109
|
-
return {
|
|
115
|
+
return css({
|
|
116
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
110
117
|
'&[data-compact]': {
|
|
118
|
+
minHeight: borderBoxMinHeightCompact(minimumRows, borderHeight),
|
|
111
119
|
padding: `${compactVerticalPadding}px ${horizontalPaddingWithoutBorderWidth}px`,
|
|
112
|
-
lineHeight: lineHeightCompact / fontSize
|
|
113
|
-
minHeight: borderBoxMinHeightCompact(minimumRows, borderHeight)
|
|
120
|
+
lineHeight: lineHeightCompact / fontSize
|
|
114
121
|
},
|
|
115
122
|
'&:not([data-compact])': {
|
|
123
|
+
minHeight: borderBoxMinHeight(minimumRows, borderHeight),
|
|
116
124
|
padding: `${verticalPadding}px ${horizontalPaddingWithoutBorderWidth}px`,
|
|
117
|
-
lineHeight: lineHeightBase / fontSize
|
|
118
|
-
minHeight: borderBoxMinHeight(minimumRows, borderHeight)
|
|
125
|
+
lineHeight: lineHeightBase / fontSize
|
|
119
126
|
}
|
|
120
|
-
};
|
|
127
|
+
});
|
|
121
128
|
};
|
|
122
129
|
|
|
123
|
-
const staticStyles = {
|
|
124
|
-
|
|
130
|
+
const staticStyles = css({
|
|
131
|
+
display: 'block',
|
|
132
|
+
boxSizing: 'border-box',
|
|
133
|
+
width: '100%',
|
|
134
|
+
minWidth: 0,
|
|
135
|
+
maxWidth: '100%',
|
|
136
|
+
margin: 0,
|
|
125
137
|
position: 'relative',
|
|
138
|
+
flex: '1 1 100%',
|
|
126
139
|
borderRadius: borderRadius,
|
|
127
|
-
|
|
140
|
+
borderWidth: borderWidth,
|
|
141
|
+
fontSize: fontSize,
|
|
142
|
+
outline: 'none',
|
|
128
143
|
overflow: 'auto',
|
|
129
|
-
transition: `background-color ${transitionDuration} ease-in-out,
|
|
144
|
+
transition: `background-color ${transitionDuration} ease-in-out,
|
|
130
145
|
border-color ${transitionDuration} ease-in-out`,
|
|
131
146
|
wordWrap: 'break-word',
|
|
132
|
-
fontSize,
|
|
133
|
-
borderWidth: borderWidth,
|
|
134
|
-
maxWidth: '100%',
|
|
135
|
-
display: 'block',
|
|
136
|
-
margin: 0,
|
|
137
|
-
minWidth: 0,
|
|
138
|
-
outline: 'none',
|
|
139
|
-
width: '100%',
|
|
140
147
|
'&:disabled': {
|
|
141
148
|
cursor: 'not-allowed',
|
|
142
149
|
...overrideSafariDisabledStyles
|
|
@@ -147,27 +154,21 @@ const staticStyles = {
|
|
|
147
154
|
'&:invalid': {
|
|
148
155
|
boxShadow: 'none'
|
|
149
156
|
}
|
|
150
|
-
};
|
|
157
|
+
});
|
|
151
158
|
export const getBaseStyles = ({
|
|
152
159
|
minimumRows,
|
|
153
160
|
resize,
|
|
154
161
|
appearance,
|
|
155
162
|
isMonospaced,
|
|
156
163
|
maxHeight
|
|
157
|
-
}) =>
|
|
158
|
-
|
|
159
|
-
...resizeStyle(resize),
|
|
160
|
-
...borderStyle(appearance),
|
|
161
|
-
...fontFamilyStyle(isMonospaced),
|
|
164
|
+
}) => // eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
165
|
+
css([staticStyles, borderPaddingAndHeightStyles(minimumRows), resizeStyle(resize), borderStyle(appearance), fontFamilyStyle(isMonospaced), {
|
|
162
166
|
maxHeight
|
|
163
|
-
});
|
|
164
|
-
export const themeStyles = props =>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
color: props.textColor
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
};
|
|
167
|
+
}]);
|
|
168
|
+
export const themeStyles = (props, appearance) => // eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
169
|
+
css([bgAndBorderColorStyles(props, appearance), hoverBackgroundAndBorderStyles(props), placeholderStyle(props.placeholderTextColor), {
|
|
170
|
+
color: props.textColor,
|
|
171
|
+
'&:disabled': {
|
|
172
|
+
color: props.disabledRules.textColor
|
|
173
|
+
}
|
|
174
|
+
}]);
|
package/dist/es2019/text-area.js
CHANGED
|
@@ -2,13 +2,13 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { forwardRef, memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
7
|
-
import
|
|
7
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
8
8
|
import { borderWidth, getBaseStyles, themeStyles } from './styles';
|
|
9
9
|
import { Theme } from './theme';
|
|
10
10
|
const packageName = "@atlaskit/textarea";
|
|
11
|
-
const packageVersion = "4.
|
|
11
|
+
const packageVersion = "4.5.0";
|
|
12
12
|
const analyticsParams = {
|
|
13
13
|
componentName: 'textArea',
|
|
14
14
|
packageName,
|
|
@@ -35,7 +35,7 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
35
35
|
isDisabled = false,
|
|
36
36
|
isInvalid = false,
|
|
37
37
|
isMonospaced = false,
|
|
38
|
-
minimumRows =
|
|
38
|
+
minimumRows = 2,
|
|
39
39
|
theme,
|
|
40
40
|
testId,
|
|
41
41
|
maxHeight = '50vh',
|
|
@@ -102,8 +102,8 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
102
102
|
isMonospaced,
|
|
103
103
|
maxHeight
|
|
104
104
|
}), [minimumRows, resize, appearance, isMonospaced, maxHeight]);
|
|
105
|
-
const textAreaStyles = [baseStyles, // not memoizing themeStyles as `tokens` is an unstable reference
|
|
106
|
-
themeStyles(tokens)];
|
|
105
|
+
const textAreaStyles = css([baseStyles, // not memoizing themeStyles as `tokens` is an unstable reference
|
|
106
|
+
themeStyles(tokens, appearance)]);
|
|
107
107
|
return jsx("textarea", _extends({}, controlProps, {
|
|
108
108
|
value: value,
|
|
109
109
|
disabled: isDisabled,
|
|
@@ -112,7 +112,9 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
112
112
|
ref: getTextAreaRef,
|
|
113
113
|
onChange: handleOnChange,
|
|
114
114
|
onBlur: onBlurWithAnalytics,
|
|
115
|
-
onFocus: onFocusWithAnalytics
|
|
115
|
+
onFocus: onFocusWithAnalytics,
|
|
116
|
+
rows: minimumRows // TODO refactor to follow emotion styling rules
|
|
117
|
+
// see: https://product-fabric.atlassian.net/browse/DSP-6060
|
|
116
118
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
117
119
|
,
|
|
118
120
|
css: textAreaStyles
|
|
@@ -129,9 +131,10 @@ const TextAreaWithTokens = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
129
131
|
*/
|
|
130
132
|
|
|
131
133
|
const TextArea = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function TextArea(props, ref) {
|
|
132
|
-
|
|
134
|
+
const {
|
|
133
135
|
mode
|
|
134
|
-
}
|
|
136
|
+
} = useGlobalTheme();
|
|
137
|
+
return jsx(Theme.Provider, {
|
|
135
138
|
value: props.theme
|
|
136
139
|
}, jsx(Theme.Consumer, {
|
|
137
140
|
appearance: props.appearance || 'standard',
|
|
@@ -140,7 +143,7 @@ const TextArea = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function TextArea(pr
|
|
|
140
143
|
ref: ref
|
|
141
144
|
}, props, {
|
|
142
145
|
tokens: tokens
|
|
143
|
-
}))))
|
|
146
|
+
}))));
|
|
144
147
|
}));
|
|
145
148
|
TextArea.displayName = 'TextArea';
|
|
146
149
|
export default TextArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/es2019/version.json
CHANGED