@atlaskit/textfield 5.6.8 → 6.0.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/textfield
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#42569](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42569) [`df6d526f3c8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/df6d526f3c8) - Removed all remaining legacy theming logic from the TextField component.
8
+
3
9
  ## 5.6.8
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -4,17 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- Object.defineProperty(exports, "TextFieldColors", {
8
- enumerable: true,
9
- get: function get() {
10
- return _styles.textFieldColors;
11
- }
12
- });
13
7
  Object.defineProperty(exports, "default", {
14
8
  enumerable: true,
15
9
  get: function get() {
16
10
  return _textField.default;
17
11
  }
18
12
  });
19
- var _textField = _interopRequireDefault(require("./text-field"));
20
- var _styles = require("./styles");
13
+ var _textField = _interopRequireDefault(require("./text-field"));
@@ -1,116 +1,78 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.textFieldColors = exports.inputStyles = exports.containerStyles = void 0;
7
+ exports.inputStyles = exports.containerStyles = void 0;
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
10
  var _colors = require("@atlaskit/theme/colors");
12
11
  var _constants = require("@atlaskit/theme/constants");
13
- var componentTokens = _interopRequireWildcard(require("./component-tokens"));
14
- 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); }
15
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
14
  var fontSize = (0, _constants.fontSize)();
19
15
  var gridSize = (0, _constants.gridSize)();
20
- var disabledRules = {
21
- light: {
22
- backgroundColor: componentTokens.disabledBackgroundColor.light,
23
- backgroundColorHover: componentTokens.disabledBackgroundColor.light,
24
- borderColor: componentTokens.disabledBackgroundColor.light,
25
- textColor: componentTokens.disabledTextColor.light
26
- },
27
- dark: {
28
- backgroundColor: componentTokens.disabledBackgroundColor.dark,
29
- backgroundColorHover: componentTokens.disabledBackgroundColor.dark,
30
- borderColor: componentTokens.disabledBackgroundColor.dark,
31
- textColor: componentTokens.disabledTextColor.dark
32
- }
33
- };
34
- var invalidRules = {
35
- light: {
36
- // ----
37
- backgroundColor: componentTokens.defaultBackgroundColor.light,
38
- backgroundColorHover: componentTokens.defaultBackgroundColorHover.light,
39
- // ^--- the above values aren't used directly they remain because its exposed by the `textFieldColors` export
40
- backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.light,
41
- borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")"),
42
- borderColorFocus: componentTokens.defaultBorderColorFocus.light
43
- },
44
- dark: {
45
- // ----
46
- backgroundColor: componentTokens.defaultBackgroundColor.dark,
47
- backgroundColorHover: componentTokens.defaultBackgroundColorHover.dark,
48
- // ^--- the above values aren't used directly they remain because its exposed by the `textFieldColors` export
49
- backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.dark,
50
- borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")"),
51
- borderColorFocus: componentTokens.defaultBorderColorFocus.dark
52
- }
53
- };
54
16
  var backgroundColor = {
55
- standard: componentTokens.defaultBackgroundColor,
56
- subtle: componentTokens.transparent,
57
- none: componentTokens.transparent
17
+ standard: "var(--ds-background-input, ".concat(_colors.N10, ")"),
18
+ subtle: 'transparent',
19
+ none: 'transparent'
58
20
  };
59
21
  var backgroundColorFocus = {
60
- standard: componentTokens.defaultBackgroundColorFocus,
61
- subtle: componentTokens.defaultBackgroundColorFocus,
62
- none: componentTokens.transparent
22
+ standard: "var(--ds-background-input-pressed, ".concat(_colors.N0, ")"),
23
+ subtle: "var(--ds-background-input-pressed, ".concat(_colors.N0, ")"),
24
+ none: 'transparent'
63
25
  };
64
26
  var backgroundColorHover = {
65
- standard: componentTokens.defaultBackgroundColorHover,
66
- subtle: componentTokens.defaultBackgroundColorHover,
67
- none: componentTokens.transparent
27
+ standard: "var(--ds-background-input-hovered, ".concat(_colors.N30, ")"),
28
+ subtle: "var(--ds-background-input-hovered, ".concat(_colors.N30, ")"),
29
+ none: 'transparent'
68
30
  };
69
31
  var borderColor = {
70
- standard: componentTokens.defaultBorderColor,
71
- subtle: componentTokens.transparent,
72
- none: componentTokens.transparent
32
+ standard: "var(--ds-border-input, ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? _colors.N100 : _colors.N40, ")"),
33
+ subtle: 'transparent',
34
+ none: 'transparent'
73
35
  };
74
36
  var borderColorFocus = {
75
- standard: componentTokens.defaultBorderColorFocus,
76
- subtle: componentTokens.defaultBorderColorFocus,
77
- none: componentTokens.transparent
37
+ standard: "var(--ds-border-focused, ".concat(_colors.B200, ")"),
38
+ subtle: "var(--ds-border-focused, ".concat(_colors.B200, ")"),
39
+ none: 'transparent'
78
40
  };
79
41
  var borderColorHover = {
80
- standard: componentTokens.defaultBorderColor,
81
- subtle: componentTokens.subtleBorderColorHover,
82
- none: componentTokens.transparent
42
+ standard: "var(--ds-border-input, ".concat((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? _colors.N100 : _colors.N40, ")"),
43
+ subtle: "var(--ds-border-input, transparent)",
44
+ none: 'transparent'
83
45
  };
84
- var getContainerTextBgAndBorderColor = function getContainerTextBgAndBorderColor(appearance, mode) {
46
+ var getContainerTextBgAndBorderColor = function getContainerTextBgAndBorderColor(appearance) {
85
47
  return {
86
- backgroundColor: backgroundColor[appearance][mode],
87
- borderColor: borderColor[appearance][mode],
88
- color: componentTokens.textColor[mode],
48
+ backgroundColor: backgroundColor[appearance],
49
+ borderColor: borderColor[appearance],
50
+ color: "var(--ds-text, ".concat(_colors.N900, ")"),
89
51
  cursor: 'text',
90
52
  '&:hover:not([data-disabled])': {
91
- backgroundColor: backgroundColorHover[appearance][mode],
92
- borderColor: borderColorHover[appearance][mode]
53
+ backgroundColor: backgroundColorHover[appearance],
54
+ borderColor: borderColorHover[appearance]
93
55
  },
94
56
  '&:focus-within:not([data-disabled])': {
95
- backgroundColor: backgroundColorFocus[appearance][mode],
96
- borderColor: borderColorFocus[appearance][mode],
97
- boxShadow: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", borderColorFocus[appearance][mode]) : undefined
57
+ backgroundColor: backgroundColorFocus[appearance],
58
+ borderColor: borderColorFocus[appearance],
59
+ boxShadow: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", borderColorFocus[appearance]) : undefined
98
60
  },
99
61
  '&[data-disabled]': _objectSpread({
100
- color: disabledRules[mode].textColor,
62
+ color: "var(--ds-text-disabled, ".concat(_colors.N70, ")"),
101
63
  cursor: 'not-allowed'
102
64
  }, appearance === 'standard' && {
103
- backgroundColor: disabledRules[mode].backgroundColor,
104
- borderColor: disabledRules[mode].borderColor
65
+ backgroundColor: "var(--ds-background-disabled, ".concat(_colors.N10, ")"),
66
+ borderColor: "var(--ds-background-disabled, ".concat(_colors.N10, ")")
105
67
  }),
106
68
  '&[data-invalid], &[data-invalid]:hover': {
107
- borderColor: invalidRules[mode].borderColor,
108
- boxShadow: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", invalidRules[mode].borderColor) : undefined
69
+ borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")"),
70
+ boxShadow: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", "var(--ds-border-danger, ".concat(_colors.R400, ")")) : undefined
109
71
  },
110
72
  '&[data-invalid]:focus-within': {
111
- backgroundColor: invalidRules[mode].backgroundColorFocus,
112
- borderColor: invalidRules[mode].borderColorFocus,
113
- boxShadow: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", invalidRules[mode].borderColorFocus) : undefined
73
+ backgroundColor: "var(--ds-background-input-pressed, ".concat(_colors.N0, ")"),
74
+ borderColor: "var(--ds-border-focused, ".concat(_colors.B200, ")"),
75
+ boxShadow: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", "var(--ds-border-focused, ".concat(_colors.B200, ")")) : undefined
114
76
  },
115
77
  '@media screen and (-ms-high-contrast: active)': {
116
78
  '&[data-invalid]:focus-within': {
@@ -135,10 +97,10 @@ var widthMap = {
135
97
  var getMaxWidth = function getMaxWidth(width) {
136
98
  return !width ? "100%" : width in widthMap ? widthMap[width] : +width;
137
99
  };
138
- var containerStyles = function containerStyles(appearance, mode, width) {
100
+ var containerStyles = exports.containerStyles = function containerStyles(appearance, width) {
139
101
  return _objectSpread(_objectSpread(_objectSpread({
140
102
  alignItems: 'center'
141
- }, getContainerTextBgAndBorderColor(appearance, mode)), {}, {
103
+ }, getContainerTextBgAndBorderColor(appearance)), {}, {
142
104
  borderRadius: 3,
143
105
  borderWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? "var(--ds-border-width, 1px)" : 2
144
106
  }, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') && appearance !== 'none' ? {
@@ -158,8 +120,7 @@ var containerStyles = function containerStyles(appearance, mode, width) {
158
120
  pointerEvents: 'auto'
159
121
  });
160
122
  };
161
- exports.containerStyles = containerStyles;
162
- var inputStyles = function inputStyles(mode) {
123
+ var inputStyles = exports.inputStyles = function inputStyles() {
163
124
  return {
164
125
  backgroundColor: 'transparent',
165
126
  border: 0,
@@ -187,7 +148,7 @@ var inputStyles = function inputStyles(mode) {
187
148
  // Safari (WebKit) adds a -webkit-text-fill-color style to disabled inputs
188
149
  // which takes priority over color and makes the text unreadable. Need to
189
150
  // override it with the color we want.
190
- WebkitTextFillColor: disabledRules[mode].textColor
151
+ WebkitTextFillColor: "var(--ds-text-disabled, ".concat(_colors.N70, ")")
191
152
  },
192
153
  // Hide the clear indicator on Edge (Windows only)
193
154
  '&::-ms-clear': {
@@ -200,9 +161,9 @@ var inputStyles = function inputStyles(mode) {
200
161
  textOverflow: 'ellipsis'
201
162
  },
202
163
  '&::placeholder': {
203
- color: componentTokens.placeholderTextColor[mode],
164
+ color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")"),
204
165
  '&:disabled': {
205
- color: disabledRules[mode].textColor
166
+ color: "var(--ds-text-disabled, ".concat(_colors.N70, ")")
206
167
  }
207
168
  },
208
169
  '@media screen and (-ms-high-contrast: active)': {
@@ -211,20 +172,4 @@ var inputStyles = function inputStyles(mode) {
211
172
  }
212
173
  }
213
174
  };
214
- };
215
-
216
- // TODO: Remove when removing legacy theming.
217
- exports.inputStyles = inputStyles;
218
- var textFieldColors = {
219
- backgroundColor: backgroundColor,
220
- backgroundColorFocus: backgroundColorFocus,
221
- backgroundColorHover: backgroundColorHover,
222
- borderColor: borderColor,
223
- borderColorFocus: borderColorFocus,
224
- borderColorHover: borderColorHover,
225
- placeholderTextColor: componentTokens.placeholderTextColor,
226
- textColor: componentTokens.textColor,
227
- invalidRules: invalidRules,
228
- disabledRules: disabledRules
229
- };
230
- exports.textFieldColors = textFieldColors;
175
+ };
@@ -13,7 +13,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _react2 = require("@emotion/react");
15
15
  var _analyticsNext = require("@atlaskit/analytics-next");
16
- var _components = require("@atlaskit/theme/components");
17
16
  var _styles = require("./styles");
18
17
  var _excluded = ["appearance", "className", "elemAfterInput", "elemBeforeInput", "isCompact", "isDisabled", "isInvalid", "isMonospaced", "isReadOnly", "isRequired", "name", "onBlur", "onChange", "onFocus", "onMouseDown", "placeholder", "testId", "width"];
19
18
  /** @jsx jsx */
@@ -24,7 +23,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
24
23
  var analyticsParams = {
25
24
  componentName: 'textField',
26
25
  packageName: "@atlaskit/textfield",
27
- packageVersion: "5.6.8"
26
+ packageVersion: "6.0.0"
28
27
  };
29
28
  var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
30
29
  var _props$appearance = props.appearance,
@@ -54,8 +53,6 @@ var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
54
53
  width = props.width,
55
54
  spreadProps = (0, _objectWithoutProperties2.default)(props, _excluded);
56
55
  var inputRef = (0, _react.useRef)(null);
57
- var _useGlobalTheme = (0, _components.useGlobalTheme)(),
58
- mode = _useGlobalTheme.mode;
59
56
  var handleOnFocus = (0, _analyticsNext.usePlatformLeafEventHandler)(_objectSpread({
60
57
  fn: function fn(event) {
61
58
  onFocus && onFocus(event);
@@ -93,11 +90,9 @@ var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
93
90
  }
94
91
  }, [ref]);
95
92
  var containerStyles = (0, _react.useMemo)(function () {
96
- return (0, _styles.containerStyles)(appearance, mode, width);
97
- }, [appearance, mode, width]);
98
- var inputStyle = (0, _react.useMemo)(function () {
99
- return (0, _styles.inputStyles)(mode);
100
- }, [mode]);
93
+ return (0, _styles.containerStyles)(appearance, width);
94
+ }, [appearance, width]);
95
+ var inputStyle = (0, _styles.inputStyles)();
101
96
  return (
102
97
  /**
103
98
  * It is not normally acceptable to add click and key handlers to
@@ -151,6 +146,5 @@ Textfield.displayName = 'Textfield';
151
146
  * - [Code](https://atlassian.design/components/textfield/code)
152
147
  * - [Usage](https://atlassian.design/components/textfield/usage)
153
148
  */
154
- var _default = /*#__PURE__*/(0, _react.memo)(Textfield); // The above generic is used to let ERTC know what props to extract.
155
- // See: https://github.com/atlassian/extract-react-types/issues/201
156
- exports.default = _default;
149
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(Textfield); // The above generic is used to let ERTC know what props to extract.
150
+ // See: https://github.com/atlassian/extract-react-types/issues/201
@@ -1,2 +1 @@
1
- export { default } from './text-field';
2
- export { textFieldColors as TextFieldColors } from './styles';
1
+ export { default } from './text-field';
@@ -1,107 +1,72 @@
1
1
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
- import { R400 } from '@atlaskit/theme/colors';
2
+ import { B200, N0, N10, N100, N200, N30, N40, N70, N900, R400 } from '@atlaskit/theme/colors';
3
3
  import { codeFontFamily, fontFamily, fontSize as getFontSize,
4
4
  // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
5
5
  gridSize as getGridSize } from '@atlaskit/theme/constants';
6
- import * as componentTokens from './component-tokens';
7
6
  const fontSize = getFontSize();
8
7
  const gridSize = getGridSize();
9
- const disabledRules = {
10
- light: {
11
- backgroundColor: componentTokens.disabledBackgroundColor.light,
12
- backgroundColorHover: componentTokens.disabledBackgroundColor.light,
13
- borderColor: componentTokens.disabledBackgroundColor.light,
14
- textColor: componentTokens.disabledTextColor.light
15
- },
16
- dark: {
17
- backgroundColor: componentTokens.disabledBackgroundColor.dark,
18
- backgroundColorHover: componentTokens.disabledBackgroundColor.dark,
19
- borderColor: componentTokens.disabledBackgroundColor.dark,
20
- textColor: componentTokens.disabledTextColor.dark
21
- }
22
- };
23
- const invalidRules = {
24
- light: {
25
- // ----
26
- backgroundColor: componentTokens.defaultBackgroundColor.light,
27
- backgroundColorHover: componentTokens.defaultBackgroundColorHover.light,
28
- // ^--- the above values aren't used directly they remain because its exposed by the `textFieldColors` export
29
- backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.light,
30
- borderColor: `var(--ds-border-danger, ${R400})`,
31
- borderColorFocus: componentTokens.defaultBorderColorFocus.light
32
- },
33
- dark: {
34
- // ----
35
- backgroundColor: componentTokens.defaultBackgroundColor.dark,
36
- backgroundColorHover: componentTokens.defaultBackgroundColorHover.dark,
37
- // ^--- the above values aren't used directly they remain because its exposed by the `textFieldColors` export
38
- backgroundColorFocus: componentTokens.defaultBackgroundColorFocus.dark,
39
- borderColor: `var(--ds-border-danger, ${R400})`,
40
- borderColorFocus: componentTokens.defaultBorderColorFocus.dark
41
- }
42
- };
43
8
  const backgroundColor = {
44
- standard: componentTokens.defaultBackgroundColor,
45
- subtle: componentTokens.transparent,
46
- none: componentTokens.transparent
9
+ standard: `var(--ds-background-input, ${N10})`,
10
+ subtle: 'transparent',
11
+ none: 'transparent'
47
12
  };
48
13
  const backgroundColorFocus = {
49
- standard: componentTokens.defaultBackgroundColorFocus,
50
- subtle: componentTokens.defaultBackgroundColorFocus,
51
- none: componentTokens.transparent
14
+ standard: `var(--ds-background-input-pressed, ${N0})`,
15
+ subtle: `var(--ds-background-input-pressed, ${N0})`,
16
+ none: 'transparent'
52
17
  };
53
18
  const backgroundColorHover = {
54
- standard: componentTokens.defaultBackgroundColorHover,
55
- subtle: componentTokens.defaultBackgroundColorHover,
56
- none: componentTokens.transparent
19
+ standard: `var(--ds-background-input-hovered, ${N30})`,
20
+ subtle: `var(--ds-background-input-hovered, ${N30})`,
21
+ none: 'transparent'
57
22
  };
58
23
  const borderColor = {
59
- standard: componentTokens.defaultBorderColor,
60
- subtle: componentTokens.transparent,
61
- none: componentTokens.transparent
24
+ standard: `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N40})`,
25
+ subtle: 'transparent',
26
+ none: 'transparent'
62
27
  };
63
28
  const borderColorFocus = {
64
- standard: componentTokens.defaultBorderColorFocus,
65
- subtle: componentTokens.defaultBorderColorFocus,
66
- none: componentTokens.transparent
29
+ standard: `var(--ds-border-focused, ${B200})`,
30
+ subtle: `var(--ds-border-focused, ${B200})`,
31
+ none: 'transparent'
67
32
  };
68
33
  const borderColorHover = {
69
- standard: componentTokens.defaultBorderColor,
70
- subtle: componentTokens.subtleBorderColorHover,
71
- none: componentTokens.transparent
34
+ standard: `var(--ds-border-input, ${getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? N100 : N40})`,
35
+ subtle: "var(--ds-border-input, transparent)",
36
+ none: 'transparent'
72
37
  };
73
- const getContainerTextBgAndBorderColor = (appearance, mode) => ({
74
- backgroundColor: backgroundColor[appearance][mode],
75
- borderColor: borderColor[appearance][mode],
76
- color: componentTokens.textColor[mode],
38
+ const getContainerTextBgAndBorderColor = appearance => ({
39
+ backgroundColor: backgroundColor[appearance],
40
+ borderColor: borderColor[appearance],
41
+ color: `var(--ds-text, ${N900})`,
77
42
  cursor: 'text',
78
43
  '&:hover:not([data-disabled])': {
79
- backgroundColor: backgroundColorHover[appearance][mode],
80
- borderColor: borderColorHover[appearance][mode]
44
+ backgroundColor: backgroundColorHover[appearance],
45
+ borderColor: borderColorHover[appearance]
81
46
  },
82
47
  '&:focus-within:not([data-disabled])': {
83
- backgroundColor: backgroundColorFocus[appearance][mode],
84
- borderColor: borderColorFocus[appearance][mode],
85
- boxShadow: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${borderColorFocus[appearance][mode]}` : undefined
48
+ backgroundColor: backgroundColorFocus[appearance],
49
+ borderColor: borderColorFocus[appearance],
50
+ boxShadow: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${borderColorFocus[appearance]}` : undefined
86
51
  },
87
52
  '&[data-disabled]': {
88
- color: disabledRules[mode].textColor,
53
+ color: `var(--ds-text-disabled, ${N70})`,
89
54
  cursor: 'not-allowed',
90
55
  // Disabled background and border styles should not be applied to components that
91
56
  // have either no background or transparent background to begin with
92
57
  ...(appearance === 'standard' && {
93
- backgroundColor: disabledRules[mode].backgroundColor,
94
- borderColor: disabledRules[mode].borderColor
58
+ backgroundColor: `var(--ds-background-disabled, ${N10})`,
59
+ borderColor: `var(--ds-background-disabled, ${N10})`
95
60
  })
96
61
  },
97
62
  '&[data-invalid], &[data-invalid]:hover': {
98
- borderColor: invalidRules[mode].borderColor,
99
- boxShadow: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${invalidRules[mode].borderColor}` : undefined
63
+ borderColor: `var(--ds-border-danger, ${R400})`,
64
+ boxShadow: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${`var(--ds-border-danger, ${R400})`}` : undefined
100
65
  },
101
66
  '&[data-invalid]:focus-within': {
102
- backgroundColor: invalidRules[mode].backgroundColorFocus,
103
- borderColor: invalidRules[mode].borderColorFocus,
104
- boxShadow: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${invalidRules[mode].borderColorFocus}` : undefined
67
+ backgroundColor: `var(--ds-background-input-pressed, ${N0})`,
68
+ borderColor: `var(--ds-border-focused, ${B200})`,
69
+ boxShadow: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${`var(--ds-border-focused, ${B200})`}` : undefined
105
70
  },
106
71
  '@media screen and (-ms-high-contrast: active)': {
107
72
  '&[data-invalid]:focus-within': {
@@ -123,9 +88,9 @@ const widthMap = {
123
88
  xlarge: 480
124
89
  };
125
90
  const getMaxWidth = width => !width ? `100%` : width in widthMap ? widthMap[width] : +width;
126
- export const containerStyles = (appearance, mode, width) => ({
91
+ export const containerStyles = (appearance, width) => ({
127
92
  alignItems: 'center',
128
- ...getContainerTextBgAndBorderColor(appearance, mode),
93
+ ...getContainerTextBgAndBorderColor(appearance),
129
94
  borderRadius: 3,
130
95
  borderWidth: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? "var(--ds-border-width, 1px)" : 2,
131
96
  // add 1px padding on both top and bottom to keep the same overall height after border reduced from 2px to 1px under feature flag
@@ -145,7 +110,7 @@ export const containerStyles = (appearance, mode, width) => ({
145
110
  verticalAlign: 'top',
146
111
  pointerEvents: 'auto'
147
112
  });
148
- export const inputStyles = mode => ({
113
+ export const inputStyles = () => ({
149
114
  backgroundColor: 'transparent',
150
115
  border: 0,
151
116
  boxSizing: 'border-box',
@@ -172,7 +137,7 @@ export const inputStyles = mode => ({
172
137
  // Safari (WebKit) adds a -webkit-text-fill-color style to disabled inputs
173
138
  // which takes priority over color and makes the text unreadable. Need to
174
139
  // override it with the color we want.
175
- WebkitTextFillColor: disabledRules[mode].textColor
140
+ WebkitTextFillColor: `var(--ds-text-disabled, ${N70})`
176
141
  },
177
142
  // Hide the clear indicator on Edge (Windows only)
178
143
  '&::-ms-clear': {
@@ -185,9 +150,9 @@ export const inputStyles = mode => ({
185
150
  textOverflow: 'ellipsis'
186
151
  },
187
152
  '&::placeholder': {
188
- color: componentTokens.placeholderTextColor[mode],
153
+ color: `var(--ds-text-subtlest, ${N200})`,
189
154
  '&:disabled': {
190
- color: disabledRules[mode].textColor
155
+ color: `var(--ds-text-disabled, ${N70})`
191
156
  }
192
157
  },
193
158
  '@media screen and (-ms-high-contrast: active)': {
@@ -195,18 +160,4 @@ export const inputStyles = mode => ({
195
160
  color: 'GrayText'
196
161
  }
197
162
  }
198
- });
199
-
200
- // TODO: Remove when removing legacy theming.
201
- export const textFieldColors = {
202
- backgroundColor,
203
- backgroundColorFocus,
204
- backgroundColorHover,
205
- borderColor,
206
- borderColorFocus,
207
- borderColorHover,
208
- placeholderTextColor: componentTokens.placeholderTextColor,
209
- textColor: componentTokens.textColor,
210
- invalidRules,
211
- disabledRules
212
- };
163
+ });
@@ -3,12 +3,11 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import React, { forwardRef, memo, useCallback, useMemo, useRef } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
5
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
6
- import { useGlobalTheme } from '@atlaskit/theme/components';
7
6
  import { containerStyles as getContainerStyles, inputStyles as getInputStyles } from './styles';
8
7
  const analyticsParams = {
9
8
  componentName: 'textField',
10
9
  packageName: "@atlaskit/textfield",
11
- packageVersion: "5.6.8"
10
+ packageVersion: "6.0.0"
12
11
  };
13
12
  const Textfield = /*#__PURE__*/forwardRef((props, ref) => {
14
13
  const {
@@ -33,9 +32,6 @@ const Textfield = /*#__PURE__*/forwardRef((props, ref) => {
33
32
  ...spreadProps
34
33
  } = props;
35
34
  const inputRef = useRef(null);
36
- const {
37
- mode
38
- } = useGlobalTheme();
39
35
  const handleOnFocus = usePlatformLeafEventHandler({
40
36
  fn: event => {
41
37
  onFocus && onFocus(event);
@@ -74,8 +70,8 @@ const Textfield = /*#__PURE__*/forwardRef((props, ref) => {
74
70
  ref(inputElement);
75
71
  }
76
72
  }, [ref]);
77
- const containerStyles = useMemo(() => getContainerStyles(appearance, mode, width), [appearance, mode, width]);
78
- const inputStyle = useMemo(() => getInputStyles(mode), [mode]);
73
+ const containerStyles = useMemo(() => getContainerStyles(appearance, width), [appearance, width]);
74
+ const inputStyle = getInputStyles();
79
75
  return (
80
76
  /**
81
77
  * It is not normally acceptable to add click and key handlers to
package/dist/esm/index.js CHANGED
@@ -1,2 +1 @@
1
- export { default } from './text-field';
2
- export { textFieldColors as TextFieldColors } from './styles';
1
+ export { default } from './text-field';