@atlaskit/link-picker 1.21.0 → 1.22.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`cd623c7a474`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd623c7a474) - [ux] Wrap search input with conditional spotlight target for better onboarding
8
+
3
9
  ## 1.21.0
4
10
 
5
11
  ### Minor Changes
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ConditionalSpotlightTargetWrapper = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _onboarding = require("@atlaskit/onboarding");
10
+ var ConditionalSpotlightTargetWrapper = function ConditionalSpotlightTargetWrapper(_ref) {
11
+ var spotlightTargetName = _ref.spotlightTargetName,
12
+ children = _ref.children;
13
+ return spotlightTargetName ? /*#__PURE__*/_react.default.createElement(_onboarding.SpotlightTarget, {
14
+ name: spotlightTargetName
15
+ }, children) : children;
16
+ };
17
+ exports.ConditionalSpotlightTargetWrapper = ConditionalSpotlightTargetWrapper;
@@ -332,6 +332,7 @@ function LinkPicker(_ref) {
332
332
  "aria-activedescendant": ariaActiveDescendant,
333
333
  "aria-describedby": screenReaderDescriptionId,
334
334
  error: invalidUrl ? intl.formatMessage(_messages.formMessages.linkInvalid) : null,
335
+ spotlightTargetName: "link-picker-search-field-spotlight-target",
335
336
  onClear: handleUrlClear,
336
337
  onKeyDown: handleKeyDown,
337
338
  onChange: handleChangeUrl
@@ -13,9 +13,10 @@ var _form = require("@atlaskit/form");
13
13
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
14
14
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
15
15
  var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-clear"));
16
+ var _conditionalSpotlightTargetWrapper = require("../conditional-spotlight-target-wrapper");
16
17
  var _utils = require("../utils");
17
18
  var _styled = require("./styled");
18
- var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error"];
19
+ var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error", "spotlightTargetName"];
19
20
  /** @jsx jsx */
20
21
  var testIds = {
21
22
  urlError: 'link-error',
@@ -32,6 +33,7 @@ var TextInput = function TextInput(_ref) {
32
33
  onClear = _ref.onClear,
33
34
  clearLabel = _ref.clearLabel,
34
35
  error = _ref.error,
36
+ spotlightTargetName = _ref.spotlightTargetName,
35
37
  restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
36
38
  var inputRef = (0, _react.useRef)(null);
37
39
  var handleRef = (0, _react.useCallback)(function (input) {
@@ -82,14 +84,16 @@ var TextInput = function TextInput(_ref) {
82
84
  name: name
83
85
  }, function (_ref2) {
84
86
  var fieldProps = _ref2.fieldProps;
85
- return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_textfield.default, (0, _extends2.default)({}, fieldProps, restProps, {
87
+ return (0, _react2.jsx)(_conditionalSpotlightTargetWrapper.ConditionalSpotlightTargetWrapper, {
88
+ spotlightTargetName: spotlightTargetName
89
+ }, (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_textfield.default, (0, _extends2.default)({}, fieldProps, restProps, {
86
90
  onKeyDown: handleKeydown,
87
91
  ref: handleRef,
88
92
  elemAfterInput: clearText,
89
93
  isInvalid: !!error
90
94
  })), error && (0, _react2.jsx)(_form.ErrorMessage, {
91
95
  testId: testIds.urlError
92
- }, error));
96
+ }, error)));
93
97
  }));
94
98
  };
95
99
  var _default = TextInput;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SpotlightTarget } from '@atlaskit/onboarding';
3
+ export const ConditionalSpotlightTargetWrapper = ({
4
+ spotlightTargetName,
5
+ children
6
+ }) => {
7
+ return spotlightTargetName ? /*#__PURE__*/React.createElement(SpotlightTarget, {
8
+ name: spotlightTargetName
9
+ }, children) : children;
10
+ };
@@ -326,6 +326,7 @@ function LinkPicker({
326
326
  "aria-activedescendant": ariaActiveDescendant,
327
327
  "aria-describedby": screenReaderDescriptionId,
328
328
  error: invalidUrl ? intl.formatMessage(formMessages.linkInvalid) : null,
329
+ spotlightTargetName: "link-picker-search-field-spotlight-target",
329
330
  onClear: handleUrlClear,
330
331
  onKeyDown: handleKeyDown,
331
332
  onChange: handleChangeUrl
@@ -6,6 +6,7 @@ import { ErrorMessage, Field } from '@atlaskit/form';
6
6
  import Tooltip from '@atlaskit/tooltip';
7
7
  import Textfield from '@atlaskit/textfield';
8
8
  import Selectclear from '@atlaskit/icon/glyph/select-clear';
9
+ import { ConditionalSpotlightTargetWrapper } from '../conditional-spotlight-target-wrapper';
9
10
  import { isRedoEvent, isUndoEvent } from '../utils';
10
11
  import { clearTextButtonStyles, fieldStyles } from './styled';
11
12
  export const testIds = {
@@ -22,6 +23,7 @@ const TextInput = ({
22
23
  onClear,
23
24
  clearLabel,
24
25
  error,
26
+ spotlightTargetName,
25
27
  ...restProps
26
28
  }) => {
27
29
  const inputRef = useRef(null);
@@ -74,14 +76,16 @@ const TextInput = ({
74
76
  }, ({
75
77
  fieldProps
76
78
  }) => {
77
- return jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
79
+ return jsx(ConditionalSpotlightTargetWrapper, {
80
+ spotlightTargetName: spotlightTargetName
81
+ }, jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
78
82
  onKeyDown: handleKeydown,
79
83
  ref: handleRef,
80
84
  elemAfterInput: clearText,
81
85
  isInvalid: !!error
82
86
  })), error && jsx(ErrorMessage, {
83
87
  testId: testIds.urlError
84
- }, error));
88
+ }, error)));
85
89
  }));
86
90
  };
87
91
  export default TextInput;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { SpotlightTarget } from '@atlaskit/onboarding';
3
+ export var ConditionalSpotlightTargetWrapper = function ConditionalSpotlightTargetWrapper(_ref) {
4
+ var spotlightTargetName = _ref.spotlightTargetName,
5
+ children = _ref.children;
6
+ return spotlightTargetName ? /*#__PURE__*/React.createElement(SpotlightTarget, {
7
+ name: spotlightTargetName
8
+ }, children) : children;
9
+ };
@@ -321,6 +321,7 @@ function LinkPicker(_ref) {
321
321
  "aria-activedescendant": ariaActiveDescendant,
322
322
  "aria-describedby": screenReaderDescriptionId,
323
323
  error: invalidUrl ? intl.formatMessage(formMessages.linkInvalid) : null,
324
+ spotlightTargetName: "link-picker-search-field-spotlight-target",
324
325
  onClear: handleUrlClear,
325
326
  onKeyDown: handleKeyDown,
326
327
  onChange: handleChangeUrl
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error"];
3
+ var _excluded = ["name", "label", "autoFocus", "onRedo", "onUndo", "onKeyDown", "onClear", "clearLabel", "error", "spotlightTargetName"];
4
4
  /** @jsx jsx */
5
5
  import { useCallback, useRef, Fragment } from 'react';
6
6
  import { jsx } from '@emotion/react';
@@ -8,6 +8,7 @@ import { ErrorMessage, Field } from '@atlaskit/form';
8
8
  import Tooltip from '@atlaskit/tooltip';
9
9
  import Textfield from '@atlaskit/textfield';
10
10
  import Selectclear from '@atlaskit/icon/glyph/select-clear';
11
+ import { ConditionalSpotlightTargetWrapper } from '../conditional-spotlight-target-wrapper';
11
12
  import { isRedoEvent, isUndoEvent } from '../utils';
12
13
  import { clearTextButtonStyles, fieldStyles } from './styled';
13
14
  export var testIds = {
@@ -24,6 +25,7 @@ var TextInput = function TextInput(_ref) {
24
25
  onClear = _ref.onClear,
25
26
  clearLabel = _ref.clearLabel,
26
27
  error = _ref.error,
28
+ spotlightTargetName = _ref.spotlightTargetName,
27
29
  restProps = _objectWithoutProperties(_ref, _excluded);
28
30
  var inputRef = useRef(null);
29
31
  var handleRef = useCallback(function (input) {
@@ -74,14 +76,16 @@ var TextInput = function TextInput(_ref) {
74
76
  name: name
75
77
  }, function (_ref2) {
76
78
  var fieldProps = _ref2.fieldProps;
77
- return jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
79
+ return jsx(ConditionalSpotlightTargetWrapper, {
80
+ spotlightTargetName: spotlightTargetName
81
+ }, jsx(Fragment, null, jsx(Textfield, _extends({}, fieldProps, restProps, {
78
82
  onKeyDown: handleKeydown,
79
83
  ref: handleRef,
80
84
  elemAfterInput: clearText,
81
85
  isInvalid: !!error
82
86
  })), error && jsx(ErrorMessage, {
83
87
  testId: testIds.urlError
84
- }, error));
88
+ }, error)));
85
89
  }));
86
90
  };
87
91
  export default TextInput;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { FunctionComponent } from 'react';
3
+ export interface ConditionalSpotlightTargetWrapperProps {
4
+ spotlightTargetName?: string;
5
+ children: React.ReactElement;
6
+ }
7
+ export declare const ConditionalSpotlightTargetWrapper: FunctionComponent<ConditionalSpotlightTargetWrapperProps>;
@@ -1,6 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { TextFieldProps } from '@atlaskit/textfield';
3
- export type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & {
3
+ import { ConditionalSpotlightTargetWrapperProps } from '../conditional-spotlight-target-wrapper';
4
+ export type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & Pick<ConditionalSpotlightTargetWrapperProps, 'spotlightTargetName'> & {
4
5
  name: string;
5
6
  value: string;
6
7
  label?: string;
@@ -14,5 +15,5 @@ export declare const testIds: {
14
15
  urlError: string;
15
16
  clearUrlButton: string;
16
17
  };
17
- declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, ...restProps }: TextInputProps) => jsx.JSX.Element;
18
+ declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, ...restProps }: TextInputProps) => jsx.JSX.Element;
18
19
  export default TextInput;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { FunctionComponent } from 'react';
3
+ export interface ConditionalSpotlightTargetWrapperProps {
4
+ spotlightTargetName?: string;
5
+ children: React.ReactElement;
6
+ }
7
+ export declare const ConditionalSpotlightTargetWrapper: FunctionComponent<ConditionalSpotlightTargetWrapperProps>;
@@ -1,6 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { TextFieldProps } from '@atlaskit/textfield';
3
- export type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & {
3
+ import { ConditionalSpotlightTargetWrapperProps } from '../conditional-spotlight-target-wrapper';
4
+ export type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & Pick<ConditionalSpotlightTargetWrapperProps, 'spotlightTargetName'> & {
4
5
  name: string;
5
6
  value: string;
6
7
  label?: string;
@@ -14,5 +15,5 @@ export declare const testIds: {
14
15
  urlError: string;
15
16
  clearUrlButton: string;
16
17
  };
17
- declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, ...restProps }: TextInputProps) => jsx.JSX.Element;
18
+ declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, spotlightTargetName, ...restProps }: TextInputProps) => jsx.JSX.Element;
18
19
  export default TextInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -45,9 +45,10 @@
45
45
  "@atlaskit/frontend-utilities": "^2.6.0",
46
46
  "@atlaskit/icon": "^21.12.0",
47
47
  "@atlaskit/linking-common": "^2.12.0",
48
+ "@atlaskit/onboarding": "^10.8.2",
48
49
  "@atlaskit/spinner": "^15.5.0",
49
50
  "@atlaskit/tabs": "^13.4.0",
50
- "@atlaskit/textfield": "^5.4.0",
51
+ "@atlaskit/textfield": "^5.5.0",
51
52
  "@atlaskit/theme": "^12.5.0",
52
53
  "@atlaskit/tokens": "^1.4.0",
53
54
  "@atlaskit/tooltip": "^17.8.0",
@@ -79,8 +80,8 @@
79
80
  "@atlaskit/webdriver-runner": "*",
80
81
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
81
82
  "@atlassian/codegen": "^0.1.0",
82
- "@atlassian/link-picker-atlassian-plugin": "^31.0.0",
83
- "@atlassian/link-picker-plugins": "^21.0.0",
83
+ "@atlassian/link-picker-atlassian-plugin": "^32.0.0",
84
+ "@atlassian/link-picker-plugins": "^22.0.0",
84
85
  "@atlassian/recent-work-client": "^1.8.0",
85
86
  "@atlassian/search-provider": "^2.4.0",
86
87
  "@testing-library/dom": "^8.17.1",