@atlaskit/link-picker 1.1.3 → 1.1.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,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`97cfed0aa0d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/97cfed0aa0d) - Add tests around how the link picker handles editing links
8
+
3
9
  ## 1.1.3
4
10
 
5
11
  ### Patch Changes
@@ -107,6 +107,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
107
107
  id: 'fabric.linkPicker.search.noResults.description',
108
108
  defaultMessage: 'Try again with a different term.',
109
109
  description: 'Describes possible action when a search returns no results'
110
+ },
111
+ saveButton: {
112
+ id: 'fabric.linkPicker.button.save',
113
+ defaultMessage: 'Save',
114
+ description: 'Button to save edited link'
110
115
  }
111
116
  });
112
117
  exports.messages = messages;
@@ -316,6 +316,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
316
316
  selectedIndex: -1,
317
317
  activeIndex: -1,
318
318
  isLoading: false,
319
+ isEditing: !!props.url,
319
320
  url: (0, _url.normalizeUrl)(props.url) || '',
320
321
  displayText: props.displayText || '',
321
322
  items: [],
@@ -473,6 +474,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
473
474
  var _this$state7 = this.state,
474
475
  items = _this$state7.items,
475
476
  isLoading = _this$state7.isLoading,
477
+ isEditing = _this$state7.isEditing,
476
478
  activeIndex = _this$state7.activeIndex,
477
479
  selectedIndex = _this$state7.selectedIndex,
478
480
  url = _this$state7.url,
@@ -584,7 +586,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
584
586
  appearance: "primary",
585
587
  onClick: this.handleSubmit,
586
588
  testId: "link-picker-insert-button"
587
- }, formatMessage(_messages.messages.insertButton))))));
589
+ }, formatMessage(isEditing ? _messages.messages.saveButton : _messages.messages.insertButton))))));
588
590
  }
589
591
  }]);
590
592
  return LinkPicker;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "sideEffects": false
5
5
  }
@@ -99,5 +99,10 @@ export const messages = defineMessages({
99
99
  id: 'fabric.linkPicker.search.noResults.description',
100
100
  defaultMessage: 'Try again with a different term.',
101
101
  description: 'Describes possible action when a search returns no results'
102
+ },
103
+ saveButton: {
104
+ id: 'fabric.linkPicker.button.save',
105
+ defaultMessage: 'Save',
106
+ description: 'Button to save edited link'
102
107
  }
103
108
  });
@@ -265,6 +265,7 @@ class LinkPicker extends PureComponent {
265
265
  selectedIndex: -1,
266
266
  activeIndex: -1,
267
267
  isLoading: false,
268
+ isEditing: !!props.url,
268
269
  url: normalizeUrl(props.url) || '',
269
270
  displayText: props.displayText || '',
270
271
  items: [],
@@ -358,6 +359,7 @@ class LinkPicker extends PureComponent {
358
359
  const {
359
360
  items,
360
361
  isLoading,
362
+ isEditing,
361
363
  activeIndex,
362
364
  selectedIndex,
363
365
  url,
@@ -474,7 +476,7 @@ class LinkPicker extends PureComponent {
474
476
  appearance: "primary",
475
477
  onClick: this.handleSubmit,
476
478
  testId: "link-picker-insert-button"
477
- }, formatMessage(messages.insertButton))))));
479
+ }, formatMessage(isEditing ? messages.saveButton : messages.insertButton))))));
478
480
  }
479
481
 
480
482
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "sideEffects": false
5
5
  }
@@ -99,5 +99,10 @@ export var messages = defineMessages({
99
99
  id: 'fabric.linkPicker.search.noResults.description',
100
100
  defaultMessage: 'Try again with a different term.',
101
101
  description: 'Describes possible action when a search returns no results'
102
+ },
103
+ saveButton: {
104
+ id: 'fabric.linkPicker.button.save',
105
+ defaultMessage: 'Save',
106
+ description: 'Button to save edited link'
102
107
  }
103
108
  });
@@ -294,6 +294,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
294
294
  selectedIndex: -1,
295
295
  activeIndex: -1,
296
296
  isLoading: false,
297
+ isEditing: !!props.url,
297
298
  url: normalizeUrl(props.url) || '',
298
299
  displayText: props.displayText || '',
299
300
  items: [],
@@ -451,6 +452,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
451
452
  var _this$state7 = this.state,
452
453
  items = _this$state7.items,
453
454
  isLoading = _this$state7.isLoading,
455
+ isEditing = _this$state7.isEditing,
454
456
  activeIndex = _this$state7.activeIndex,
455
457
  selectedIndex = _this$state7.selectedIndex,
456
458
  url = _this$state7.url,
@@ -562,7 +564,7 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
562
564
  appearance: "primary",
563
565
  onClick: this.handleSubmit,
564
566
  testId: "link-picker-insert-button"
565
- }, formatMessage(messages.insertButton))))));
567
+ }, formatMessage(isEditing ? messages.saveButton : messages.insertButton))))));
566
568
  }
567
569
  }]);
568
570
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "sideEffects": false
5
5
  }
@@ -99,4 +99,9 @@ export declare const messages: {
99
99
  defaultMessage: string;
100
100
  description: string;
101
101
  };
102
+ saveButton: {
103
+ id: string;
104
+ defaultMessage: string;
105
+ description: string;
106
+ };
102
107
  };
@@ -42,6 +42,7 @@ export interface State {
42
42
  activeIndex: number;
43
43
  url: string;
44
44
  isLoading: boolean;
45
+ isEditing: boolean;
45
46
  displayText: string;
46
47
  invalidUrl: string | null;
47
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
package/report.api.md CHANGED
@@ -10,11 +10,9 @@ import { default as React_2 } from 'react';
10
10
  import { WithIntlProps } from 'react-intl-next';
11
11
  import { WrappedComponentProps } from 'react-intl-next';
12
12
 
13
- // @public (undocumented)
14
- export type LinkInputType = 'manual' | 'typeAhead';
13
+ export declare type LinkInputType = 'manual' | 'typeAhead';
15
14
 
16
- // @public (undocumented)
17
- export const LinkPicker: React_2.FC<
15
+ export declare const LinkPicker: React_2.FC<
18
16
  WithIntlProps<WrappedComponentProps<'intl'> & LinkPickerProps>
19
17
  > & {
20
18
  WrappedComponent: React_2.ComponentType<
@@ -22,44 +20,81 @@ export const LinkPicker: React_2.FC<
22
20
  >;
23
21
  };
24
22
 
25
- // @public (undocumented)
26
- export interface LinkPickerPlugin {
27
- // (undocumented)
23
+ export declare interface LinkPickerPlugin {
28
24
  resolve: (
29
25
  state: LinkPickerState,
30
26
  ) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
31
27
  }
32
28
 
33
- // @public (undocumented)
34
- export interface LinkPickerProps {
35
- displayText?: string | null;
36
- onCancel: () => void;
29
+ export declare interface LinkPickerProps {
30
+ /** Callback to fire on form submission. */
37
31
  onSubmit: (arg: OnSubmitParameter) => void;
38
- plugins?: LinkPickerPlugin[];
32
+ /** Callback to fire when the cancel button is clicked. */
33
+ onCancel: () => void;
34
+ /** The url of the linked resource for editing. */
39
35
  url?: string;
36
+ /** The desired text to be displayed alternatively to the title of the linked resource for editing. */
37
+ displayText?: string | null;
38
+ /** Plugins that provide link suggestions / search capabilities. */
39
+ plugins?: LinkPickerPlugin[];
40
40
  }
41
41
 
42
- // @public (undocumented)
43
- export interface LinkPickerState {
42
+ export declare interface LinkPickerState {
43
+ /** Current query string / URL input field value */
44
44
  query: string;
45
45
  }
46
46
 
47
- // @public (undocumented)
48
- export interface LinkSearchListItemData {
49
- container?: string;
47
+ export declare interface LinkSearchListItemData {
48
+ /** Unique identifiable attribute for the item */
49
+ objectId: string;
50
+ /** Name / title / display text of the link */
51
+ name: string;
52
+ /** URL of the resource being linked to */
53
+ url: string;
54
+ /** Icon to display in link result */
50
55
  icon:
51
56
  | string
52
57
  | React.ComponentType<{
53
58
  alt: string;
54
59
  }>;
60
+ /** Alt text describing the icon */
55
61
  iconAlt: string | MessageDescriptor;
56
- lastUpdatedDate?: Date;
62
+ /** Context to display in link result */
63
+ container?: string;
64
+ /** Optional last view date to display in link result */
57
65
  lastViewedDate?: Date;
58
- name: string;
59
- objectId: string;
66
+ /** Optional last updated date to display in link result */
67
+ lastUpdatedDate?: Date;
68
+ /** Whether the result is pre-fetched from activity provider */
60
69
  prefetch?: boolean;
70
+ }
71
+
72
+ declare interface Meta {
73
+ /** Indicates how the link was picked. */
74
+ inputMethod: LinkInputType;
75
+ }
76
+
77
+ declare interface OnSubmitParameter {
78
+ /** The `url` of the linked resource. */
61
79
  url: string;
80
+ /** The desired text to be displayed alternatively to the title of the linked resource. */
81
+ displayText: string | null;
82
+ /** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
83
+ title: string | null;
84
+ /** Meta data about the link picking submission. */
85
+ meta: Meta;
86
+ /**
87
+ * The input value of the `url` field at time of submission if inserted "manually".
88
+ * This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
89
+ * @example
90
+ * { url: 'https://google.com', rawUrl: 'google.com' }
91
+ */
92
+ rawUrl?: string;
93
+ }
94
+
95
+ declare interface ResolveResult {
96
+ data: LinkSearchListItemData[];
62
97
  }
63
98
 
64
- // (No @packageDocumentation comment for this package)
99
+ export {};
65
100
  ```