@atlaskit/inline-edit 13.1.0 → 13.2.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.
@@ -13,6 +13,8 @@ var _react2 = require("@emotion/react");
13
13
  var _analyticsNext = require("@atlaskit/analytics-next");
14
14
  var _Field = _interopRequireDefault(require("@atlaskit/form/Field"));
15
15
  var _Form = _interopRequireDefault(require("@atlaskit/form/Form"));
16
+ var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
17
+ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
16
18
  var _buttons = _interopRequireDefault(require("./internal/buttons"));
17
19
  var _useButtonFocusHook2 = _interopRequireDefault(require("./internal/hooks/use-button-focus-hook"));
18
20
  var _readView = _interopRequireDefault(require("./internal/read-view"));
@@ -27,7 +29,7 @@ var fieldStyles = (0, _react2.css)({
27
29
  var analyticsAttributes = {
28
30
  componentName: 'inlineEdit',
29
31
  packageName: "@atlaskit/inline-edit",
30
- packageVersion: "13.1.0"
32
+ packageVersion: "13.2.0"
31
33
  };
32
34
  var noop = function noop() {};
33
35
  var InnerInlineEdit = function InnerInlineEdit(props) {
@@ -150,7 +152,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
150
152
  postReadViewClick: doNotFocusOnEditButton,
151
153
  editButtonRef: editButtonRef,
152
154
  readViewFitContainerWidth: readViewFitContainerWidth,
153
- readView: readView
155
+ readView: readView,
156
+ testId: testId
154
157
  });
155
158
  };
156
159
  return (0, _react2.jsx)(_Form.default, {
@@ -211,11 +214,10 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
211
214
  _onCancelClick(e);
212
215
  }
213
216
  }) : /** This is to allow Ctrl + Enter to submit without action buttons */
214
- (0, _react2.jsx)("button", {
217
+ (0, _react2.jsx)(_pressable.default, {
215
218
  hidden: true,
216
- type: "submit",
217
- "aria-label": "Submit"
218
- }));
219
+ type: "submit"
220
+ }, (0, _react2.jsx)(_visuallyHidden.default, null, "Submit")));
219
221
  }) : /** Field is used here only for the label and spacing */
220
222
  (0, _react2.jsx)(_Field.default, {
221
223
  name: "inlineEdit",
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
@@ -7,7 +8,9 @@ Object.defineProperty(exports, "__esModule", {
7
8
  exports.default = void 0;
8
9
  var _react = _interopRequireWildcard(require("react"));
9
10
  var _react2 = require("@emotion/react");
11
+ var _primitives = require("@atlaskit/primitives");
10
12
  var _colors = require("@atlaskit/theme/colors");
13
+ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
11
14
  var _constants = require("./constants");
12
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -16,17 +19,24 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
16
19
  var readViewContainerStyles = (0, _react2.css)({
17
20
  lineHeight: 1
18
21
  });
19
- var editButtonStyles = (0, _react2.css)({
22
+ var editButtonStyles = (0, _primitives.xcss)({
20
23
  display: 'block',
21
- margin: "var(--ds-space-0, 0px)",
22
- padding: "var(--ds-space-0, 0px)",
24
+ margin: 'space.0',
25
+ padding: 'space.0',
23
26
  appearance: 'none',
24
27
  background: 'transparent',
25
28
  border: 0,
26
29
  lineHeight: 1,
27
- outline: '0',
28
- '&:focus + div': {
29
- border: "2px solid ".concat("var(--ds-border-focused, ".concat(_colors.B100, ")"))
30
+ outline: 0,
31
+ ':focus-visible': {
32
+ outline: 0
33
+ },
34
+ // @ts-expect-error
35
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
36
+ ':focus + div': {
37
+ borderColor: 'color.border.focused',
38
+ borderWidth: 'border.width.outline',
39
+ borderStyle: 'solid'
30
40
  }
31
41
  });
32
42
  var readViewWrapperStyles = (0, _react2.css)({
@@ -51,7 +61,8 @@ var ReadView = function ReadView(_ref) {
51
61
  postReadViewClick = _ref.postReadViewClick,
52
62
  editButtonRef = _ref.editButtonRef,
53
63
  readViewFitContainerWidth = _ref.readViewFitContainerWidth,
54
- readView = _ref.readView;
64
+ readView = _ref.readView,
65
+ testId = _ref.testId;
55
66
  var startX = (0, _react.useRef)(0);
56
67
  var startY = (0, _react.useRef)(0);
57
68
  var mouseHasMovedAfterMouseDown = function mouseHasMovedAfterMouseDown(event) {
@@ -68,13 +79,12 @@ var ReadView = function ReadView(_ref) {
68
79
  };
69
80
  return (0, _react2.jsx)("div", {
70
81
  css: readViewContainerStyles
71
- }, (0, _react2.jsx)("button", {
72
- css: editButtonStyles,
73
- "aria-label": editButtonLabel,
74
- type: "button",
82
+ }, (0, _react2.jsx)(_primitives.Pressable, {
83
+ xcss: editButtonStyles,
75
84
  onClick: onEditRequested,
76
- ref: editButtonRef
77
- }), (0, _react2.jsx)("div", {
85
+ ref: editButtonRef,
86
+ testId: testId && "".concat(testId, "--edit-button")
87
+ }, (0, _react2.jsx)(_visuallyHidden.default, null, editButtonLabel)), (0, _react2.jsx)("div", {
78
88
  css: [readViewWrapperStyles, readViewFitContainerWidth && readViewFitContainerWidthStyles]
79
89
  /**
80
90
  * It is not normally acceptable to add click handlers to non-interactive elements
@@ -4,6 +4,8 @@ import { css, jsx } from '@emotion/react';
4
4
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
5
5
  import Field from '@atlaskit/form/Field';
6
6
  import Form from '@atlaskit/form/Form';
7
+ import Pressable from '@atlaskit/primitives/pressable';
8
+ import VisuallyHidden from '@atlaskit/visually-hidden';
7
9
  import Buttons from './internal/buttons';
8
10
  import useButtonFocusHook from './internal/hooks/use-button-focus-hook';
9
11
  import ReadView from './internal/read-view';
@@ -14,7 +16,7 @@ const fieldStyles = css({
14
16
  const analyticsAttributes = {
15
17
  componentName: 'inlineEdit',
16
18
  packageName: "@atlaskit/inline-edit",
17
- packageVersion: "13.1.0"
19
+ packageVersion: "13.2.0"
18
20
  };
19
21
  const noop = () => {};
20
22
  const InnerInlineEdit = props => {
@@ -126,7 +128,8 @@ const InnerInlineEdit = props => {
126
128
  postReadViewClick: doNotFocusOnEditButton,
127
129
  editButtonRef: editButtonRef,
128
130
  readViewFitContainerWidth: readViewFitContainerWidth,
129
- readView: readView
131
+ readView: readView,
132
+ testId: testId
130
133
  });
131
134
  };
132
135
  return jsx(Form, {
@@ -187,11 +190,10 @@ const InnerInlineEdit = props => {
187
190
  onCancelClick(e);
188
191
  }
189
192
  }) : /** This is to allow Ctrl + Enter to submit without action buttons */
190
- jsx("button", {
193
+ jsx(Pressable, {
191
194
  hidden: true,
192
- type: "submit",
193
- "aria-label": "Submit"
194
- }))) : /** Field is used here only for the label and spacing */
195
+ type: "submit"
196
+ }, jsx(VisuallyHidden, null, "Submit")))) : /** Field is used here only for the label and spacing */
195
197
  jsx(Field, {
196
198
  name: "inlineEdit",
197
199
  label: label,
@@ -1,22 +1,31 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useRef } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
- import { B100, N30 } from '@atlaskit/theme/colors';
4
+ import { Pressable, xcss } from '@atlaskit/primitives';
5
+ import { N30 } from '@atlaskit/theme/colors';
6
+ import VisuallyHidden from '@atlaskit/visually-hidden';
5
7
  import { borderRadius } from './constants';
6
8
  const readViewContainerStyles = css({
7
9
  lineHeight: 1
8
10
  });
9
- const editButtonStyles = css({
11
+ const editButtonStyles = xcss({
10
12
  display: 'block',
11
- margin: "var(--ds-space-0, 0px)",
12
- padding: "var(--ds-space-0, 0px)",
13
+ margin: 'space.0',
14
+ padding: 'space.0',
13
15
  appearance: 'none',
14
16
  background: 'transparent',
15
17
  border: 0,
16
18
  lineHeight: 1,
17
- outline: '0',
18
- '&:focus + div': {
19
- border: `2px solid ${`var(--ds-border-focused, ${B100})`}`
19
+ outline: 0,
20
+ ':focus-visible': {
21
+ outline: 0
22
+ },
23
+ // @ts-expect-error
24
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
25
+ ':focus + div': {
26
+ borderColor: 'color.border.focused',
27
+ borderWidth: 'border.width.outline',
28
+ borderStyle: 'solid'
20
29
  }
21
30
  });
22
31
  const readViewWrapperStyles = css({
@@ -41,7 +50,8 @@ const ReadView = ({
41
50
  postReadViewClick,
42
51
  editButtonRef,
43
52
  readViewFitContainerWidth,
44
- readView
53
+ readView,
54
+ testId
45
55
  }) => {
46
56
  const startX = useRef(0);
47
57
  const startY = useRef(0);
@@ -59,13 +69,12 @@ const ReadView = ({
59
69
  };
60
70
  return jsx("div", {
61
71
  css: readViewContainerStyles
62
- }, jsx("button", {
63
- css: editButtonStyles,
64
- "aria-label": editButtonLabel,
65
- type: "button",
72
+ }, jsx(Pressable, {
73
+ xcss: editButtonStyles,
66
74
  onClick: onEditRequested,
67
- ref: editButtonRef
68
- }), jsx("div", {
75
+ ref: editButtonRef,
76
+ testId: testId && `${testId}--edit-button`
77
+ }, jsx(VisuallyHidden, null, editButtonLabel)), jsx("div", {
69
78
  css: [readViewWrapperStyles, readViewFitContainerWidth && readViewFitContainerWidthStyles]
70
79
  /**
71
80
  * It is not normally acceptable to add click handlers to non-interactive elements
@@ -8,6 +8,8 @@ import { css, jsx } from '@emotion/react';
8
8
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
9
9
  import Field from '@atlaskit/form/Field';
10
10
  import Form from '@atlaskit/form/Form';
11
+ import Pressable from '@atlaskit/primitives/pressable';
12
+ import VisuallyHidden from '@atlaskit/visually-hidden';
11
13
  import Buttons from './internal/buttons';
12
14
  import useButtonFocusHook from './internal/hooks/use-button-focus-hook';
13
15
  import ReadView from './internal/read-view';
@@ -18,7 +20,7 @@ var fieldStyles = css({
18
20
  var analyticsAttributes = {
19
21
  componentName: 'inlineEdit',
20
22
  packageName: "@atlaskit/inline-edit",
21
- packageVersion: "13.1.0"
23
+ packageVersion: "13.2.0"
22
24
  };
23
25
  var noop = function noop() {};
24
26
  var InnerInlineEdit = function InnerInlineEdit(props) {
@@ -141,7 +143,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
141
143
  postReadViewClick: doNotFocusOnEditButton,
142
144
  editButtonRef: editButtonRef,
143
145
  readViewFitContainerWidth: readViewFitContainerWidth,
144
- readView: readView
146
+ readView: readView,
147
+ testId: testId
145
148
  });
146
149
  };
147
150
  return jsx(Form, {
@@ -202,11 +205,10 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
202
205
  _onCancelClick(e);
203
206
  }
204
207
  }) : /** This is to allow Ctrl + Enter to submit without action buttons */
205
- jsx("button", {
208
+ jsx(Pressable, {
206
209
  hidden: true,
207
- type: "submit",
208
- "aria-label": "Submit"
209
- }));
210
+ type: "submit"
211
+ }, jsx(VisuallyHidden, null, "Submit")));
210
212
  }) : /** Field is used here only for the label and spacing */
211
213
  jsx(Field, {
212
214
  name: "inlineEdit",
@@ -1,22 +1,31 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useRef } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
- import { B100, N30 } from '@atlaskit/theme/colors';
4
+ import { Pressable, xcss } from '@atlaskit/primitives';
5
+ import { N30 } from '@atlaskit/theme/colors';
6
+ import VisuallyHidden from '@atlaskit/visually-hidden';
5
7
  import { borderRadius } from './constants';
6
8
  var readViewContainerStyles = css({
7
9
  lineHeight: 1
8
10
  });
9
- var editButtonStyles = css({
11
+ var editButtonStyles = xcss({
10
12
  display: 'block',
11
- margin: "var(--ds-space-0, 0px)",
12
- padding: "var(--ds-space-0, 0px)",
13
+ margin: 'space.0',
14
+ padding: 'space.0',
13
15
  appearance: 'none',
14
16
  background: 'transparent',
15
17
  border: 0,
16
18
  lineHeight: 1,
17
- outline: '0',
18
- '&:focus + div': {
19
- border: "2px solid ".concat("var(--ds-border-focused, ".concat(B100, ")"))
19
+ outline: 0,
20
+ ':focus-visible': {
21
+ outline: 0
22
+ },
23
+ // @ts-expect-error
24
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
25
+ ':focus + div': {
26
+ borderColor: 'color.border.focused',
27
+ borderWidth: 'border.width.outline',
28
+ borderStyle: 'solid'
20
29
  }
21
30
  });
22
31
  var readViewWrapperStyles = css({
@@ -41,7 +50,8 @@ var ReadView = function ReadView(_ref) {
41
50
  postReadViewClick = _ref.postReadViewClick,
42
51
  editButtonRef = _ref.editButtonRef,
43
52
  readViewFitContainerWidth = _ref.readViewFitContainerWidth,
44
- readView = _ref.readView;
53
+ readView = _ref.readView,
54
+ testId = _ref.testId;
45
55
  var startX = useRef(0);
46
56
  var startY = useRef(0);
47
57
  var mouseHasMovedAfterMouseDown = function mouseHasMovedAfterMouseDown(event) {
@@ -58,13 +68,12 @@ var ReadView = function ReadView(_ref) {
58
68
  };
59
69
  return jsx("div", {
60
70
  css: readViewContainerStyles
61
- }, jsx("button", {
62
- css: editButtonStyles,
63
- "aria-label": editButtonLabel,
64
- type: "button",
71
+ }, jsx(Pressable, {
72
+ xcss: editButtonStyles,
65
73
  onClick: onEditRequested,
66
- ref: editButtonRef
67
- }), jsx("div", {
74
+ ref: editButtonRef,
75
+ testId: testId && "".concat(testId, "--edit-button")
76
+ }, jsx(VisuallyHidden, null, editButtonLabel)), jsx("div", {
68
77
  css: [readViewWrapperStyles, readViewFitContainerWidth && readViewFitContainerWidthStyles]
69
78
  /**
70
79
  * It is not normally acceptable to add click handlers to non-interactive elements
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { InlineEditProps } from './types';
2
+ import { type InlineEditProps } from './types';
3
3
  declare const InlineEdit: <FieldValue extends unknown = string>(props: InlineEditProps<FieldValue>) => jsx.JSX.Element;
4
4
  export default InlineEdit;
@@ -8,6 +8,7 @@ interface ReadViewProps {
8
8
  editButtonRef: React.RefObject<HTMLButtonElement>;
9
9
  readViewFitContainerWidth?: boolean;
10
10
  readView: () => React.ReactNode;
11
+ testId?: string;
11
12
  }
12
- declare const ReadView: ({ editButtonLabel, onEditRequested, postReadViewClick, editButtonRef, readViewFitContainerWidth, readView, }: ReadViewProps) => jsx.JSX.Element;
13
+ declare const ReadView: ({ editButtonLabel, onEditRequested, postReadViewClick, editButtonRef, readViewFitContainerWidth, readView, testId, }: ReadViewProps) => jsx.JSX.Element;
13
14
  export default ReadView;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { InlineEditProps } from './types';
2
+ import { type InlineEditProps } from './types';
3
3
  declare const InlineEdit: <FieldValue extends unknown = string>(props: InlineEditProps<FieldValue>) => jsx.JSX.Element;
4
4
  export default InlineEdit;
@@ -8,6 +8,7 @@ interface ReadViewProps {
8
8
  editButtonRef: React.RefObject<HTMLButtonElement>;
9
9
  readViewFitContainerWidth?: boolean;
10
10
  readView: () => React.ReactNode;
11
+ testId?: string;
11
12
  }
12
- declare const ReadView: ({ editButtonLabel, onEditRequested, postReadViewClick, editButtonRef, readViewFitContainerWidth, readView, }: ReadViewProps) => jsx.JSX.Element;
13
+ declare const ReadView: ({ editButtonLabel, onEditRequested, postReadViewClick, editButtonRef, readViewFitContainerWidth, readView, testId, }: ReadViewProps) => jsx.JSX.Element;
13
14
  export default ReadView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "13.1.0",
3
+ "version": "13.2.0",
4
4
  "description": "An inline edit displays a custom input component that switches between reading and editing on the same page.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,15 +35,17 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@atlaskit/analytics-next": "^9.2.0",
39
- "@atlaskit/button": "^17.7.0",
38
+ "@atlaskit/analytics-next": "^9.3.0",
39
+ "@atlaskit/button": "^17.14.0",
40
40
  "@atlaskit/codemod-utils": "^4.2.0",
41
- "@atlaskit/form": "^9.0.3",
41
+ "@atlaskit/form": "^9.3.0",
42
42
  "@atlaskit/icon": "^22.1.0",
43
43
  "@atlaskit/inline-dialog": "^14.0.0",
44
- "@atlaskit/textfield": "^6.1.0",
45
- "@atlaskit/theme": "^12.6.0",
46
- "@atlaskit/tokens": "^1.42.0",
44
+ "@atlaskit/primitives": "^5.7.0",
45
+ "@atlaskit/textfield": "^6.3.0",
46
+ "@atlaskit/theme": "^12.7.0",
47
+ "@atlaskit/tokens": "^1.45.0",
48
+ "@atlaskit/visually-hidden": "^1.3.0",
47
49
  "@babel/runtime": "^7.0.0",
48
50
  "@emotion/react": "^11.7.1"
49
51
  },
@@ -53,15 +55,15 @@
53
55
  "devDependencies": {
54
56
  "@af/accessibility-testing": "*",
55
57
  "@af/integration-testing": "*",
56
- "@atlaskit/datetime-picker": "^13.2.0",
58
+ "@atlaskit/datetime-picker": "^13.5.0",
57
59
  "@atlaskit/docs": "*",
58
- "@atlaskit/ds-lib": "^2.2.0",
59
- "@atlaskit/section-message": "^6.4.0",
60
- "@atlaskit/select": "^17.3.0",
60
+ "@atlaskit/ds-lib": "^2.3.0",
61
+ "@atlaskit/section-message": "^6.5.0",
62
+ "@atlaskit/select": "^17.8.0",
61
63
  "@atlaskit/ssr": "*",
62
- "@atlaskit/tag": "^12.0.0",
63
- "@atlaskit/tag-group": "^10.2.0",
64
- "@atlaskit/textarea": "^5.2.0",
64
+ "@atlaskit/tag": "^12.2.0",
65
+ "@atlaskit/tag-group": "^10.3.0",
66
+ "@atlaskit/textarea": "^5.4.0",
65
67
  "@atlaskit/visual-regression": "*",
66
68
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
67
69
  "@emotion/styled": "^11.0.0",