@atlaskit/link-picker 1.1.1 → 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.
Files changed (86) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/browser.js +39 -0
  3. package/dist/cjs/index.js +13 -0
  4. package/dist/cjs/messages.js +117 -0
  5. package/dist/cjs/transformTimeStamp.js +55 -0
  6. package/dist/cjs/types.js +5 -0
  7. package/dist/cjs/ui/announcer.js +64 -0
  8. package/dist/cjs/ui/link-picker.js +613 -0
  9. package/dist/cjs/ui/link-search-list/index.js +102 -0
  10. package/dist/cjs/ui/link-search-list/styled.js +21 -0
  11. package/dist/cjs/ui/link-search-no-results/index.js +27 -0
  12. package/dist/cjs/ui/link-search-no-results/no-results-svg/index.js +69 -0
  13. package/dist/cjs/ui/link-search-no-results/no-results-svg/styled.js +20 -0
  14. package/dist/cjs/ui/list-item/index.js +103 -0
  15. package/dist/cjs/ui/list-item/styled.js +59 -0
  16. package/dist/cjs/ui/styled.js +32 -0
  17. package/dist/cjs/ui/text-input/index.js +116 -0
  18. package/dist/cjs/ui/text-input/styled.js +25 -0
  19. package/dist/cjs/url.js +104 -0
  20. package/dist/cjs/utils.js +27 -0
  21. package/dist/cjs/version.json +5 -0
  22. package/dist/es2019/browser.js +34 -0
  23. package/dist/es2019/index.js +1 -0
  24. package/dist/es2019/messages.js +108 -0
  25. package/dist/es2019/transformTimeStamp.js +41 -0
  26. package/dist/es2019/types.js +1 -0
  27. package/dist/es2019/ui/announcer.js +38 -0
  28. package/dist/es2019/ui/link-picker.js +501 -0
  29. package/dist/es2019/ui/link-search-list/index.js +60 -0
  30. package/dist/es2019/ui/link-search-list/styled.js +13 -0
  31. package/dist/es2019/ui/link-search-no-results/index.js +10 -0
  32. package/dist/es2019/ui/link-search-no-results/no-results-svg/index.js +60 -0
  33. package/dist/es2019/ui/link-search-no-results/no-results-svg/styled.js +8 -0
  34. package/dist/es2019/ui/list-item/index.js +88 -0
  35. package/dist/es2019/ui/list-item/styled.js +65 -0
  36. package/dist/es2019/ui/styled.js +28 -0
  37. package/dist/es2019/ui/text-input/index.js +99 -0
  38. package/dist/es2019/ui/text-input/styled.js +15 -0
  39. package/dist/es2019/url.js +88 -0
  40. package/dist/es2019/utils.js +13 -0
  41. package/dist/es2019/version.json +5 -0
  42. package/dist/esm/browser.js +34 -0
  43. package/dist/esm/index.js +1 -0
  44. package/dist/esm/messages.js +108 -0
  45. package/dist/esm/transformTimeStamp.js +41 -0
  46. package/dist/esm/types.js +1 -0
  47. package/dist/esm/ui/announcer.js +51 -0
  48. package/dist/esm/ui/link-picker.js +591 -0
  49. package/dist/esm/ui/link-search-list/index.js +88 -0
  50. package/dist/esm/ui/link-search-list/styled.js +8 -0
  51. package/dist/esm/ui/link-search-no-results/index.js +14 -0
  52. package/dist/esm/ui/link-search-no-results/no-results-svg/index.js +60 -0
  53. package/dist/esm/ui/link-search-no-results/no-results-svg/styled.js +8 -0
  54. package/dist/esm/ui/list-item/index.js +90 -0
  55. package/dist/esm/ui/list-item/styled.js +37 -0
  56. package/dist/esm/ui/styled.js +16 -0
  57. package/dist/esm/ui/text-input/index.js +99 -0
  58. package/dist/esm/ui/text-input/styled.js +10 -0
  59. package/dist/esm/url.js +90 -0
  60. package/dist/esm/utils.js +13 -0
  61. package/dist/esm/version.json +5 -0
  62. package/dist/types/browser.d.ts +15 -0
  63. package/dist/types/index.d.ts +3 -0
  64. package/dist/types/messages.d.ts +107 -0
  65. package/dist/types/transformTimeStamp.d.ts +3 -0
  66. package/dist/types/types.d.ts +40 -0
  67. package/dist/types/ui/announcer.d.ts +22 -0
  68. package/dist/types/ui/link-picker.d.ts +52 -0
  69. package/dist/types/ui/link-search-list/index.d.ts +20 -0
  70. package/dist/types/ui/link-search-list/styled.d.ts +3 -0
  71. package/dist/types/ui/link-search-no-results/index.d.ts +4 -0
  72. package/dist/types/ui/link-search-no-results/no-results-svg/index.d.ts +4 -0
  73. package/dist/types/ui/link-search-no-results/no-results-svg/styled.d.ts +1 -0
  74. package/dist/types/ui/list-item/index.d.ts +17 -0
  75. package/dist/types/ui/list-item/styled.d.ts +7 -0
  76. package/dist/types/ui/styled.d.ts +4 -0
  77. package/dist/types/ui/text-input/index.d.ts +17 -0
  78. package/dist/types/ui/text-input/styled.d.ts +2 -0
  79. package/dist/types/url.d.ts +5 -0
  80. package/dist/types/utils.d.ts +3 -0
  81. package/package.json +1 -2
  82. package/report.api.md +56 -21
  83. package/example-helpers/flight-deck/_manifest.json +0 -9
  84. package/example-helpers/flight-deck/mockFDResponse.json +0 -133
  85. package/example-helpers/mock-data.ts +0 -318
  86. package/example-helpers/providers.ts +0 -39
@@ -0,0 +1,52 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { WrappedComponentProps } from 'react-intl-next';
4
+ import { LinkSearchListItemData, LinkInputType, LinkPickerPlugin } from '../types';
5
+ export declare const RECENT_SEARCH_LIST_SIZE = 5;
6
+ interface Meta {
7
+ /** Indicates how the link was picked. */
8
+ inputMethod: LinkInputType;
9
+ }
10
+ interface OnSubmitParameter {
11
+ /** The `url` of the linked resource. */
12
+ url: string;
13
+ /** The desired text to be displayed alternatively to the title of the linked resource. */
14
+ displayText: string | null;
15
+ /** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
16
+ title: string | null;
17
+ /** Meta data about the link picking submission. */
18
+ meta: Meta;
19
+ /**
20
+ * The input value of the `url` field at time of submission if inserted "manually".
21
+ * This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
22
+ * @example
23
+ * { url: 'https://google.com', rawUrl: 'google.com' }
24
+ */
25
+ rawUrl?: string;
26
+ }
27
+ export interface LinkPickerProps {
28
+ /** Callback to fire on form submission. */
29
+ onSubmit: (arg: OnSubmitParameter) => void;
30
+ /** Callback to fire when the cancel button is clicked. */
31
+ onCancel: () => void;
32
+ /** The url of the linked resource for editing. */
33
+ url?: string;
34
+ /** The desired text to be displayed alternatively to the title of the linked resource for editing. */
35
+ displayText?: string | null;
36
+ /** Plugins that provide link suggestions / search capabilities. */
37
+ plugins?: LinkPickerPlugin[];
38
+ }
39
+ export interface State {
40
+ items: LinkSearchListItemData[];
41
+ selectedIndex: number;
42
+ activeIndex: number;
43
+ url: string;
44
+ isLoading: boolean;
45
+ isEditing: boolean;
46
+ displayText: string;
47
+ invalidUrl: string | null;
48
+ }
49
+ export declare const LinkPickerWithIntl: React.FC<import("react-intl-next").WithIntlProps<WrappedComponentProps<"intl"> & LinkPickerProps>> & {
50
+ WrappedComponent: React.ComponentType<WrappedComponentProps<"intl"> & LinkPickerProps>;
51
+ };
52
+ export {};
@@ -0,0 +1,20 @@
1
+ /** @jsx jsx */
2
+ import { PureComponent } from 'react';
3
+ import { jsx } from '@emotion/react';
4
+ import { LinkSearchListItemData } from '../../types';
5
+ export interface Props {
6
+ items?: LinkSearchListItemData[];
7
+ isLoading: boolean;
8
+ selectedIndex: number;
9
+ activeIndex: number;
10
+ onSelect: (objectId: string) => void;
11
+ onMouseEnter: (objectId: string) => void;
12
+ onMouseLeave: (objectId: string) => void;
13
+ ariaControls?: string;
14
+ ariaLabelledBy?: string;
15
+ role?: string;
16
+ id?: string;
17
+ }
18
+ export default class LinkSearchList extends PureComponent<Props, {}> {
19
+ render(): jsx.JSX.Element;
20
+ }
@@ -0,0 +1,3 @@
1
+ export declare const listContainerStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const spinnerContainerStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const listStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { EmptyStateProps } from '@atlaskit/empty-state';
3
+ declare const NoResults: (props: EmptyStateProps) => JSX.Element;
4
+ export default NoResults;
@@ -0,0 +1,4 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ declare const NoResultsSVG: () => jsx.JSX.Element;
4
+ export default NoResultsSVG;
@@ -0,0 +1 @@
1
+ export declare const noResultsSVGStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { WrappedComponentProps } from 'react-intl-next';
3
+ import { LinkSearchListItemData } from '../../types';
4
+ export interface Props {
5
+ item: LinkSearchListItemData;
6
+ selected: boolean;
7
+ active: boolean;
8
+ onSelect: (objectId: string) => void;
9
+ onMouseEnter: (objectId: string) => void;
10
+ onMouseLeave: (objectId: string) => void;
11
+ id?: string;
12
+ role?: string;
13
+ }
14
+ declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<WrappedComponentProps<"intl"> & Props>> & {
15
+ WrappedComponent: import("react").ComponentType<WrappedComponentProps<"intl"> & Props>;
16
+ };
17
+ export default _default;
@@ -0,0 +1,7 @@
1
+ export declare const relativeFontSizeToBase16: (px: number | string) => string;
2
+ export declare const composeListItemStyles: (active?: boolean, selected?: boolean) => import("@emotion/react").SerializedStyles;
3
+ export declare const itemNameStyles: import("@emotion/react").SerializedStyles;
4
+ export declare const listItemNameStyles: import("@emotion/react").SerializedStyles;
5
+ export declare const listItemContextStyles: import("@emotion/react").SerializedStyles;
6
+ export declare const itemIconStyles: import("@emotion/react").SerializedStyles;
7
+ export declare const imgStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,4 @@
1
+ export declare const recentListStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const containerStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const searchIconStyles: import("@emotion/react").SerializedStyles;
4
+ export declare const listTitleStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,17 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { TextFieldProps } from '@atlaskit/textfield';
3
+ export interface Props extends Omit<TextFieldProps, 'value' | 'onChange' | 'autoFocus' | 'onSubmit'> {
4
+ name: string;
5
+ label?: string;
6
+ autoFocus?: boolean;
7
+ value: string;
8
+ onChange: (value: string) => void;
9
+ onSubmit?: (value: string) => void;
10
+ onUndo?: Function;
11
+ onRedo?: Function;
12
+ onClear?: () => void;
13
+ clearLabel?: string;
14
+ error?: string | null;
15
+ }
16
+ declare const PanelTextInput: (props: Props) => jsx.JSX.Element;
17
+ export default PanelTextInput;
@@ -0,0 +1,2 @@
1
+ export declare const clearTextButtonStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const fieldStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,5 @@
1
+ export declare const isSafeUrl: (url: string) => boolean;
2
+ /**
3
+ * Adds protocol to url if needed.
4
+ */
5
+ export declare function normalizeUrl(url?: string | null): string | null;
@@ -0,0 +1,3 @@
1
+ import { KeyboardEvent } from 'react';
2
+ export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
3
+ export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.1.1",
3
+ "version": "1.1.4",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -50,7 +50,6 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@atlaskit/activity-provider": "^2.3.2",
53
- "@atlaskit/button": "^16.3.0",
54
53
  "@atlaskit/docs": "*",
55
54
  "@atlaskit/link-test-helpers": "^1.1.0",
56
55
  "@atlaskit/popup": "^1.3.5",
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
  ```
@@ -1,9 +0,0 @@
1
- {
2
- "name": "recent-work-service",
3
- "publishMetadata": {
4
- "metricTags": {}
5
- },
6
- "dimensions": {},
7
- "tagScheme": "v001-n_$name$",
8
- "frontend": true
9
- }
@@ -1,133 +0,0 @@
1
- {
2
- "hydrators": {
3
- "TownsquareGoal": {
4
- "hydratorPaths": {
5
- "id": [
6
- "id"
7
- ],
8
- "key": [
9
- "key"
10
- ],
11
- "name": [
12
- "name"
13
- ],
14
- "url": [
15
- "url"
16
- ],
17
- "icon": [
18
- "iconData"
19
- ]
20
- }
21
- },
22
- "TownsquareProject": {
23
- "hydratorPaths": {
24
- "id": [
25
- "id"
26
- ],
27
- "key": [
28
- "key"
29
- ],
30
- "name": [
31
- "name"
32
- ],
33
- "url": [
34
- "url"
35
- ],
36
- "icon": [
37
- "iconData"
38
- ]
39
- }
40
- },
41
- "TownsquareComment": {
42
- "hydratorPaths": {
43
- "id": [
44
- "id"
45
- ],
46
- "name": [
47
- "object.name"
48
- ],
49
- "url": [
50
- "object.url"
51
- ],
52
- "icon": [
53
- "object.iconData"
54
- ]
55
- }
56
- },
57
- "ConfluencePage": {
58
- "hydratorPaths": {
59
- "id": [
60
- "id"
61
- ],
62
- "name": [
63
- "title"
64
- ],
65
- "localResourceId": [
66
- "pageId"
67
- ],
68
- "url": [
69
- "links.base",
70
- "links.webUi"
71
- ],
72
- "containers": [
73
- "space.name"
74
- ],
75
- "icon": [
76
- "metadata.titleEmojiDraft",
77
- "metadata.titleEmojiPublished"
78
- ]
79
- },
80
- "staticFallbacks": {
81
- "icon": "https://home-static.us-east-1.staging.public.atl-paas.net/confluence-page-icon.svg"
82
- }
83
- },
84
- "ConfluenceBlogPost": {
85
- "hydratorPaths": {
86
- "id": [
87
- "id"
88
- ],
89
- "name": [
90
- "title"
91
- ],
92
- "localResourceId": [
93
- "blogPostId"
94
- ],
95
- "url": [
96
- "links.base",
97
- "links.webUi"
98
- ],
99
- "containers": [
100
- "space.name"
101
- ],
102
- "icon": [
103
- "metadata.titleEmojiDraft",
104
- "metadata.titleEmojiPublished"
105
- ]
106
- },
107
- "staticFallbacks": {
108
- "icon": "https://home-static.us-east-1.prod.public.atl-paas.net/confluence-blogpost-icon.svg"
109
- }
110
- },
111
- "ConfluenceComment": {
112
- "hydratorPaths": {
113
- "id": [
114
- "id"
115
- ],
116
- "name": [
117
- "container.title"
118
- ],
119
- "url": [
120
- "links.base",
121
- "links.webUi"
122
- ],
123
- "containers": [
124
- "container.space.name"
125
- ]
126
- },
127
- "staticFallbacks": {
128
- "icon": "https://home-static.us-east-1.staging.public.atl-paas.net/confluence-page-icon.svg"
129
- }
130
- }
131
- },
132
- "queryFragments": "\n\n fragment townsquareGoal on TownsquareGoal {\n id\n key\n name\n url\n iconData\n }\n\n\n fragment townsquareProject on TownsquareProject {\n id\n key\n name\n url\n iconData\n }\n\n\n fragment townsquareComment on TownsquareComment {\n id\n url\n object {\n name\n iconData\n url\n }\n }\n\n\n fragment confluencePage on ConfluencePage {\n id\n title\n pageId\n links {\n base\n webUi\n }\n space {\n name\n }\n }\n\n\n fragment confluenceBlogPost on ConfluenceBlogPost {\n id\n title\n blogPostId\n links {\n base\n webUi\n }\n space {\n name\n }\n }\n\n\n fragment confluenceComment on ConfluenceComment {\n id\n links {\n base\n webUi\n }\n container {\n __typename\n ...confluenceBlogPost\n ...confluencePage\n }\n }\n\nfragment activityItemEdge on ActivityItemEdge {\n cursor\n node {\n id\n object {\n id\n type\n product\n rootContainerId\n contributors {\n profile {\n name\n picture\n accountId\n }\n }\n data {\n __typename\n\t...townsquareGoal\n\t...townsquareProject\n\t...townsquareComment\n\t...confluencePage\n\t...confluenceBlogPost\n\t...confluenceComment\n }\n }\n event {\n id\n timestamp\n eventType\n }\n }\n}\nfragment activityItemConnection on ActivityConnection {\n edges {\n ...activityItemEdge\n }\n}\n\n"
133
- }