@atlaskit/link-picker 1.10.2 → 1.10.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 (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/common/analytics/experiences.js +62 -0
  3. package/dist/cjs/controllers/session-provider/index.js +61 -0
  4. package/dist/cjs/ui/error-boundary/error-boundary-base/index.js +76 -0
  5. package/dist/cjs/ui/{error-boundary-fallback → error-boundary/error-boundary-fallback}/index.js +2 -2
  6. package/dist/cjs/ui/error-boundary/index.js +33 -81
  7. package/dist/cjs/ui/index.js +6 -9
  8. package/dist/cjs/ui/link-picker/index.js +15 -7
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/common/analytics/experiences.js +39 -0
  11. package/dist/es2019/controllers/session-provider/index.js +32 -0
  12. package/dist/es2019/ui/error-boundary/error-boundary-base/index.js +37 -0
  13. package/dist/es2019/ui/{error-boundary-fallback → error-boundary/error-boundary-fallback}/index.js +2 -2
  14. package/dist/es2019/ui/error-boundary/index.js +30 -59
  15. package/dist/es2019/ui/index.js +5 -8
  16. package/dist/es2019/ui/link-picker/index.js +13 -7
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/common/analytics/experiences.js +40 -0
  19. package/dist/esm/controllers/session-provider/index.js +38 -0
  20. package/dist/esm/ui/error-boundary/error-boundary-base/index.js +56 -0
  21. package/dist/esm/ui/{error-boundary-fallback → error-boundary/error-boundary-fallback}/index.js +2 -2
  22. package/dist/esm/ui/error-boundary/index.js +30 -79
  23. package/dist/esm/ui/index.js +5 -8
  24. package/dist/esm/ui/link-picker/index.js +13 -7
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/common/analytics/experiences.d.ts +11 -0
  27. package/dist/types/controllers/session-provider/index.d.ts +10 -0
  28. package/dist/types/ui/error-boundary/error-boundary-base/index.d.ts +18 -0
  29. package/dist/types/ui/error-boundary/error-boundary-fallback/index.d.ts +3 -0
  30. package/dist/types/ui/error-boundary/index.d.ts +4 -24
  31. package/dist/types-ts4.0/analytics.codegen.d.ts +52 -0
  32. package/dist/types-ts4.0/common/analytics/context.d.ts +28 -0
  33. package/dist/types-ts4.0/common/analytics/experiences.d.ts +11 -0
  34. package/dist/types-ts4.0/common/analytics/index.d.ts +2 -0
  35. package/dist/types-ts4.0/common/analytics/input-field-tracking.d.ts +17 -0
  36. package/dist/types-ts4.0/common/constants.d.ts +2 -0
  37. package/dist/types-ts4.0/common/generic-error-svg/index.d.ts +4 -0
  38. package/dist/types-ts4.0/common/generic-error-svg/styled.d.ts +1 -0
  39. package/dist/types-ts4.0/common/utils/url.d.ts +5 -0
  40. package/dist/types-ts4.0/controllers/session-provider/index.d.ts +10 -0
  41. package/dist/types-ts4.0/controllers/use-fix-height/index.d.ts +8 -0
  42. package/dist/types-ts4.0/index.d.ts +3 -0
  43. package/dist/types-ts4.0/services/use-plugins/index.d.ts +14 -0
  44. package/dist/types-ts4.0/services/use-plugins/reducer.d.ts +33 -0
  45. package/dist/types-ts4.0/services/use-plugins/utils.d.ts +18 -0
  46. package/dist/types-ts4.0/services/use-search-query/index.d.ts +3 -0
  47. package/dist/types-ts4.0/ui/error-boundary/error-boundary-base/index.d.ts +18 -0
  48. package/dist/{types/ui → types-ts4.0/ui/error-boundary}/error-boundary-fallback/index.d.ts +0 -0
  49. package/dist/types-ts4.0/ui/error-boundary/index.d.ts +7 -0
  50. package/dist/types-ts4.0/ui/index.d.ts +5 -0
  51. package/dist/types-ts4.0/ui/link-picker/announcer.d.ts +22 -0
  52. package/dist/types-ts4.0/ui/link-picker/browser.d.ts +15 -0
  53. package/dist/types-ts4.0/ui/link-picker/form-footer/index.d.ts +13 -0
  54. package/dist/types-ts4.0/ui/link-picker/form-footer/styled.d.ts +1 -0
  55. package/dist/types-ts4.0/ui/link-picker/index.d.ts +69 -0
  56. package/dist/types-ts4.0/ui/link-picker/link-search-error/index.d.ts +20 -0
  57. package/dist/types-ts4.0/ui/link-picker/link-search-list/index.d.ts +43 -0
  58. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/index.d.ts +19 -0
  59. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/index.d.ts +4 -0
  60. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/no-results-svg/styled.d.ts +1 -0
  61. package/dist/types-ts4.0/ui/link-picker/link-search-list/link-search-no-results/styled.d.ts +1 -0
  62. package/dist/types-ts4.0/ui/link-picker/link-search-list/styled.d.ts +4 -0
  63. package/dist/types-ts4.0/ui/link-picker/list-item/index.d.ts +17 -0
  64. package/dist/types-ts4.0/ui/link-picker/list-item/styled.d.ts +9 -0
  65. package/dist/types-ts4.0/ui/link-picker/messages.d.ts +85 -0
  66. package/dist/types-ts4.0/ui/link-picker/styled.d.ts +9 -0
  67. package/dist/types-ts4.0/ui/link-picker/text-input/index.d.ts +14 -0
  68. package/dist/types-ts4.0/ui/link-picker/text-input/styled.d.ts +2 -0
  69. package/dist/types-ts4.0/ui/link-picker/transformTimeStamp.d.ts +3 -0
  70. package/dist/types-ts4.0/ui/link-picker/utils.d.ts +10 -0
  71. package/dist/types-ts4.0/ui/loader-fallback/index.d.ts +3 -0
  72. package/dist/types-ts4.0/ui/types.d.ts +57 -0
  73. package/package.json +15 -5
  74. package/report.api.md +45 -65
@@ -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,3 @@
1
+ import { IntlShape } from 'react-intl-next';
2
+ import { ListItemTimeStamp } from '../types';
3
+ export declare const transformTimeStamp: (intl: IntlShape, lastViewedDate?: Date | undefined, lastUpdatedDate?: Date | undefined) => ListItemTimeStamp | undefined;
@@ -0,0 +1,10 @@
1
+ import { KeyboardEvent } from 'react';
2
+ import { IntlShape } from 'react-intl-next';
3
+ import { LinkPickerPlugin, LinkSearchListItemData } from '../types';
4
+ export declare const isUndoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
5
+ export declare const isRedoEvent: (e: KeyboardEvent<HTMLInputElement>) => boolean;
6
+ /**
7
+ * Retrieve the data source for a link given the item and the plugin that resolved it
8
+ */
9
+ export declare const getDataSource: (item: LinkSearchListItemData, plugin?: LinkPickerPlugin | undefined) => string;
10
+ export declare function getScreenReaderText(items: LinkSearchListItemData[], selectedIndex: number, intl: IntlShape): string | undefined;
@@ -0,0 +1,3 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ export declare const LoaderFallback: jsx.JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { ReactNode } from 'react';
2
+ import { MessageDescriptor } from 'react-intl-next';
3
+ export declare type LinkInputType = 'manual' | 'typeAhead';
4
+ export interface LinkSearchListItemData {
5
+ /** Unique identifiable attribute for the item */
6
+ objectId: string;
7
+ /** Name / title / display text of the link */
8
+ name: string;
9
+ /** URL of the resource being linked to */
10
+ url: string;
11
+ /** Icon to display in link result */
12
+ icon: string | React.ComponentType<{
13
+ alt: string;
14
+ }>;
15
+ /** Alt text describing the icon */
16
+ iconAlt: string | MessageDescriptor;
17
+ /** Context to display in link result */
18
+ container?: string;
19
+ /** Optional last view date to display in link result */
20
+ lastViewedDate?: Date;
21
+ /** Optional last updated date to display in link result */
22
+ lastUpdatedDate?: Date;
23
+ /** Whether the result is pre-fetched from activity provider */
24
+ prefetch?: boolean;
25
+ /** Metadata about the result */
26
+ meta?: {
27
+ /** The data source that provided the result */
28
+ source?: string;
29
+ };
30
+ }
31
+ export declare type ListItemTimeStamp = {
32
+ pageAction: string;
33
+ dateString: string;
34
+ timeSince?: string | undefined;
35
+ };
36
+ export interface LinkPickerState {
37
+ /** Current query string / URL input field value */
38
+ query: string;
39
+ }
40
+ export interface ResolveResult {
41
+ data: LinkSearchListItemData[];
42
+ }
43
+ export interface LinkPickerPlugin {
44
+ resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
45
+ /** Uniquely identify the tab */
46
+ tabKey?: string;
47
+ /** Human-readable label for the plugin */
48
+ tabTitle?: string;
49
+ /** Render function to customise the UI that is displayed when an error occurs resolving results */
50
+ errorFallback?: LinkPickerPluginErrorFallback;
51
+ /** Metadata about the plugin */
52
+ meta?: {
53
+ /** The data source that provides all results provided by the plugin */
54
+ source?: string;
55
+ };
56
+ }
57
+ export declare type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.10.2",
3
+ "version": "1.10.4",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -20,6 +20,13 @@
20
20
  "module": "dist/esm/index.js",
21
21
  "module:es2019": "dist/es2019/index.js",
22
22
  "types": "dist/types/index.d.ts",
23
+ "typesVersions": {
24
+ ">=4.0 <4.5": {
25
+ "*": [
26
+ "dist/types-ts4.0/*"
27
+ ]
28
+ }
29
+ },
23
30
  "sideEffects": false,
24
31
  "atlaskit:src": "src/index.ts",
25
32
  "af:exports": {
@@ -42,12 +49,14 @@
42
49
  "@atlaskit/theme": "^12.2.0",
43
50
  "@atlaskit/tokens": "^0.10.0",
44
51
  "@atlaskit/tooltip": "^17.5.0",
52
+ "@atlaskit/ufo": "^0.1.0",
45
53
  "@atlaskit/visually-hidden": "^1.1.0",
46
54
  "@babel/runtime": "^7.0.0",
47
55
  "@emotion/react": "^11.7.1",
48
56
  "date-fns": "^2.17.0",
49
57
  "linkify-it": "^2.0.3",
50
- "react-loosely-lazy": "^0.5.0"
58
+ "react-loosely-lazy": "^0.5.0",
59
+ "uuid": "^3.1.0"
51
60
  },
52
61
  "peerDependencies": {
53
62
  "react": "^16.8.0",
@@ -72,18 +81,19 @@
72
81
  "@testing-library/dom": "^8.17.1",
73
82
  "@testing-library/jest-dom": "^5.16.5",
74
83
  "@testing-library/react": "^12.1.5",
75
- "@testing-library/react-hooks": "^1.1.0",
76
- "@testing-library/user-event": "^13.5.0",
84
+ "@testing-library/react-hooks": "^8.0.1",
85
+ "@testing-library/user-event": "^14.4.3",
77
86
  "@types/js-yaml": "^3.12.5",
78
87
  "enzyme": "^3.10.0",
79
88
  "fetch-mock": "^8.0.0",
89
+ "jest-extended": "^0.11.2",
80
90
  "js-yaml": "^3.13.1",
81
91
  "lodash": "^4.17.21",
82
92
  "mockdate": "^3.0.2",
83
93
  "prettier": "^2.1.1",
84
94
  "react-dom": "^16.8.0",
85
95
  "sinon": "^2.2.0",
86
- "typescript": "4.3.5"
96
+ "typescript": "4.5.5"
87
97
  },
88
98
  "techstack": {
89
99
  "@repo/internal": {
package/report.api.md CHANGED
@@ -1,6 +1,10 @@
1
- ## API Report File for "@atlaskit/link-picker".
1
+ ## API Report File for "@atlaskit/link-picker"
2
2
 
3
- > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
4
8
 
5
9
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
10
 
@@ -12,115 +16,91 @@ import { default as React_2 } from 'react';
12
16
  import { ReactNode } from 'react';
13
17
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
14
18
 
15
- export declare type LinkInputType = 'manual' | 'typeAhead';
19
+ // @public (undocumented)
20
+ export type LinkInputType = 'manual' | 'typeAhead';
16
21
 
17
- export declare const LinkPicker: React_2.MemoExoticComponent<(
22
+ // @public (undocumented)
23
+ export const LinkPicker: React_2.MemoExoticComponent<(
18
24
  props: LinkPickerProps,
19
25
  ) => JSX.Element>;
20
26
 
21
- export declare interface LinkPickerPlugin {
27
+ // @public (undocumented)
28
+ export interface LinkPickerPlugin {
29
+ errorFallback?: LinkPickerPluginErrorFallback;
30
+ meta?: {
31
+ source?: string;
32
+ };
33
+ // (undocumented)
22
34
  resolve: (
23
35
  state: LinkPickerState,
24
36
  ) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
25
- /** Uniquely identify the tab */
26
37
  tabKey?: string;
27
- /** Human-readable label for the plugin */
28
38
  tabTitle?: string;
29
- /** Render function to customise the UI that is displayed when an error occurs resolving results */
30
- errorFallback?: LinkPickerPluginErrorFallback;
31
- /** Metadata about the plugin */
32
- meta?: {
33
- /** The data source that provides all results provided by the plugin */
34
- source?: string;
35
- };
36
39
  }
37
40
 
38
- export declare type LinkPickerPluginErrorFallback = (
41
+ // @public (undocumented)
42
+ export type LinkPickerPluginErrorFallback = (
39
43
  error: unknown,
40
44
  retry: () => void,
41
45
  ) => ReactNode;
42
46
 
43
- export declare interface LinkPickerProps {
44
- /**
45
- * Callback to fire on form submission.
46
- */
47
+ // @public (undocumented)
48
+ export interface LinkPickerProps {
49
+ displayText?: string | null;
50
+ onCancel: () => void;
51
+ onContentResize?: () => void;
47
52
  onSubmit: (
48
53
  arg: OnSubmitParameter,
49
54
  analytic?: UIAnalyticsEvent | null,
50
55
  ) => void;
51
- /** Callback to fire when the cancel button is clicked. */
52
- onCancel: () => void;
53
- /** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
54
- onContentResize?: () => void;
55
- /** The url of the linked resource for editing. */
56
- url?: string;
57
- /** The desired text to be displayed alternatively to the title of the linked resource for editing. */
58
- displayText?: string | null;
59
- /** Plugins that provide link suggestions / search capabilities. */
60
56
  plugins?: LinkPickerPlugin[];
57
+ url?: string;
61
58
  }
62
59
 
63
- export declare interface LinkPickerState {
64
- /** Current query string / URL input field value */
60
+ // @public (undocumented)
61
+ export interface LinkPickerState {
65
62
  query: string;
66
63
  }
67
64
 
68
- export declare interface LinkSearchListItemData {
69
- /** Unique identifiable attribute for the item */
70
- objectId: string;
71
- /** Name / title / display text of the link */
72
- name: string;
73
- /** URL of the resource being linked to */
74
- url: string;
75
- /** Icon to display in link result */
65
+ // @public (undocumented)
66
+ export interface LinkSearchListItemData {
67
+ container?: string;
76
68
  icon:
77
69
  | string
78
70
  | React.ComponentType<{
79
71
  alt: string;
80
72
  }>;
81
- /** Alt text describing the icon */
82
73
  iconAlt: string | MessageDescriptor;
83
- /** Context to display in link result */
84
- container?: string;
85
- /** Optional last view date to display in link result */
86
- lastViewedDate?: Date;
87
- /** Optional last updated date to display in link result */
88
74
  lastUpdatedDate?: Date;
89
- /** Whether the result is pre-fetched from activity provider */
90
- prefetch?: boolean;
91
- /** Metadata about the result */
75
+ lastViewedDate?: Date;
92
76
  meta?: {
93
- /** The data source that provided the result */
94
77
  source?: string;
95
78
  };
79
+ name: string;
80
+ objectId: string;
81
+ prefetch?: boolean;
82
+ url: string;
96
83
  }
97
84
 
98
- declare interface Meta {
99
- /** Indicates how the link was picked. */
85
+ // @public (undocumented)
86
+ interface Meta {
100
87
  inputMethod: LinkInputType;
101
88
  }
102
89
 
103
- declare interface OnSubmitParameter {
104
- /** The `url` of the linked resource. */
105
- url: string;
106
- /** The desired text to be displayed alternatively to the title of the linked resource. */
90
+ // @public (undocumented)
91
+ interface OnSubmitParameter {
107
92
  displayText: string | null;
108
- /** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
109
- title: string | null;
110
- /** Meta data about the link picking submission. */
111
93
  meta: Meta;
112
- /**
113
- * The input value of the `url` field at time of submission if inserted "manually".
114
- * This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
115
- * @example
116
- * { url: 'https://google.com', rawUrl: 'google.com' }
117
- */
118
94
  rawUrl?: string;
95
+ title: string | null;
96
+ url: string;
119
97
  }
120
98
 
121
- declare interface ResolveResult {
99
+ // @public (undocumented)
100
+ interface ResolveResult {
101
+ // (undocumented)
122
102
  data: LinkSearchListItemData[];
123
103
  }
124
104
 
125
- export {};
105
+ // (No @packageDocumentation comment for this package)
126
106
  ```