@atlaskit/link-datasource 0.34.2 → 0.34.4

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,17 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 0.34.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0fb7c3220b9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0fb7c3220b9) - Fix issue where link doesn't open in new tab
8
+
9
+ ## 0.34.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`f93b91224c7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f93b91224c7) - [ux] Refocused column search after initial load
14
+
3
15
  ## 0.34.2
4
16
 
5
17
  ### Patch Changes
@@ -29,6 +29,7 @@ var ColumnPicker = function ColumnPicker(_ref) {
29
29
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
30
  allOptions = _useState2[0],
31
31
  setAllOptions = _useState2[1];
32
+ var pickerRef = (0, _react.useRef)(null);
32
33
  var mapColumnToOption = (0, _react.useCallback)(function (_ref2) {
33
34
  var key = _ref2.key,
34
35
  title = _ref2.title;
@@ -93,6 +94,13 @@ var ColumnPicker = function ColumnPicker(_ref) {
93
94
  return selectedValue.value === option.value;
94
95
  });
95
96
  };
97
+ (0, _react.useEffect)(function () {
98
+ if (allOptions.length) {
99
+ var _pickerRef$current, _pickerRef$current$se, _pickerRef$current$se2;
100
+ // necessary to refocus the search input after the loading state
101
+ pickerRef === null || pickerRef === void 0 ? void 0 : (_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 ? void 0 : (_pickerRef$current$se = _pickerRef$current.selectRef) === null || _pickerRef$current$se === void 0 ? void 0 : (_pickerRef$current$se2 = _pickerRef$current$se.inputRef) === null || _pickerRef$current$se2 === void 0 ? void 0 : _pickerRef$current$se2.focus();
102
+ }
103
+ }, [allOptions]);
96
104
  return (0, _react2.jsx)(_select.PopupSelect, {
97
105
  classNamePrefix: 'column-picker-popup',
98
106
  testId: 'column-picker-popup',
@@ -106,6 +114,7 @@ var ColumnPicker = function ColumnPicker(_ref) {
106
114
  hideSelectedOptions: false,
107
115
  id: 'column-picker-popup',
108
116
  isMulti: true,
117
+ ref: pickerRef,
109
118
  isOptionDisabled: handleIsOptionDisabled,
110
119
  placeholder: intl.formatMessage(_messages.columnPickerMessages.search),
111
120
  onKeyDown: stopEscapePropagationWhenOpen,
@@ -39,7 +39,8 @@ var LinkRenderType = function LinkRenderType(_ref) {
39
39
  return /*#__PURE__*/_react.default.createElement(_linkUrl.default, {
40
40
  href: url,
41
41
  style: linkStyle,
42
- "data-testid": testId
42
+ "data-testid": testId,
43
+ target: "_blank"
43
44
  }, text || url);
44
45
  }, [linkStyle, url, text, testId]);
45
46
  var SmartCard = function SmartCard() {
@@ -344,7 +344,7 @@ var analyticsContextAttributes = {
344
344
  };
345
345
  var analyticsContextData = {
346
346
  packageName: "@atlaskit/link-datasource",
347
- packageVersion: "0.34.2",
347
+ packageVersion: "0.34.4",
348
348
  source: 'datasourceConfigModal'
349
349
  };
350
350
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
- import { useCallback, useEffect, useState } from 'react';
3
+ import { useCallback, useEffect, useRef, useState } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
5
  import { useIntl } from 'react-intl-next';
6
6
  import Button from '@atlaskit/button/standard-button';
@@ -16,6 +16,7 @@ export const ColumnPicker = ({
16
16
  }) => {
17
17
  const intl = useIntl();
18
18
  const [allOptions, setAllOptions] = useState([]);
19
+ const pickerRef = useRef(null);
19
20
  const mapColumnToOption = useCallback(({
20
21
  key,
21
22
  title
@@ -68,6 +69,13 @@ export const ColumnPicker = ({
68
69
  const handleIsOptionDisabled = (option, selectValue) => {
69
70
  return selectValue.length === 1 && selectValue.some(selectedValue => selectedValue.value === option.value);
70
71
  };
72
+ useEffect(() => {
73
+ if (allOptions.length) {
74
+ var _pickerRef$current, _pickerRef$current$se, _pickerRef$current$se2;
75
+ // necessary to refocus the search input after the loading state
76
+ pickerRef === null || pickerRef === void 0 ? void 0 : (_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 ? void 0 : (_pickerRef$current$se = _pickerRef$current.selectRef) === null || _pickerRef$current$se === void 0 ? void 0 : (_pickerRef$current$se2 = _pickerRef$current$se.inputRef) === null || _pickerRef$current$se2 === void 0 ? void 0 : _pickerRef$current$se2.focus();
77
+ }
78
+ }, [allOptions]);
71
79
  return jsx(PopupSelect, {
72
80
  classNamePrefix: 'column-picker-popup',
73
81
  testId: 'column-picker-popup',
@@ -81,6 +89,7 @@ export const ColumnPicker = ({
81
89
  hideSelectedOptions: false,
82
90
  id: 'column-picker-popup',
83
91
  isMulti: true,
92
+ ref: pickerRef,
84
93
  isOptionDisabled: handleIsOptionDisabled,
85
94
  placeholder: intl.formatMessage(columnPickerMessages.search),
86
95
  onKeyDown: stopEscapePropagationWhenOpen,
@@ -25,7 +25,8 @@ const LinkRenderType = ({
25
25
  const anchor = useMemo(() => /*#__PURE__*/React.createElement(LinkUrl, {
26
26
  href: url,
27
27
  style: linkStyle,
28
- "data-testid": testId
28
+ "data-testid": testId,
29
+ target: "_blank"
29
30
  }, text || url), [linkStyle, url, text, testId]);
30
31
  const SmartCard = () => /*#__PURE__*/React.createElement(ErrorBoundary, {
31
32
  fallback: anchor
@@ -290,7 +290,7 @@ const analyticsContextAttributes = {
290
290
  };
291
291
  const analyticsContextData = {
292
292
  packageName: "@atlaskit/link-datasource",
293
- packageVersion: "0.34.2",
293
+ packageVersion: "0.34.4",
294
294
  source: 'datasourceConfigModal'
295
295
  };
296
296
  const contextData = {
@@ -4,7 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  var _excluded = ["isOpen"];
6
6
  /** @jsx jsx */
7
- import { useCallback, useEffect, useState } from 'react';
7
+ import { useCallback, useEffect, useRef, useState } from 'react';
8
8
  import { jsx } from '@emotion/react';
9
9
  import { useIntl } from 'react-intl-next';
10
10
  import Button from '@atlaskit/button/standard-button';
@@ -22,6 +22,7 @@ export var ColumnPicker = function ColumnPicker(_ref) {
22
22
  _useState2 = _slicedToArray(_useState, 2),
23
23
  allOptions = _useState2[0],
24
24
  setAllOptions = _useState2[1];
25
+ var pickerRef = useRef(null);
25
26
  var mapColumnToOption = useCallback(function (_ref2) {
26
27
  var key = _ref2.key,
27
28
  title = _ref2.title;
@@ -86,6 +87,13 @@ export var ColumnPicker = function ColumnPicker(_ref) {
86
87
  return selectedValue.value === option.value;
87
88
  });
88
89
  };
90
+ useEffect(function () {
91
+ if (allOptions.length) {
92
+ var _pickerRef$current, _pickerRef$current$se, _pickerRef$current$se2;
93
+ // necessary to refocus the search input after the loading state
94
+ pickerRef === null || pickerRef === void 0 ? void 0 : (_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 ? void 0 : (_pickerRef$current$se = _pickerRef$current.selectRef) === null || _pickerRef$current$se === void 0 ? void 0 : (_pickerRef$current$se2 = _pickerRef$current$se.inputRef) === null || _pickerRef$current$se2 === void 0 ? void 0 : _pickerRef$current$se2.focus();
95
+ }
96
+ }, [allOptions]);
89
97
  return jsx(PopupSelect, {
90
98
  classNamePrefix: 'column-picker-popup',
91
99
  testId: 'column-picker-popup',
@@ -99,6 +107,7 @@ export var ColumnPicker = function ColumnPicker(_ref) {
99
107
  hideSelectedOptions: false,
100
108
  id: 'column-picker-popup',
101
109
  isMulti: true,
110
+ ref: pickerRef,
102
111
  isOptionDisabled: handleIsOptionDisabled,
103
112
  placeholder: intl.formatMessage(columnPickerMessages.search),
104
113
  onKeyDown: stopEscapePropagationWhenOpen,
@@ -28,7 +28,8 @@ var LinkRenderType = function LinkRenderType(_ref) {
28
28
  return /*#__PURE__*/React.createElement(LinkUrl, {
29
29
  href: url,
30
30
  style: linkStyle,
31
- "data-testid": testId
31
+ "data-testid": testId,
32
+ target: "_blank"
32
33
  }, text || url);
33
34
  }, [linkStyle, url, text, testId]);
34
35
  var SmartCard = function SmartCard() {
@@ -334,7 +334,7 @@ var analyticsContextAttributes = {
334
334
  };
335
335
  var analyticsContextData = {
336
336
  packageName: "@atlaskit/link-datasource",
337
- packageVersion: "0.34.2",
337
+ packageVersion: "0.34.4",
338
338
  source: 'datasourceConfigModal'
339
339
  };
340
340
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.34.2",
3
+ "version": "0.34.4",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"