@atlaskit/textfield 5.0.5 → 5.1.3

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/codemods/{5.0.0-lite-mode.ts → 5.0.0-lite-mode.tsx} +1 -1
  3. package/codemods/__tests__/{5.0.0-lite-mode.ts → 5.0.0-lite-mode.tsx} +0 -0
  4. package/codemods/__tests__/remove-imports.tsx +1 -1
  5. package/codemods/__tests__/remove-prop.tsx +1 -1
  6. package/codemods/__tests__/rename-imports.tsx +1 -1
  7. package/codemods/migrations/{remove-imports.ts → remove-imports.tsx} +1 -1
  8. package/codemods/migrations/{remove-props.ts → remove-props.tsx} +1 -1
  9. package/codemods/migrations/{rename-imports.ts → rename-imports.tsx} +1 -1
  10. package/codemods/{utils.ts → migrations/utils.tsx} +0 -0
  11. package/dist/cjs/component-tokens.js +27 -29
  12. package/dist/cjs/index.js +1 -1
  13. package/dist/cjs/styles.js +22 -30
  14. package/dist/cjs/text-field.js +48 -45
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/component-tokens.js +25 -28
  17. package/dist/es2019/index.js +1 -1
  18. package/dist/es2019/styles.js +18 -28
  19. package/dist/es2019/text-field.js +47 -44
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/esm/component-tokens.js +25 -28
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/styles.js +18 -28
  24. package/dist/esm/text-field.js +48 -46
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/component-tokens.d.ts +22 -22
  27. package/dist/types/index.d.ts +2 -2
  28. package/dist/types/styles.d.ts +135 -46
  29. package/dist/types/text-field.d.ts +11 -2
  30. package/dist/types/types.d.ts +1 -6
  31. package/package.json +17 -21
  32. package/extract-react-types/text-field-props.tsx +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @atlaskit/textfield
2
2
 
3
+ ## 5.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 5.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 5.1.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
21
+ ## 5.1.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [`78ba9e045b8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/78ba9e045b8) - Internal refactor to align to the design system techstack.
26
+ - [`4d34d35270e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4d34d35270e) - Instrumented text field with the new theming package, `@atlaskit/tokens`.
27
+
28
+ New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
29
+ These changes are intended to be interoperable with the legacy theme implementation.
30
+ Legacy dark mode users should expect no visual or breaking changes.
31
+
32
+ ### Patch Changes
33
+
34
+ - [`af4bca32ad4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af4bca32ad4) - Internal changes to supress eslint rules.
35
+ - [`ac656b4875e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac656b4875e) - Internal style refactor with no visual change.
36
+ - Updated dependencies
37
+
3
38
  ## 5.0.5
4
39
 
5
40
  ### Patch Changes
@@ -4,7 +4,7 @@ import {
4
4
  renameThemeAppearanceImport,
5
5
  renamethemeTokensImport,
6
6
  } from './migrations/rename-imports';
7
- import { createTransformer } from './utils';
7
+ import { createTransformer } from './migrations/utils';
8
8
 
9
9
  const transformer = createTransformer('@atlaskit/textfield', [
10
10
  removeThemeProp,
@@ -1,7 +1,7 @@
1
1
  jest.autoMockOff();
2
2
 
3
3
  import { removeThemeImports } from '../migrations/remove-imports';
4
- import { createTransformer } from '../utils';
4
+ import { createTransformer } from '../migrations/utils';
5
5
 
6
6
  const transformer = createTransformer('@atlaskit/textfield', [
7
7
  removeThemeImports,
@@ -1,7 +1,7 @@
1
1
  jest.autoMockOff();
2
2
 
3
3
  import { removeThemeProp } from '../migrations/remove-props';
4
- import { createTransformer } from '../utils';
4
+ import { createTransformer } from '../migrations/utils';
5
5
 
6
6
  const transformer = createTransformer('@atlaskit/textfield', [removeThemeProp]);
7
7
 
@@ -4,7 +4,7 @@ import {
4
4
  renameThemeAppearanceImport,
5
5
  renamethemeTokensImport,
6
6
  } from '../migrations/rename-imports';
7
- import { createTransformer } from '../utils';
7
+ import { createTransformer } from '../migrations/utils';
8
8
 
9
9
  const transformer = createTransformer('@atlaskit/textfield', [
10
10
  renamethemeTokensImport,
@@ -1,4 +1,4 @@
1
- import { createRemoveImportsFor } from '../utils';
1
+ import { createRemoveImportsFor } from './utils';
2
2
 
3
3
  export const removeThemeImports = createRemoveImportsFor({
4
4
  importsToRemove: ['ThemeProps', 'ThemeTokens', 'Theme'],
@@ -1,4 +1,4 @@
1
- import { createRemoveFuncFor } from '../utils';
1
+ import { createRemoveFuncFor } from './utils';
2
2
 
3
3
  const component = '@atlaskit/textfield';
4
4
  const prop = 'theme';
@@ -1,4 +1,4 @@
1
- import { createRenameJSXFunc } from '../utils';
1
+ import { createRenameJSXFunc } from './utils';
2
2
 
3
3
  export const renamethemeTokensImport = createRenameJSXFunc(
4
4
  '@atlaskit/textfield',
File without changes
@@ -3,47 +3,45 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.placeholderTextColor = exports.disabledTextColor = exports.textColor = exports.transparent = exports.defaultBorderColorFocus = exports.defaultBorderColor = exports.defaultBackgroundColorHover = exports.defaultBackgroundColorFocus = exports.defaultBackgroundColor = exports.invalidBorderColor = exports.disabledBackgroundColor = void 0;
6
+ exports.placeholderTextColor = exports.disabledTextColor = exports.textColor = exports.transparent = exports.defaultBorderColorFocus = exports.defaultBorderColor = exports.subtleBackgroundColorHover = exports.defaultBackgroundColorHover = exports.defaultBackgroundColorFocus = exports.defaultBackgroundColor = exports.disabledBackgroundColor = void 0;
7
7
 
8
8
  var _colors = require("@atlaskit/theme/colors");
9
9
 
10
- // The following are the name for color mappings in @atlaskit/themes
11
- // The exports are the functions, not the objects, so could not be used here
12
- var disabledBackgroundColor = {
13
- light: _colors.N20,
14
- dark: _colors.DN20
15
- }; // For validation red is the new 'yellow' which was { light: Y300, dark: Y300 }
10
+ var _tokens = require("@atlaskit/tokens");
16
11
 
12
+ var disabledBackgroundColor = {
13
+ light: (0, _tokens.token)('color.background.disabled', _colors.N10),
14
+ dark: (0, _tokens.token)('color.background.disabled', _colors.DN10)
15
+ };
17
16
  exports.disabledBackgroundColor = disabledBackgroundColor;
18
- var invalidBorderColor = {
19
- light: _colors.R400,
20
- dark: _colors.R400
21
- }; // The following do not yet have a darkmode 'map': N20A, N10
22
-
23
- exports.invalidBorderColor = invalidBorderColor;
24
17
  var defaultBackgroundColor = {
25
- light: _colors.N10,
26
- dark: _colors.DN10
18
+ light: (0, _tokens.token)('color.background.subtleBorderedNeutral.resting', _colors.N10),
19
+ dark: (0, _tokens.token)('color.background.subtleBorderedNeutral.resting', _colors.DN10)
27
20
  };
28
21
  exports.defaultBackgroundColor = defaultBackgroundColor;
29
22
  var defaultBackgroundColorFocus = {
30
- light: _colors.N0,
31
- dark: _colors.DN10
23
+ light: (0, _tokens.token)('color.background.default', _colors.N0),
24
+ dark: (0, _tokens.token)('color.background.default', _colors.DN10)
32
25
  };
33
26
  exports.defaultBackgroundColorFocus = defaultBackgroundColorFocus;
34
27
  var defaultBackgroundColorHover = {
35
- light: _colors.N30,
36
- dark: _colors.DN30
28
+ light: (0, _tokens.token)('color.background.default', _colors.N30),
29
+ dark: (0, _tokens.token)('color.background.default', _colors.DN30)
37
30
  };
38
31
  exports.defaultBackgroundColorHover = defaultBackgroundColorHover;
32
+ var subtleBackgroundColorHover = {
33
+ light: (0, _tokens.token)('color.background.transparentNeutral.hover', _colors.N30),
34
+ dark: (0, _tokens.token)('color.background.transparentNeutral.hover', _colors.DN30)
35
+ };
36
+ exports.subtleBackgroundColorHover = subtleBackgroundColorHover;
39
37
  var defaultBorderColor = {
40
- light: _colors.N40,
41
- dark: _colors.DN40
38
+ light: (0, _tokens.token)('color.border.neutral', _colors.N40),
39
+ dark: (0, _tokens.token)('color.border.neutral', _colors.DN40)
42
40
  };
43
41
  exports.defaultBorderColor = defaultBorderColor;
44
42
  var defaultBorderColorFocus = {
45
- light: _colors.B100,
46
- dark: _colors.B75
43
+ light: (0, _tokens.token)('color.border.focus', _colors.B100),
44
+ dark: (0, _tokens.token)('color.border.focus', _colors.B75)
47
45
  };
48
46
  exports.defaultBorderColorFocus = defaultBorderColorFocus;
49
47
  var transparent = {
@@ -52,17 +50,17 @@ var transparent = {
52
50
  };
53
51
  exports.transparent = transparent;
54
52
  var textColor = {
55
- light: _colors.N900,
56
- dark: _colors.DN600
53
+ light: (0, _tokens.token)('color.text.highEmphasis', _colors.N900),
54
+ dark: (0, _tokens.token)('color.text.highEmphasis', _colors.DN600)
57
55
  };
58
56
  exports.textColor = textColor;
59
57
  var disabledTextColor = {
60
- light: _colors.N70,
61
- dark: _colors.DN90
58
+ light: (0, _tokens.token)('color.text.disabled', _colors.N70),
59
+ dark: (0, _tokens.token)('color.text.disabled', _colors.DN90)
62
60
  };
63
61
  exports.disabledTextColor = disabledTextColor;
64
62
  var placeholderTextColor = {
65
- light: _colors.N100,
66
- dark: _colors.DN90
63
+ light: (0, _tokens.token)('color.text.lowEmphasis', _colors.N100),
64
+ dark: (0, _tokens.token)('color.text.lowEmphasis', _colors.DN90)
67
65
  };
68
66
  exports.placeholderTextColor = placeholderTextColor;
package/dist/cjs/index.js CHANGED
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "default", {
14
14
  Object.defineProperty(exports, "TextFieldColors", {
15
15
  enumerable: true,
16
16
  get: function get() {
17
- return _styles.TextFieldColors;
17
+ return _styles.textFieldColors;
18
18
  }
19
19
  });
20
20
 
@@ -7,12 +7,16 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.TextFieldColors = exports.inputStyles = exports.containerStyles = void 0;
10
+ exports.textFieldColors = exports.inputStyles = exports.containerStyles = void 0;
11
11
 
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
 
14
+ var _colors = require("@atlaskit/theme/colors");
15
+
14
16
  var _constants = require("@atlaskit/theme/constants");
15
17
 
18
+ var _tokens = require("@atlaskit/tokens");
19
+
16
20
  var componentTokens = _interopRequireWildcard(require("./component-tokens"));
17
21
 
18
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -27,37 +31,35 @@ var fontSize = (0, _constants.fontSize)();
27
31
  var gridSize = (0, _constants.gridSize)();
28
32
  var disabledRules = {
29
33
  light: {
30
- backgroundColor: componentTokens.defaultBackgroundColor.light,
31
- backgroundColorFocus: componentTokens.disabledBackgroundColor.light,
34
+ backgroundColor: componentTokens.disabledBackgroundColor.light,
32
35
  backgroundColorHover: componentTokens.disabledBackgroundColor.light,
33
- // same as bg, appears as no border
34
- borderColor: componentTokens.defaultBackgroundColor.light,
35
- borderColorFocus: componentTokens.defaultBorderColorFocus.light,
36
+ borderColor: componentTokens.disabledBackgroundColor.light,
36
37
  textColor: componentTokens.disabledTextColor.light
37
38
  },
38
39
  dark: {
39
- backgroundColor: componentTokens.defaultBackgroundColor.dark,
40
- backgroundColorFocus: componentTokens.disabledBackgroundColor.dark,
40
+ backgroundColor: componentTokens.disabledBackgroundColor.dark,
41
41
  backgroundColorHover: componentTokens.disabledBackgroundColor.dark,
42
- // same as bg, appears as no border
43
- borderColor: componentTokens.defaultBackgroundColor.dark,
44
- borderColorFocus: componentTokens.defaultBorderColorFocus.dark,
42
+ borderColor: componentTokens.disabledBackgroundColor.dark,
45
43
  textColor: componentTokens.disabledTextColor.dark
46
44
  }
47
45
  };
48
46
  var invalidRules = {
49
47
  light: {
48
+ // ----
50
49
  backgroundColor: componentTokens.defaultBackgroundColor.light,
51
- backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.light,
52
50
  backgroundColorHover: componentTokens.defaultBackgroundColorHover.light,
53
- borderColor: componentTokens.invalidBorderColor.light,
51
+ // ^--- the above values aren't used directly they remain because its exposed by the `textFieldColors` export
52
+ backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.light,
53
+ borderColor: (0, _tokens.token)('color.iconBorder.danger', _colors.R400),
54
54
  borderColorFocus: componentTokens.defaultBorderColorFocus.light
55
55
  },
56
56
  dark: {
57
+ // ----
57
58
  backgroundColor: componentTokens.defaultBackgroundColor.dark,
58
- backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.dark,
59
59
  backgroundColorHover: componentTokens.defaultBackgroundColorHover.dark,
60
- borderColor: componentTokens.invalidBorderColor.dark,
60
+ // ^--- the above values aren't used directly they remain because its exposed by the `textFieldColors` export
61
+ backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.dark,
62
+ borderColor: (0, _tokens.token)('color.iconBorder.danger', _colors.R400),
61
63
  borderColorFocus: componentTokens.defaultBorderColorFocus.dark
62
64
  }
63
65
  };
@@ -73,7 +75,7 @@ var backgroundColorFocus = {
73
75
  };
74
76
  var backgroundColorHover = {
75
77
  standard: componentTokens.defaultBackgroundColorHover,
76
- subtle: componentTokens.defaultBackgroundColorHover,
78
+ subtle: componentTokens.subtleBackgroundColorHover,
77
79
  none: componentTokens.transparent
78
80
  };
79
81
  var borderColor = {
@@ -106,24 +108,13 @@ var getContainerTextBgAndBorderColor = function getContainerTextBgAndBorderColor
106
108
  color: disabledRules[mode].textColor,
107
109
  cursor: 'not-allowed'
108
110
  },
109
- '&[data-disabled]:focus-within': {
110
- backgroundColor: disabledRules[mode].backgroundColorFocus,
111
- borderColor: disabledRules[mode].borderColorFocus
112
- },
113
- '&[data-disabled]:hover': {
114
- backgroundColor: disabledRules[mode].backgroundColorHover
115
- },
116
111
  '&[data-invalid]': {
117
- backgroundColor: invalidRules[mode].backgroundColor,
118
112
  borderColor: invalidRules[mode].borderColor
119
113
  },
120
114
  '&[data-invalid]:focus-within': {
121
115
  backgroundColor: invalidRules[mode].backgroundColorFocus,
122
116
  borderColor: invalidRules[mode].borderColorFocus
123
117
  },
124
- '&[data-invalid]:hover': {
125
- backgroundColor: invalidRules[mode].backgroundColorHover
126
- },
127
118
  '@media screen and (-ms-high-contrast: active)': {
128
119
  '&[data-invalid]:focus-within': {
129
120
  borderColor: 'Highlight'
@@ -222,10 +213,11 @@ var inputStyles = function inputStyles(mode) {
222
213
  }
223
214
  }
224
215
  };
225
- };
216
+ }; // TODO: Remove when removing legacy theming.
217
+
226
218
 
227
219
  exports.inputStyles = inputStyles;
228
- var TextFieldColors = {
220
+ var textFieldColors = {
229
221
  backgroundColor: backgroundColor,
230
222
  backgroundColorFocus: backgroundColorFocus,
231
223
  backgroundColorHover: backgroundColorHover,
@@ -236,4 +228,4 @@ var TextFieldColors = {
236
228
  invalidRules: invalidRules,
237
229
  disabledRules: disabledRules
238
230
  };
239
- exports.TextFieldColors = TextFieldColors;
231
+ exports.textFieldColors = textFieldColors;
@@ -23,7 +23,7 @@ var _core = require("@emotion/core");
23
23
 
24
24
  var _analyticsNext = require("@atlaskit/analytics-next");
25
25
 
26
- var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
26
+ var _components = require("@atlaskit/theme/components");
27
27
 
28
28
  var _styles = require("./styles");
29
29
 
@@ -38,10 +38,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
38
38
  var analyticsParams = {
39
39
  componentName: 'textField',
40
40
  packageName: "@atlaskit/textfield",
41
- packageVersion: "5.0.5"
41
+ packageVersion: "5.1.3"
42
42
  };
43
- var TextfieldWithMode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
44
- var input = (0, _react.useRef)(null);
43
+ var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
45
44
  var _props$appearance = props.appearance,
46
45
  appearance = _props$appearance === void 0 ? 'standard' : _props$appearance,
47
46
  _props$isCompact = props.isCompact,
@@ -57,7 +56,6 @@ var TextfieldWithMode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref
57
56
  _props$isMonospaced = props.isMonospaced,
58
57
  isMonospaced = _props$isMonospaced === void 0 ? false : _props$isMonospaced,
59
58
  width = props.width,
60
- mode = props.mode,
61
59
  elemAfterInput = props.elemAfterInput,
62
60
  elemBeforeInput = props.elemBeforeInput,
63
61
  testId = props.testId,
@@ -65,7 +63,12 @@ var TextfieldWithMode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref
65
63
  onBlur = props.onBlur,
66
64
  onMouseDown = props.onMouseDown,
67
65
  className = props.className,
68
- otherProps = (0, _objectWithoutProperties2.default)(props, ["appearance", "isCompact", "isDisabled", "isInvalid", "isRequired", "isReadOnly", "isMonospaced", "width", "mode", "elemAfterInput", "elemBeforeInput", "testId", "onFocus", "onBlur", "onMouseDown", "className"]);
66
+ spreadProps = (0, _objectWithoutProperties2.default)(props, ["appearance", "isCompact", "isDisabled", "isInvalid", "isRequired", "isReadOnly", "isMonospaced", "width", "elemAfterInput", "elemBeforeInput", "testId", "onFocus", "onBlur", "onMouseDown", "className"]);
67
+ var inputRef = (0, _react.useRef)(null);
68
+
69
+ var _useGlobalTheme = (0, _components.useGlobalTheme)(),
70
+ mode = _useGlobalTheme.mode;
71
+
69
72
  var handleOnFocus = (0, _analyticsNext.usePlatformLeafEventHandler)(_objectSpread({
70
73
  fn: function fn(event) {
71
74
  onFocus && onFocus(event);
@@ -79,7 +82,7 @@ var TextfieldWithMode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref
79
82
  action: 'blurred'
80
83
  }, analyticsParams));
81
84
  var handleOnMouseDown = (0, _react.useCallback)(function (event) {
82
- /** Running e.preventDefault() on the INPUT prevents double click behaviour */
85
+ // Running e.preventDefault() on the INPUT prevents double click behaviour
83
86
  // Sadly we needed this cast as the target type is being correctly set
84
87
  var target = event.target;
85
88
 
@@ -87,80 +90,80 @@ var TextfieldWithMode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref
87
90
  event.preventDefault();
88
91
  }
89
92
 
90
- if (input && input.current && !isDisabled && document.activeElement !== input.current) {
91
- input.current.focus();
93
+ if (inputRef && inputRef.current && !isDisabled && document.activeElement !== inputRef.current) {
94
+ inputRef.current.focus();
92
95
  }
93
96
 
94
97
  onMouseDown && onMouseDown(event);
95
- }, [onMouseDown, input, isDisabled]); // we want to keep a copy of the ref as well as pass it along
96
-
98
+ }, [onMouseDown, isDisabled]);
97
99
  var setInputRef = (0, _react.useCallback)(function (inputElement) {
98
- input.current = inputElement;
99
- var forwardedRef = ref;
100
+ inputRef.current = inputElement;
100
101
 
101
- if (!forwardedRef) {
102
+ if (!ref) {
102
103
  return;
103
104
  }
104
105
 
105
- if ((0, _typeof2.default)(forwardedRef) === 'object') {
106
+ if ((0, _typeof2.default)(ref) === 'object') {
106
107
  // This is a blunder on the part of @types/react
107
108
  // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065
108
109
  // .current should be assignable
109
- // @ts-ignore
110
- forwardedRef.current = inputElement;
110
+ // @ts-expect-error
111
+ ref.current = inputElement;
111
112
  }
112
113
 
113
- if (typeof forwardedRef === 'function') {
114
- forwardedRef(inputElement);
114
+ if (typeof ref === 'function') {
115
+ ref(inputElement);
115
116
  }
116
117
  }, [ref]);
117
- var inputControlProps = {
118
- 'data-compact': isCompact ? isCompact : undefined,
119
- 'data-monospaced': isMonospaced ? isMonospaced : undefined,
120
- 'aria-invalid': isInvalid ? isInvalid : undefined
121
- };
122
- var containerControlProps = {
123
- 'data-disabled': isDisabled ? isDisabled : undefined,
124
- 'data-invalid': isInvalid ? isInvalid : undefined
125
- };
126
118
  var containerStyles = (0, _react.useMemo)(function () {
127
119
  return (0, _styles.containerStyles)(appearance, mode, width);
128
120
  }, [appearance, mode, width]);
129
121
  var inputStyle = (0, _react.useMemo)(function () {
130
122
  return (0, _styles.inputStyles)(mode);
131
123
  }, [mode]);
132
- return (// https://product-fabric.atlassian.net/browse/DST-1970
124
+ return (// We use event bubbling here to listen to any child element mouse down event.
133
125
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
134
- (0, _core.jsx)("div", (0, _extends2.default)({}, containerControlProps, {
135
- onMouseDown: handleOnMouseDown,
126
+ (0, _core.jsx)("div", {
127
+ "data-disabled": isDisabled ? isDisabled : undefined,
128
+ "data-invalid": isInvalid ? isInvalid : undefined,
136
129
  "data-ds--text-field--container": true,
137
130
  "data-testid": testId && "".concat(testId, "-container"),
131
+ onMouseDown: handleOnMouseDown // TODO: When removing legacy theming fix this.
132
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
133
+ ,
138
134
  css: containerStyles,
139
135
  className: className
140
- }), elemBeforeInput, (0, _core.jsx)("input", (0, _extends2.default)({}, otherProps, inputControlProps, {
136
+ }, elemBeforeInput, (0, _core.jsx)("input", (0, _extends2.default)({}, spreadProps, {
137
+ "data-compact": isCompact ? isCompact : undefined,
138
+ "data-monospaced": isMonospaced ? isMonospaced : undefined,
139
+ "data-ds--text-field--input": true,
140
+ "data-testid": testId,
141
+ "aria-invalid": isInvalid ? isInvalid : undefined,
141
142
  disabled: isDisabled,
142
143
  readOnly: isReadOnly,
143
144
  required: isRequired,
144
145
  onBlur: handleOnBlur,
145
146
  onFocus: handleOnFocus,
146
- ref: setInputRef,
147
- "data-ds--text-field--input": true,
148
- "data-testid": testId,
147
+ ref: setInputRef // TODO: When removing legacy theming fix this.
148
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
149
+ ,
149
150
  css: inputStyle
150
151
  })), elemAfterInput)
151
152
  );
152
153
  });
153
- var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function Textfield(props, ref) {
154
- return (0, _core.jsx)(_components.default.Consumer, null, function (_ref) {
155
- var mode = _ref.mode;
156
- return (0, _core.jsx)(TextfieldWithMode, (0, _extends2.default)({}, props, {
157
- mode: mode,
158
- ref: ref
159
- }));
160
- });
161
- });
162
154
  Textfield.displayName = 'Textfield';
155
+ /**
156
+ * __Textfield__
157
+ *
158
+ * A text field is an input that allows a user to write or edit text.
159
+ *
160
+ * - [Examples](https://atlassian.design/components/textfield/examples)
161
+ * - [Code](https://atlassian.design/components/textfield/code)
162
+ * - [Usage](https://atlassian.design/components/textfield/usage)
163
+ */
164
+
165
+ var _default = /*#__PURE__*/(0, _react.memo)(Textfield); // The above generic is used to let ERTC know what props to extract.
166
+ // See: https://github.com/atlassian/extract-react-types/issues/201
163
167
 
164
- var _default = /*#__PURE__*/(0, _react.memo)(Textfield);
165
168
 
166
169
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.0.5",
3
+ "version": "5.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,49 +1,46 @@
1
- import { B100, B75, DN10, DN20, DN30, DN40, DN600, DN90, N0, N10, N100, N20, N30, N40, N70, N900, R400 } from '@atlaskit/theme/colors'; // The following are the name for color mappings in @atlaskit/themes
2
- // The exports are the functions, not the objects, so could not be used here
3
-
1
+ import { B100, B75, DN10, DN30, DN40, DN600, DN90, N0, N10, N100, N30, N40, N70, N900 } from '@atlaskit/theme/colors';
2
+ import { token } from '@atlaskit/tokens';
4
3
  export const disabledBackgroundColor = {
5
- light: N20,
6
- dark: DN20
7
- }; // For validation red is the new 'yellow' which was { light: Y300, dark: Y300 }
8
-
9
- export const invalidBorderColor = {
10
- light: R400,
11
- dark: R400
12
- }; // The following do not yet have a darkmode 'map': N20A, N10
13
-
4
+ light: token('color.background.disabled', N10),
5
+ dark: token('color.background.disabled', DN10)
6
+ };
14
7
  export const defaultBackgroundColor = {
15
- light: N10,
16
- dark: DN10
8
+ light: token('color.background.subtleBorderedNeutral.resting', N10),
9
+ dark: token('color.background.subtleBorderedNeutral.resting', DN10)
17
10
  };
18
11
  export const defaultBackgroundColorFocus = {
19
- light: N0,
20
- dark: DN10
12
+ light: token('color.background.default', N0),
13
+ dark: token('color.background.default', DN10)
21
14
  };
22
15
  export const defaultBackgroundColorHover = {
23
- light: N30,
24
- dark: DN30
16
+ light: token('color.background.default', N30),
17
+ dark: token('color.background.default', DN30)
18
+ };
19
+ export const subtleBackgroundColorHover = {
20
+ light: token('color.background.transparentNeutral.hover', N30),
21
+ dark: token('color.background.transparentNeutral.hover', DN30)
25
22
  };
26
23
  export const defaultBorderColor = {
27
- light: N40,
28
- dark: DN40
24
+ light: token('color.border.neutral', N40),
25
+ dark: token('color.border.neutral', DN40)
29
26
  };
30
27
  export const defaultBorderColorFocus = {
31
- light: B100,
32
- dark: B75
28
+ light: token('color.border.focus', B100),
29
+ dark: token('color.border.focus', B75)
33
30
  };
34
31
  export const transparent = {
35
32
  light: 'transparent',
36
33
  dark: 'transparent'
37
34
  };
38
35
  export const textColor = {
39
- light: N900,
40
- dark: DN600
36
+ light: token('color.text.highEmphasis', N900),
37
+ dark: token('color.text.highEmphasis', DN600)
41
38
  };
42
39
  export const disabledTextColor = {
43
- light: N70,
44
- dark: DN90
40
+ light: token('color.text.disabled', N70),
41
+ dark: token('color.text.disabled', DN90)
45
42
  };
46
43
  export const placeholderTextColor = {
47
- light: N100,
48
- dark: DN90
44
+ light: token('color.text.lowEmphasis', N100),
45
+ dark: token('color.text.lowEmphasis', DN90)
49
46
  };
@@ -1,2 +1,2 @@
1
1
  export { default } from './text-field';
2
- export { TextFieldColors } from './styles';
2
+ export { textFieldColors as TextFieldColors } from './styles';