@atlaskit/link-picker 0.7.0 → 0.8.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
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`1e371fd8d23`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1e371fd8d23) - Updates link picker to support array of plugins. Removes intl prop from LinkPickerProps type.
8
+
3
9
  ## 0.7.0
4
10
 
5
11
  ### Minor Changes
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.RECENT_SEARCH_LIST_SIZE = exports.LinkPickerWithIntl = exports.LinkPicker = void 0;
10
+ exports.RECENT_SEARCH_LIST_SIZE = exports.LinkPickerWithIntl = void 0;
11
11
 
12
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
13
 
@@ -342,7 +342,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
342
342
  }, {
343
343
  key: "getActivePlugin",
344
344
  value: function getActivePlugin() {
345
- if (!this.props.plugins) {
345
+ if (!this.props.plugins || this.props.plugins.length === 0) {
346
346
  return null;
347
347
  }
348
348
 
@@ -561,8 +561,6 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
561
561
  return LinkPicker;
562
562
  }(_react.PureComponent);
563
563
 
564
- exports.LinkPicker = LinkPicker;
565
-
566
564
  function findIndex(array, predicate) {
567
565
  var index = -1;
568
566
  array.some(function (item, i) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -17,7 +17,8 @@ import { FormFooter } from '@atlaskit/form';
17
17
  import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
18
18
  import VisuallyHidden from '@atlaskit/visually-hidden';
19
19
  export const RECENT_SEARCH_LIST_SIZE = 5;
20
- export class LinkPicker extends PureComponent {
20
+
21
+ class LinkPicker extends PureComponent {
21
22
  constructor(props) {
22
23
  super(props);
23
24
 
@@ -288,7 +289,7 @@ export class LinkPicker extends PureComponent {
288
289
  }
289
290
 
290
291
  getActivePlugin() {
291
- if (!this.props.plugins) {
292
+ if (!this.props.plugins || this.props.plugins.length === 0) {
292
293
  return null;
293
294
  }
294
295
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -33,7 +33,8 @@ import { FormFooter } from '@atlaskit/form';
33
33
  import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
34
34
  import VisuallyHidden from '@atlaskit/visually-hidden';
35
35
  export var RECENT_SEARCH_LIST_SIZE = 5;
36
- export var LinkPicker = /*#__PURE__*/function (_PureComponent) {
36
+
37
+ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
37
38
  _inherits(LinkPicker, _PureComponent);
38
39
 
39
40
  var _super = _createSuper(LinkPicker);
@@ -319,7 +320,7 @@ export var LinkPicker = /*#__PURE__*/function (_PureComponent) {
319
320
  }, {
320
321
  key: "getActivePlugin",
321
322
  value: function getActivePlugin() {
322
- if (!this.props.plugins) {
323
+ if (!this.props.plugins || this.props.plugins.length === 0) {
323
324
  return null;
324
325
  }
325
326
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React, { PureComponent } from 'react';
2
+ import React from 'react';
3
3
  import { WrappedComponentProps } from 'react-intl-next';
4
4
  import { LinkSearchListItemData, LinkInputType, LinkPickerPlugin } from '../types';
5
5
  export declare const RECENT_SEARCH_LIST_SIZE = 5;
@@ -24,7 +24,7 @@ interface OnSubmitParameter {
24
24
  */
25
25
  rawUrl?: string;
26
26
  }
27
- interface BaseProps {
27
+ export interface LinkPickerProps {
28
28
  /** Callback to fire on form submission. */
29
29
  onSubmit: (arg: OnSubmitParameter) => void;
30
30
  /** Callback to fire when the cancel button is clicked. */
@@ -34,9 +34,8 @@ interface BaseProps {
34
34
  /** The desired text to be displayed alternatively to the title of the linked resource for editing. */
35
35
  displayText?: string | null;
36
36
  /** Plugins that provide link suggestions / search capabilities. */
37
- plugins?: [LinkPickerPlugin];
37
+ plugins?: LinkPickerPlugin[];
38
38
  }
39
- export declare type LinkPickerProps = WrappedComponentProps & BaseProps;
40
39
  export interface State {
41
40
  items: LinkSearchListItemData[];
42
41
  selectedIndex: number;
@@ -46,34 +45,7 @@ export interface State {
46
45
  displayText: string;
47
46
  invalidUrl: string | null;
48
47
  }
49
- export declare class LinkPicker extends PureComponent<LinkPickerProps, State> {
50
- private wrapperRef;
51
- private handleClearUrl;
52
- private handleClearDisplayText;
53
- private queryVersion;
54
- constructor(props: LinkPickerProps);
55
- componentDidMount(): void;
56
- private loadInitialLinkSearchResult;
57
- private getActivePlugin;
58
- /**
59
- * Interface between link picker and plugins to update results
60
- */
61
- private updateResults;
62
- private updateInput;
63
- private createClearHandler;
64
- private getScreenReaderText;
65
- render(): JSX.Element;
66
- private isUrlPopulatedWithSelectedItem;
67
- private handleSelected;
68
- private handleInsert;
69
- private handleMouseEnterResultItem;
70
- private handleMouseLeaveResultItem;
71
- private handleSubmit;
72
- private handleKeyDown;
73
- private handleCancel;
74
- private updateTextInput;
75
- }
76
- export declare const LinkPickerWithIntl: React.FC<import("react-intl-next").WithIntlProps<LinkPickerProps>> & {
77
- WrappedComponent: React.ComponentType<LinkPickerProps>;
48
+ export declare const LinkPickerWithIntl: React.FC<import("react-intl-next").WithIntlProps<WrappedComponentProps<"intl"> & LinkPickerProps>> & {
49
+ WrappedComponent: React.ComponentType<WrappedComponentProps<"intl"> & LinkPickerProps>;
78
50
  };
79
51
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/visual-regression": "*",
57
57
  "@atlaskit/webdriver-runner": "*",
58
58
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
59
- "@atlassian/link-picker-atlassian-plugin": "^5.0.0",
59
+ "@atlassian/link-picker-atlassian-plugin": "^6.0.0",
60
60
  "@atlassian/search-provider": "^2.3.0",
61
61
  "@testing-library/react": "^8.0.1",
62
62
  "enzyme": "^3.10.0",