@atlaskit/inline-edit 15.6.3 → 15.6.5
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 +14 -0
- package/dist/cjs/inline-edit.js +3 -1
- package/dist/cjs/internal/get-text-from-react-node.js +33 -0
- package/dist/es2019/inline-edit.js +3 -1
- package/dist/es2019/internal/get-text-from-react-node.js +27 -0
- package/dist/esm/inline-edit.js +3 -1
- package/dist/esm/internal/get-text-from-react-node.js +27 -0
- package/dist/types/internal/get-text-from-react-node.d.ts +9 -0
- package/dist/types-ts4.5/internal/get-text-from-react-node.d.ts +9 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/inline-edit
|
|
2
2
|
|
|
3
|
+
## 15.6.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1dc3b51d1f95e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1dc3b51d1f95e) -
|
|
8
|
+
Fix accessible edit button label rendering as [object Object] when a ReactNode is provided for the
|
|
9
|
+
label prop
|
|
10
|
+
|
|
11
|
+
## 15.6.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 15.6.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/inline-edit.js
CHANGED
|
@@ -19,6 +19,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
19
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
20
20
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
21
21
|
var _buttons = _interopRequireDefault(require("./internal/buttons"));
|
|
22
|
+
var _getTextFromReactNode = _interopRequireDefault(require("./internal/get-text-from-react-node"));
|
|
22
23
|
var _useButtonFocusHook2 = _interopRequireDefault(require("./internal/hooks/use-button-focus-hook"));
|
|
23
24
|
var _readView = _interopRequireDefault(require("./internal/read-view"));
|
|
24
25
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -153,7 +154,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
153
154
|
}, []);
|
|
154
155
|
var concatenatedEditButtonLabel = function concatenatedEditButtonLabel() {
|
|
155
156
|
if (label) {
|
|
156
|
-
|
|
157
|
+
var labelText = typeof label === 'string' ? label : (0, _getTextFromReactNode.default)(label);
|
|
158
|
+
return "".concat(editButtonLabel, ", ").concat(labelText, ", ").concat(editLabel);
|
|
157
159
|
}
|
|
158
160
|
return "".concat(editButtonLabel, ", ").concat(editLabel);
|
|
159
161
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
/**
|
|
10
|
+
* Recursively extracts plain text content from a ReactNode.
|
|
11
|
+
*
|
|
12
|
+
* This is useful when a ReactNode needs to be represented as a string,
|
|
13
|
+
* e.g. for use in an `aria-label` attribute.
|
|
14
|
+
*/
|
|
15
|
+
var _getTextFromReactNode = function getTextFromReactNode(node) {
|
|
16
|
+
if (node == null || typeof node === 'boolean') {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
if (typeof node === 'string') {
|
|
20
|
+
return node;
|
|
21
|
+
}
|
|
22
|
+
if (typeof node === 'number') {
|
|
23
|
+
return String(node);
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(node)) {
|
|
26
|
+
return node.map(_getTextFromReactNode).join('');
|
|
27
|
+
}
|
|
28
|
+
if ( /*#__PURE__*/_react.default.isValidElement(node)) {
|
|
29
|
+
return _getTextFromReactNode(node.props.children);
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
};
|
|
33
|
+
var _default = exports.default = _getTextFromReactNode;
|
|
@@ -9,6 +9,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
9
9
|
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
10
10
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
11
11
|
import Buttons from './internal/buttons';
|
|
12
|
+
import getTextFromReactNode from './internal/get-text-from-react-node';
|
|
12
13
|
import useButtonFocusHook from './internal/hooks/use-button-focus-hook';
|
|
13
14
|
import ReadView from './internal/read-view';
|
|
14
15
|
const fieldStyles = null;
|
|
@@ -130,7 +131,8 @@ const InnerInlineEdit = props => {
|
|
|
130
131
|
}, []);
|
|
131
132
|
const concatenatedEditButtonLabel = () => {
|
|
132
133
|
if (label) {
|
|
133
|
-
|
|
134
|
+
const labelText = typeof label === 'string' ? label : getTextFromReactNode(label);
|
|
135
|
+
return `${editButtonLabel}, ${labelText}, ${editLabel}`;
|
|
134
136
|
}
|
|
135
137
|
return `${editButtonLabel}, ${editLabel}`;
|
|
136
138
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Recursively extracts plain text content from a ReactNode.
|
|
5
|
+
*
|
|
6
|
+
* This is useful when a ReactNode needs to be represented as a string,
|
|
7
|
+
* e.g. for use in an `aria-label` attribute.
|
|
8
|
+
*/
|
|
9
|
+
const getTextFromReactNode = node => {
|
|
10
|
+
if (node == null || typeof node === 'boolean') {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
if (typeof node === 'string') {
|
|
14
|
+
return node;
|
|
15
|
+
}
|
|
16
|
+
if (typeof node === 'number') {
|
|
17
|
+
return String(node);
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(node)) {
|
|
20
|
+
return node.map(getTextFromReactNode).join('');
|
|
21
|
+
}
|
|
22
|
+
if ( /*#__PURE__*/React.isValidElement(node)) {
|
|
23
|
+
return getTextFromReactNode(node.props.children);
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
};
|
|
27
|
+
export default getTextFromReactNode;
|
package/dist/esm/inline-edit.js
CHANGED
|
@@ -13,6 +13,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
13
13
|
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
14
14
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
15
15
|
import Buttons from './internal/buttons';
|
|
16
|
+
import getTextFromReactNode from './internal/get-text-from-react-node';
|
|
16
17
|
import useButtonFocusHook from './internal/hooks/use-button-focus-hook';
|
|
17
18
|
import ReadView from './internal/read-view';
|
|
18
19
|
var fieldStyles = null;
|
|
@@ -144,7 +145,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
|
|
|
144
145
|
}, []);
|
|
145
146
|
var concatenatedEditButtonLabel = function concatenatedEditButtonLabel() {
|
|
146
147
|
if (label) {
|
|
147
|
-
|
|
148
|
+
var labelText = typeof label === 'string' ? label : getTextFromReactNode(label);
|
|
149
|
+
return "".concat(editButtonLabel, ", ").concat(labelText, ", ").concat(editLabel);
|
|
148
150
|
}
|
|
149
151
|
return "".concat(editButtonLabel, ", ").concat(editLabel);
|
|
150
152
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Recursively extracts plain text content from a ReactNode.
|
|
5
|
+
*
|
|
6
|
+
* This is useful when a ReactNode needs to be represented as a string,
|
|
7
|
+
* e.g. for use in an `aria-label` attribute.
|
|
8
|
+
*/
|
|
9
|
+
var _getTextFromReactNode = function getTextFromReactNode(node) {
|
|
10
|
+
if (node == null || typeof node === 'boolean') {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
if (typeof node === 'string') {
|
|
14
|
+
return node;
|
|
15
|
+
}
|
|
16
|
+
if (typeof node === 'number') {
|
|
17
|
+
return String(node);
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(node)) {
|
|
20
|
+
return node.map(_getTextFromReactNode).join('');
|
|
21
|
+
}
|
|
22
|
+
if ( /*#__PURE__*/React.isValidElement(node)) {
|
|
23
|
+
return _getTextFromReactNode(node.props.children);
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
};
|
|
27
|
+
export default _getTextFromReactNode;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively extracts plain text content from a ReactNode.
|
|
4
|
+
*
|
|
5
|
+
* This is useful when a ReactNode needs to be represented as a string,
|
|
6
|
+
* e.g. for use in an `aria-label` attribute.
|
|
7
|
+
*/
|
|
8
|
+
declare const getTextFromReactNode: (node: React.ReactNode) => string;
|
|
9
|
+
export default getTextFromReactNode;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively extracts plain text content from a ReactNode.
|
|
4
|
+
*
|
|
5
|
+
* This is useful when a ReactNode needs to be represented as a string,
|
|
6
|
+
* e.g. for use in an `aria-label` attribute.
|
|
7
|
+
*/
|
|
8
|
+
declare const getTextFromReactNode: (node: React.ReactNode) => string;
|
|
9
|
+
export default getTextFromReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/inline-edit",
|
|
3
|
-
"version": "15.6.
|
|
3
|
+
"version": "15.6.5",
|
|
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/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/button": "^23.9.0",
|
|
38
38
|
"@atlaskit/css": "^0.19.0",
|
|
39
39
|
"@atlaskit/form": "^15.3.0",
|
|
40
|
-
"@atlaskit/icon": "^
|
|
40
|
+
"@atlaskit/icon": "^31.0.0",
|
|
41
41
|
"@atlaskit/inline-dialog": "^18.0.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
43
43
|
"@atlaskit/primitives": "^18.0.0",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@af/accessibility-testing": "workspace:^",
|
|
56
56
|
"@af/integration-testing": "workspace:^",
|
|
57
|
-
"@atlaskit/datetime-picker": "^17.
|
|
57
|
+
"@atlaskit/datetime-picker": "^17.5.0",
|
|
58
58
|
"@atlaskit/docs": "^11.3.0",
|
|
59
|
-
"@atlaskit/heading": "^5.
|
|
59
|
+
"@atlaskit/heading": "^5.3.0",
|
|
60
60
|
"@atlaskit/link": "^3.3.0",
|
|
61
61
|
"@atlaskit/section-message": "^8.12.0",
|
|
62
62
|
"@atlaskit/select": "^21.7.0",
|
|
63
|
-
"@atlaskit/tag": "^14.
|
|
63
|
+
"@atlaskit/tag": "^14.5.0",
|
|
64
64
|
"@atlaskit/tag-group": "^12.0.0",
|
|
65
65
|
"@atlaskit/textarea": "^8.2.0",
|
|
66
66
|
"@atlassian/ssr-tests": "workspace:^",
|