@atlaskit/textfield 5.1.13 → 5.2.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,21 @@
1
1
  # @atlaskit/textfield
2
2
 
3
+ ## 5.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 5.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`acf974e717c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/acf974e717c) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 5.1.13
4
20
 
5
21
  ### Patch Changes
@@ -19,7 +19,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
- var _core = require("@emotion/core");
22
+ var _react2 = require("@emotion/react");
23
23
 
24
24
  var _analyticsNext = require("@atlaskit/analytics-next");
25
25
 
@@ -40,7 +40,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
40
40
  var analyticsParams = {
41
41
  componentName: 'textField',
42
42
  packageName: "@atlaskit/textfield",
43
- packageVersion: "5.1.13"
43
+ packageVersion: "5.2.1"
44
44
  };
45
45
  var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
46
46
  var _props$appearance = props.appearance,
@@ -125,7 +125,7 @@ var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
125
125
  }, [mode]);
126
126
  return (// We use event bubbling here to listen to any child element mouse down event.
127
127
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
128
- (0, _core.jsx)("div", {
128
+ (0, _react2.jsx)("div", {
129
129
  "data-disabled": isDisabled ? isDisabled : undefined,
130
130
  "data-invalid": isInvalid ? isInvalid : undefined,
131
131
  "data-ds--text-field--container": true,
@@ -135,7 +135,7 @@ var Textfield = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
135
135
  ,
136
136
  css: containerStyles,
137
137
  className: className
138
- }, elemBeforeInput, (0, _core.jsx)("input", (0, _extends2.default)({}, spreadProps, {
138
+ }, elemBeforeInput, (0, _react2.jsx)("input", (0, _extends2.default)({}, spreadProps, {
139
139
  "data-compact": isCompact ? isCompact : undefined,
140
140
  "data-monospaced": isMonospaced ? isMonospaced : undefined,
141
141
  "data-ds--text-field--input": true,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.1.13",
3
+ "version": "5.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,14 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import React, { forwardRef, memo, useCallback, useMemo, useRef } from 'react';
5
- import { jsx } from '@emotion/core';
5
+ import { jsx } from '@emotion/react';
6
6
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
7
7
  import { useGlobalTheme } from '@atlaskit/theme/components';
8
8
  import { containerStyles as getContainerStyles, inputStyles as getInputStyles } from './styles';
9
9
  const analyticsParams = {
10
10
  componentName: 'textField',
11
11
  packageName: "@atlaskit/textfield",
12
- packageVersion: "5.1.13"
12
+ packageVersion: "5.2.1"
13
13
  };
14
14
  const Textfield = /*#__PURE__*/forwardRef((props, ref) => {
15
15
  const {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.1.13",
3
+ "version": "5.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -10,14 +10,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
10
10
 
11
11
  /** @jsx jsx */
12
12
  import React, { forwardRef, memo, useCallback, useMemo, useRef } from 'react';
13
- import { jsx } from '@emotion/core';
13
+ import { jsx } from '@emotion/react';
14
14
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
15
15
  import { useGlobalTheme } from '@atlaskit/theme/components';
16
16
  import { containerStyles as getContainerStyles, inputStyles as getInputStyles } from './styles';
17
17
  var analyticsParams = {
18
18
  componentName: 'textField',
19
19
  packageName: "@atlaskit/textfield",
20
- packageVersion: "5.1.13"
20
+ packageVersion: "5.2.1"
21
21
  };
22
22
  var Textfield = /*#__PURE__*/forwardRef(function (props, ref) {
23
23
  var _props$appearance = props.appearance,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.1.13",
3
+ "version": "5.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,44 @@
1
+ export declare const disabledBackgroundColor: {
2
+ light: "var(--ds-background-disabled)";
3
+ dark: "var(--ds-background-disabled)";
4
+ };
5
+ export declare const defaultBackgroundColor: {
6
+ light: "var(--ds-background-input)";
7
+ dark: "var(--ds-background-input)";
8
+ };
9
+ export declare const defaultBackgroundColorFocus: {
10
+ light: "var(--ds-background-input-pressed)";
11
+ dark: "var(--ds-background-input-pressed)";
12
+ };
13
+ export declare const defaultBackgroundColorHover: {
14
+ light: "var(--ds-background-input-hovered)";
15
+ dark: "var(--ds-background-input-hovered)";
16
+ };
17
+ export declare const subtleBackgroundColorHover: {
18
+ light: "var(--ds-background-neutral-subtle-hovered)";
19
+ dark: "var(--ds-background-neutral-subtle-hovered)";
20
+ };
21
+ export declare const defaultBorderColor: {
22
+ light: "var(--ds-border)";
23
+ dark: "var(--ds-border)";
24
+ };
25
+ export declare const defaultBorderColorFocus: {
26
+ light: "var(--ds-border-focused)";
27
+ dark: "var(--ds-border-focused)";
28
+ };
29
+ export declare const transparent: {
30
+ light: string;
31
+ dark: string;
32
+ };
33
+ export declare const textColor: {
34
+ light: "var(--ds-text)";
35
+ dark: "var(--ds-text)";
36
+ };
37
+ export declare const disabledTextColor: {
38
+ light: "var(--ds-text-disabled)";
39
+ dark: "var(--ds-text-disabled)";
40
+ };
41
+ export declare const placeholderTextColor: {
42
+ light: "var(--ds-text-subtlest)";
43
+ dark: "var(--ds-text-subtlest)";
44
+ };
@@ -0,0 +1,3 @@
1
+ export { default } from './text-field';
2
+ export { textFieldColors as TextFieldColors } from './styles';
3
+ export type { TextfieldProps as TextFieldProps, Appearance } from './types';
@@ -0,0 +1,208 @@
1
+ import { ThemeModes } from '@atlaskit/theme/types';
2
+ import { Appearance } from './types';
3
+ export declare const containerStyles: (appearance: Appearance, mode: ThemeModes, width?: string | number | undefined) => {
4
+ readonly borderRadius: 3;
5
+ readonly borderWidth: 2;
6
+ readonly borderStyle: "none" | "solid";
7
+ readonly boxSizing: "border-box";
8
+ readonly display: "flex";
9
+ readonly flex: "1 1 100%";
10
+ readonly fontSize: number;
11
+ readonly justifyContent: "space-between";
12
+ readonly maxWidth: string | number;
13
+ readonly overflow: "hidden";
14
+ readonly transition: "background-color 0.2s ease-in-out, border-color 0.2s ease-in-out";
15
+ readonly wordWrap: "break-word";
16
+ readonly verticalAlign: "top";
17
+ readonly pointerEvents: "auto";
18
+ readonly backgroundColor: string;
19
+ readonly borderColor: string;
20
+ readonly color: "var(--ds-text)";
21
+ readonly cursor: string;
22
+ readonly '&:hover': {
23
+ backgroundColor: string;
24
+ };
25
+ readonly '&:focus-within': {
26
+ backgroundColor: string;
27
+ borderColor: string;
28
+ };
29
+ readonly '&[data-disabled]': {
30
+ backgroundColor: "var(--ds-background-disabled)";
31
+ borderColor: "var(--ds-background-disabled)";
32
+ color: "var(--ds-text-disabled)";
33
+ cursor: string;
34
+ };
35
+ readonly '&[data-invalid]': {
36
+ borderColor: "var(--ds-border-danger)";
37
+ };
38
+ readonly '&[data-invalid]:focus-within': {
39
+ backgroundColor: "var(--ds-background-input-pressed)";
40
+ borderColor: "var(--ds-border-focused)";
41
+ };
42
+ readonly '@media screen and (-ms-high-contrast: active)': {
43
+ '&[data-invalid]:focus-within': {
44
+ borderColor: string;
45
+ };
46
+ '&:focus-within': {
47
+ borderColor: string;
48
+ };
49
+ '&[data-disabled]': {
50
+ borderColor: string;
51
+ };
52
+ };
53
+ readonly alignItems: "center";
54
+ };
55
+ export declare const inputStyles: (mode: ThemeModes) => {
56
+ readonly backgroundColor: "transparent";
57
+ readonly border: 0;
58
+ readonly boxSizing: "border-box";
59
+ readonly color: "inherit";
60
+ readonly cursor: "inherit";
61
+ readonly fontSize: number;
62
+ readonly minWidth: "0";
63
+ readonly outline: "none";
64
+ readonly width: "100%";
65
+ readonly lineHeight: number;
66
+ readonly fontFamily: string;
67
+ readonly '&[data-monospaced]': {
68
+ readonly fontFamily: string;
69
+ };
70
+ readonly '&[data-compact]': {
71
+ readonly padding: `${number}px ${number}px`;
72
+ readonly height: `${string}em`;
73
+ };
74
+ readonly '&:not([data-compact])': {
75
+ readonly padding: `${number}px ${number}px`;
76
+ readonly height: `${string}em`;
77
+ };
78
+ readonly '&[disabled]': {
79
+ readonly WebkitTextFillColor: "var(--ds-text-disabled)";
80
+ };
81
+ readonly '&::-ms-clear': {
82
+ readonly display: "none";
83
+ };
84
+ readonly '&:invalid': {
85
+ readonly boxShadow: "none";
86
+ };
87
+ readonly '&::placeholder': {
88
+ readonly color: "var(--ds-text-subtlest)";
89
+ readonly '&:disabled': {
90
+ readonly color: "var(--ds-text-disabled)";
91
+ };
92
+ };
93
+ readonly '@media screen and (-ms-high-contrast: active)': {
94
+ readonly '&[disabled]': {
95
+ readonly color: "GrayText";
96
+ };
97
+ };
98
+ };
99
+ export declare const textFieldColors: {
100
+ backgroundColor: {
101
+ standard: {
102
+ light: "var(--ds-background-input)";
103
+ dark: "var(--ds-background-input)";
104
+ };
105
+ subtle: {
106
+ light: string;
107
+ dark: string;
108
+ };
109
+ none: {
110
+ light: string;
111
+ dark: string;
112
+ };
113
+ };
114
+ backgroundColorFocus: {
115
+ standard: {
116
+ light: "var(--ds-background-input-pressed)";
117
+ dark: "var(--ds-background-input-pressed)";
118
+ };
119
+ subtle: {
120
+ light: "var(--ds-background-input-pressed)";
121
+ dark: "var(--ds-background-input-pressed)";
122
+ };
123
+ none: {
124
+ light: string;
125
+ dark: string;
126
+ };
127
+ };
128
+ backgroundColorHover: {
129
+ standard: {
130
+ light: "var(--ds-background-input-hovered)";
131
+ dark: "var(--ds-background-input-hovered)";
132
+ };
133
+ subtle: {
134
+ light: "var(--ds-background-neutral-subtle-hovered)";
135
+ dark: "var(--ds-background-neutral-subtle-hovered)";
136
+ };
137
+ none: {
138
+ light: string;
139
+ dark: string;
140
+ };
141
+ };
142
+ borderColor: {
143
+ standard: {
144
+ light: "var(--ds-border)";
145
+ dark: "var(--ds-border)";
146
+ };
147
+ subtle: {
148
+ light: string;
149
+ dark: string;
150
+ };
151
+ none: {
152
+ light: string;
153
+ dark: string;
154
+ };
155
+ };
156
+ borderColorFocus: {
157
+ standard: {
158
+ light: "var(--ds-border-focused)";
159
+ dark: "var(--ds-border-focused)";
160
+ };
161
+ subtle: {
162
+ light: "var(--ds-border-focused)";
163
+ dark: "var(--ds-border-focused)";
164
+ };
165
+ none: {
166
+ light: string;
167
+ dark: string;
168
+ };
169
+ };
170
+ placeholderTextColor: {
171
+ light: "var(--ds-text-subtlest)";
172
+ dark: "var(--ds-text-subtlest)";
173
+ };
174
+ textColor: {
175
+ light: "var(--ds-text)";
176
+ dark: "var(--ds-text)";
177
+ };
178
+ invalidRules: {
179
+ light: {
180
+ backgroundColor: "var(--ds-background-input)";
181
+ backgroundColorHover: "var(--ds-background-input-hovered)";
182
+ backgroundColorFocus: "var(--ds-background-input-pressed)";
183
+ borderColor: "var(--ds-border-danger)";
184
+ borderColorFocus: "var(--ds-border-focused)";
185
+ };
186
+ dark: {
187
+ backgroundColor: "var(--ds-background-input)";
188
+ backgroundColorHover: "var(--ds-background-input-hovered)";
189
+ backgroundColorFocus: "var(--ds-background-input-pressed)";
190
+ borderColor: "var(--ds-border-danger)";
191
+ borderColorFocus: "var(--ds-border-focused)";
192
+ };
193
+ };
194
+ disabledRules: {
195
+ light: {
196
+ backgroundColor: "var(--ds-background-disabled)";
197
+ backgroundColorHover: "var(--ds-background-disabled)";
198
+ borderColor: "var(--ds-background-disabled)";
199
+ textColor: "var(--ds-text-disabled)";
200
+ };
201
+ dark: {
202
+ backgroundColor: "var(--ds-background-disabled)";
203
+ backgroundColorHover: "var(--ds-background-disabled)";
204
+ borderColor: "var(--ds-background-disabled)";
205
+ textColor: "var(--ds-text-disabled)";
206
+ };
207
+ };
208
+ };
@@ -0,0 +1,14 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { TextfieldProps } from './types';
4
+ declare const _default: React.NamedExoticComponent<TextfieldProps & React.RefAttributes<unknown>>;
5
+ /**
6
+ * __Textfield__
7
+ *
8
+ * A text field is an input that allows a user to write or edit text.
9
+ *
10
+ * - [Examples](https://atlassian.design/components/textfield/examples)
11
+ * - [Code](https://atlassian.design/components/textfield/code)
12
+ * - [Usage](https://atlassian.design/components/textfield/usage)
13
+ */
14
+ export default _default;
@@ -0,0 +1,71 @@
1
+ import React, { AllHTMLAttributes, FormEventHandler } from 'react';
2
+ export interface TextfieldProps extends AllHTMLAttributes<HTMLInputElement> {
3
+ /**
4
+ * Affects the visual style of the text field.
5
+ */
6
+ appearance?: 'standard' | 'none' | 'subtle';
7
+ /**
8
+ * Applies compact styling, making the field smaller.
9
+ */
10
+ isCompact?: boolean;
11
+ /**
12
+ * Sets the field as to appear disabled,
13
+ * users will not be able to interact with the text field.
14
+ */
15
+ isDisabled?: boolean;
16
+ /**
17
+ * Changes the text field to have a border indicating that its value is invalid.
18
+ */
19
+ isInvalid?: boolean;
20
+ /**
21
+ * Sets content text value to appear monospaced.
22
+ */
23
+ isMonospaced?: boolean;
24
+ /**
25
+ * If true, prevents the value of the input from being edited.
26
+ */
27
+ isReadOnly?: boolean;
28
+ /**
29
+ * Set required for form that the field is part of.
30
+ */
31
+ isRequired?: boolean;
32
+ /**
33
+ * Element after input in text field.
34
+ */
35
+ elemAfterInput?: React.ReactNode;
36
+ /**
37
+ * Element before input in text field.
38
+ */
39
+ elemBeforeInput?: React.ReactNode;
40
+ /**
41
+ * Sets maximum width of input.
42
+ */
43
+ width?: string | number;
44
+ /**
45
+ * Handler called when the mouse down event is triggered on the input element.
46
+ */
47
+ onMouseDown?: React.MouseEventHandler<HTMLElement>;
48
+ /**
49
+ * A `testId` prop is provided for specified elements, which is a unique
50
+ * string that appears as a data attribute `data-testid` in the rendered code,
51
+ * serving as a hook for automated tests.
52
+ */
53
+ testId?: string;
54
+ /**
55
+ * Name of the input element.
56
+ */
57
+ name?: string;
58
+ /**
59
+ * Class name to apply to the input element.
60
+ */
61
+ className?: string;
62
+ /**
63
+ * Placeholder text to display in the text field whenever it is empty.
64
+ */
65
+ placeholder?: string;
66
+ /**
67
+ * Handler called when the inputs value changes.
68
+ */
69
+ onChange?: FormEventHandler<HTMLInputElement>;
70
+ }
71
+ export declare type Appearance = 'subtle' | 'standard' | 'none';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/textfield",
3
- "version": "5.1.13",
3
+ "version": "5.2.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/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "atlassian": {
@@ -27,10 +34,10 @@
27
34
  },
28
35
  "dependencies": {
29
36
  "@atlaskit/analytics-next": "^8.2.0",
30
- "@atlaskit/theme": "^12.1.0",
37
+ "@atlaskit/theme": "^12.2.0",
31
38
  "@atlaskit/tokens": "^0.10.0",
32
39
  "@babel/runtime": "^7.0.0",
33
- "@emotion/core": "^10.0.9"
40
+ "@emotion/react": "^11.7.1"
34
41
  },
35
42
  "peerDependencies": {
36
43
  "react": "^16.8.0"
@@ -39,20 +46,21 @@
39
46
  "@atlaskit/avatar": "^21.0.0",
40
47
  "@atlaskit/button": "^16.3.0",
41
48
  "@atlaskit/docs": "*",
49
+ "@atlaskit/ds-lib": "^2.0.1",
42
50
  "@atlaskit/form": "^8.5.0",
43
51
  "@atlaskit/icon": "^21.10.0",
44
- "@atlaskit/section-message": "^6.1.0",
52
+ "@atlaskit/section-message": "^6.2.0",
45
53
  "@atlaskit/ssr": "*",
46
- "@atlaskit/toggle": "^12.4.0",
54
+ "@atlaskit/toggle": "^12.5.0",
47
55
  "@atlaskit/visual-regression": "*",
48
56
  "@atlaskit/webdriver-runner": "*",
49
57
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
50
- "@testing-library/dom": "^7.7.3",
51
- "@testing-library/react": "^8.0.1",
58
+ "@testing-library/dom": "^8.17.1",
59
+ "@testing-library/react": "^12.1.5",
52
60
  "jscodeshift": "^0.13.0",
53
61
  "react-dom": "^16.8.0",
54
62
  "storybook-addon-performance": "^0.16.0",
55
- "typescript": "4.3.5",
63
+ "typescript": "4.5.5",
56
64
  "wait-for-expect": "^1.2.0"
57
65
  },
58
66
  "keywords": [