@atlaskit/textfield 5.5.2 → 5.6.1

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,19 @@
1
1
  # @atlaskit/textfield
2
2
 
3
+ ## 5.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3a8d6f61240`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3a8d6f61240) - [ux] Adds `text-overflow: ellipsis` to placeholder text.
8
+
9
+ ## 5.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`a90730ddb33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a90730ddb33) - Disallow use of unused prop `disabled`. Disabled textfields should use
14
+ `isDisabled`. This change includes a codemod for transitioning existing code
15
+ over to the proper usage.
16
+
3
17
  ## 5.5.2
4
18
 
5
19
  ### Patch Changes
@@ -0,0 +1,7 @@
1
+ import { createTransformer } from '@atlaskit/codemod-utils';
2
+
3
+ import { renameDisabledToIsDisabled } from './migrations/rename-disabled-to-isdisabled';
4
+
5
+ const transformer = createTransformer([renameDisabledToIsDisabled]);
6
+
7
+ export default transformer;
@@ -0,0 +1,143 @@
1
+ jest.autoMockOff();
2
+
3
+ import { createTransformer } from '@atlaskit/codemod-utils';
4
+
5
+ import { renameDisabledToIsDisabled } from '../migrations/rename-disabled-to-isdisabled';
6
+
7
+ const transformer = createTransformer([renameDisabledToIsDisabled]);
8
+
9
+ const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
10
+
11
+ describe('Rename `disabled` prop to `isDisabled`', () => {
12
+ defineInlineTest(
13
+ { default: transformer, parser: 'tsx' },
14
+ {},
15
+ `
16
+ import React from 'react';
17
+ import Textfield from '@atlaskit/textfield';
18
+
19
+ const SimpleTextfield = () => {
20
+ return <Textfield disabled />;
21
+ }
22
+ `,
23
+ `
24
+ import React from 'react';
25
+ import Textfield from '@atlaskit/textfield';
26
+
27
+ const SimpleTextfield = () => {
28
+ return <Textfield isDisabled />;
29
+ }
30
+ `,
31
+ 'should rename single line disabled to isDisabled',
32
+ );
33
+
34
+ defineInlineTest(
35
+ { default: transformer, parser: 'tsx' },
36
+ {},
37
+ `
38
+ import React from 'react';
39
+ import Textfield from '@atlaskit/textfield';
40
+
41
+ const SimpleTextfield = () => {
42
+ return (
43
+ <Textfield
44
+ name="basic"
45
+ aria-label="default text field"
46
+ disabled
47
+ />
48
+ );
49
+ }
50
+ `,
51
+ `
52
+ import React from 'react';
53
+ import Textfield from '@atlaskit/textfield';
54
+
55
+ const SimpleTextfield = () => {
56
+ return (
57
+ <Textfield
58
+ name="basic"
59
+ aria-label="default text field"
60
+ isDisabled
61
+ />
62
+ );
63
+ }
64
+ `,
65
+ 'should rename multiline disabled to isDisabled',
66
+ );
67
+
68
+ defineInlineTest(
69
+ { default: transformer, parser: 'tsx' },
70
+ {},
71
+ `
72
+ import React from 'react';
73
+ import Textfield from '@atlaskit/textfield';
74
+
75
+ const SimpleTextfield = () => {
76
+ const disabled = true;
77
+
78
+ return (
79
+ <Textfield
80
+ name="basic"
81
+ aria-label="default text field"
82
+ disabled={disabled}
83
+ />
84
+ );
85
+ }
86
+ `,
87
+ `
88
+ import React from 'react';
89
+ import Textfield from '@atlaskit/textfield';
90
+
91
+ const SimpleTextfield = () => {
92
+ const disabled = true;
93
+
94
+ return (
95
+ <Textfield
96
+ name="basic"
97
+ aria-label="default text field"
98
+ isDisabled={disabled}
99
+ />
100
+ );
101
+ }
102
+ `,
103
+ 'should rename disabled to isDisabled with indirection',
104
+ );
105
+
106
+ defineInlineTest(
107
+ { default: transformer, parser: 'tsx' },
108
+ {},
109
+ `
110
+ import React from 'react';
111
+ import AkTextfield from '@atlaskit/textfield';
112
+
113
+ const SimpleTextfield = () => {
114
+ const disabled = true;
115
+
116
+ return (
117
+ <AkTextfield
118
+ name="basic"
119
+ aria-label="default text field"
120
+ disabled={disabled}
121
+ />
122
+ );
123
+ }
124
+ `,
125
+ `
126
+ import React from 'react';
127
+ import AkTextfield from '@atlaskit/textfield';
128
+
129
+ const SimpleTextfield = () => {
130
+ const disabled = true;
131
+
132
+ return (
133
+ <AkTextfield
134
+ name="basic"
135
+ aria-label="default text field"
136
+ isDisabled={disabled}
137
+ />
138
+ );
139
+ }
140
+ `,
141
+ 'should rename disabled to isDisabled with indirection and different default import',
142
+ );
143
+ });
@@ -0,0 +1,11 @@
1
+ import { createRenameFuncFor } from '@atlaskit/codemod-utils';
2
+
3
+ const component = '@atlaskit/textfield';
4
+ const from = 'disabled';
5
+ const to = 'isDisabled';
6
+
7
+ export const renameDisabledToIsDisabled = createRenameFuncFor(
8
+ component,
9
+ from,
10
+ to,
11
+ );
@@ -142,7 +142,7 @@ var containerStyles = function containerStyles(appearance, mode, width) {
142
142
  borderRadius: 3,
143
143
  borderWidth: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') ? 1 : 2
144
144
  }, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.border-checkbox_nyoiu') && appearance !== 'none' ?
145
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
145
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
146
146
  {
147
147
  padding: '1px 0'
148
148
  } : {}), {}, {
@@ -198,6 +198,9 @@ var inputStyles = function inputStyles(mode) {
198
198
  '&:invalid': {
199
199
  boxShadow: 'none'
200
200
  },
201
+ '&:placeholder-shown': {
202
+ textOverflow: 'ellipsis'
203
+ },
201
204
  '&::placeholder': {
202
205
  color: componentTokens.placeholderTextColor[mode],
203
206
  '&:disabled': {
@@ -24,7 +24,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
24
24
  var analyticsParams = {
25
25
  componentName: 'textField',
26
26
  packageName: "@atlaskit/textfield",
27
- packageVersion: "5.5.2"
27
+ packageVersion: "5.6.1"
28
28
  };
29
29
  var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
30
30
  var _props$appearance = props.appearance,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.5.2",
3
+ "version": "5.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -130,7 +130,7 @@ export const containerStyles = (appearance, mode, width) => ({
130
130
  borderWidth: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? 1 : 2,
131
131
  // add 1px padding on both top and bottom to keep the same overall height after border reduced from 2px to 1px under feature flag
132
132
  ...(getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') && appearance !== 'none' ?
133
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
133
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
134
134
  {
135
135
  padding: '1px 0'
136
136
  } : {}),
@@ -183,6 +183,9 @@ export const inputStyles = mode => ({
183
183
  '&:invalid': {
184
184
  boxShadow: 'none'
185
185
  },
186
+ '&:placeholder-shown': {
187
+ textOverflow: 'ellipsis'
188
+ },
186
189
  '&::placeholder': {
187
190
  color: componentTokens.placeholderTextColor[mode],
188
191
  '&:disabled': {
@@ -8,7 +8,7 @@ import { containerStyles as getContainerStyles, inputStyles as getInputStyles }
8
8
  const analyticsParams = {
9
9
  componentName: 'textField',
10
10
  packageName: "@atlaskit/textfield",
11
- packageVersion: "5.5.2"
11
+ packageVersion: "5.6.1"
12
12
  };
13
13
  const Textfield = /*#__PURE__*/forwardRef((props, ref) => {
14
14
  const {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.5.2",
3
+ "version": "5.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -134,7 +134,7 @@ export var containerStyles = function containerStyles(appearance, mode, width) {
134
134
  borderRadius: 3,
135
135
  borderWidth: getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') ? 1 : 2
136
136
  }, getBooleanFF('platform.design-system-team.border-checkbox_nyoiu') && appearance !== 'none' ?
137
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
137
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
138
138
  {
139
139
  padding: '1px 0'
140
140
  } : {}), {}, {
@@ -189,6 +189,9 @@ export var inputStyles = function inputStyles(mode) {
189
189
  '&:invalid': {
190
190
  boxShadow: 'none'
191
191
  },
192
+ '&:placeholder-shown': {
193
+ textOverflow: 'ellipsis'
194
+ },
192
195
  '&::placeholder': {
193
196
  color: componentTokens.placeholderTextColor[mode],
194
197
  '&:disabled': {
@@ -14,7 +14,7 @@ import { containerStyles as getContainerStyles, inputStyles as getInputStyles }
14
14
  var analyticsParams = {
15
15
  componentName: 'textField',
16
16
  packageName: "@atlaskit/textfield",
17
- packageVersion: "5.5.2"
17
+ packageVersion: "5.6.1"
18
18
  };
19
19
  var Textfield = /*#__PURE__*/forwardRef(function (props, ref) {
20
20
  var _props$appearance = props.appearance,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.5.2",
3
+ "version": "5.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -89,6 +89,9 @@ export declare const inputStyles: (mode: ThemeModes) => {
89
89
  readonly '&:invalid': {
90
90
  readonly boxShadow: "none";
91
91
  };
92
+ readonly '&:placeholder-shown': {
93
+ readonly textOverflow: "ellipsis";
94
+ };
92
95
  readonly '&::placeholder': {
93
96
  readonly color: "var(--ds-text-subtlest)";
94
97
  readonly '&:disabled': {
@@ -1,5 +1,5 @@
1
1
  import React, { AllHTMLAttributes, FormEventHandler } from 'react';
2
- export interface TextfieldProps extends AllHTMLAttributes<HTMLInputElement> {
2
+ export interface TextfieldProps extends Omit<AllHTMLAttributes<HTMLInputElement>, 'disabled'> {
3
3
  /**
4
4
  * Affects the visual style of the text field.
5
5
  */
@@ -89,6 +89,9 @@ export declare const inputStyles: (mode: ThemeModes) => {
89
89
  readonly '&:invalid': {
90
90
  readonly boxShadow: "none";
91
91
  };
92
+ readonly '&:placeholder-shown': {
93
+ readonly textOverflow: "ellipsis";
94
+ };
92
95
  readonly '&::placeholder': {
93
96
  readonly color: "var(--ds-text-subtlest)";
94
97
  readonly '&:disabled': {
@@ -1,5 +1,5 @@
1
1
  import React, { AllHTMLAttributes, FormEventHandler } from 'react';
2
- export interface TextfieldProps extends AllHTMLAttributes<HTMLInputElement> {
2
+ export interface TextfieldProps extends Omit<AllHTMLAttributes<HTMLInputElement>, 'disabled'> {
3
3
  /**
4
4
  * Affects the visual style of the text field.
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.5.2",
3
+ "version": "5.6.1",
4
4
  "description": "A text field is an input that allows a user to write or edit text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/analytics-next": "^9.1.0",
38
38
  "@atlaskit/platform-feature-flags": "^0.2.0",
39
39
  "@atlaskit/theme": "^12.5.0",
40
- "@atlaskit/tokens": "^1.8.0",
40
+ "@atlaskit/tokens": "^1.11.0",
41
41
  "@babel/runtime": "^7.0.0",
42
42
  "@emotion/react": "^11.7.1"
43
43
  },
@@ -45,15 +45,9 @@
45
45
  "react": "^16.8.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@atlaskit/avatar": "^21.3.0",
49
- "@atlaskit/button": "^16.7.0",
50
- "@atlaskit/docs": "*",
48
+ "@atlaskit/codemod-utils": "^4.2.3",
51
49
  "@atlaskit/ds-lib": "^2.2.0",
52
- "@atlaskit/form": "^8.11.0",
53
- "@atlaskit/icon": "^21.12.0",
54
- "@atlaskit/section-message": "^6.4.0",
55
50
  "@atlaskit/ssr": "*",
56
- "@atlaskit/toggle": "^12.6.0",
57
51
  "@atlaskit/visual-regression": "*",
58
52
  "@atlaskit/webdriver-runner": "*",
59
53
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
package/report.api.md CHANGED
@@ -155,7 +155,8 @@ export const TextFieldColors: {
155
155
  };
156
156
 
157
157
  // @public (undocumented)
158
- export interface TextFieldProps extends AllHTMLAttributes<HTMLInputElement> {
158
+ export interface TextFieldProps
159
+ extends Omit<AllHTMLAttributes<HTMLInputElement>, 'disabled'> {
159
160
  appearance?: Appearance;
160
161
  className?: string;
161
162
  elemAfterInput?: React_2.ReactNode;
@@ -142,7 +142,7 @@ export const TextFieldColors: {
142
142
  };
143
143
 
144
144
  // @public (undocumented)
145
- export interface TextFieldProps extends AllHTMLAttributes<HTMLInputElement> {
145
+ export interface TextFieldProps extends Omit<AllHTMLAttributes<HTMLInputElement>, 'disabled'> {
146
146
  appearance?: Appearance;
147
147
  className?: string;
148
148
  elemAfterInput?: React_2.ReactNode;