@atlaskit/link-picker 1.6.1 → 1.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/analytics.codegen.js +28 -0
  3. package/dist/cjs/common/constants.js +10 -0
  4. package/dist/cjs/{ui/error-boundary-fallback → common}/generic-error-svg/index.js +0 -0
  5. package/dist/cjs/{ui/error-boundary-fallback → common}/generic-error-svg/styled.js +0 -0
  6. package/dist/cjs/services/use-plugins/index.js +32 -35
  7. package/dist/cjs/services/use-search-query/index.js +41 -0
  8. package/dist/cjs/ui/error-boundary-fallback/index.js +1 -1
  9. package/dist/cjs/ui/index.js +4 -4
  10. package/dist/cjs/ui/link-picker/index.js +74 -46
  11. package/dist/cjs/ui/link-picker/link-search-error/index.js +27 -0
  12. package/dist/cjs/ui/link-picker/messages.js +10 -0
  13. package/dist/cjs/ui/link-picker/text-input/index.js +4 -10
  14. package/dist/cjs/ui/link-picker/url.js +0 -5
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/analytics.codegen.js +20 -0
  17. package/dist/es2019/common/constants.js +2 -0
  18. package/dist/es2019/{ui/error-boundary-fallback → common}/generic-error-svg/index.js +0 -0
  19. package/dist/es2019/{ui/error-boundary-fallback → common}/generic-error-svg/styled.js +0 -0
  20. package/dist/es2019/services/use-plugins/index.js +28 -38
  21. package/dist/es2019/services/use-search-query/index.js +32 -0
  22. package/dist/es2019/ui/error-boundary-fallback/index.js +1 -1
  23. package/dist/es2019/ui/index.js +1 -2
  24. package/dist/es2019/ui/link-picker/index.js +65 -45
  25. package/dist/es2019/ui/link-picker/link-search-error/index.js +10 -0
  26. package/dist/es2019/ui/link-picker/messages.js +10 -0
  27. package/dist/es2019/ui/link-picker/text-input/index.js +3 -9
  28. package/dist/es2019/ui/link-picker/url.js +0 -5
  29. package/dist/es2019/version.json +1 -1
  30. package/dist/esm/analytics.codegen.js +20 -0
  31. package/dist/esm/common/constants.js +2 -0
  32. package/dist/esm/{ui/error-boundary-fallback → common}/generic-error-svg/index.js +0 -0
  33. package/dist/esm/{ui/error-boundary-fallback → common}/generic-error-svg/styled.js +0 -0
  34. package/dist/esm/services/use-plugins/index.js +33 -35
  35. package/dist/esm/services/use-search-query/index.js +32 -0
  36. package/dist/esm/ui/error-boundary-fallback/index.js +1 -1
  37. package/dist/esm/ui/index.js +1 -2
  38. package/dist/esm/ui/link-picker/index.js +67 -45
  39. package/dist/esm/ui/link-picker/link-search-error/index.js +14 -0
  40. package/dist/esm/ui/link-picker/messages.js +10 -0
  41. package/dist/esm/ui/link-picker/text-input/index.js +4 -10
  42. package/dist/esm/ui/link-picker/url.js +0 -5
  43. package/dist/esm/version.json +1 -1
  44. package/dist/types/analytics.codegen.d.ts +20 -0
  45. package/dist/types/common/constants.d.ts +2 -0
  46. package/dist/types/{ui/error-boundary-fallback → common}/generic-error-svg/index.d.ts +0 -0
  47. package/dist/types/{ui/error-boundary-fallback → common}/generic-error-svg/styled.d.ts +0 -0
  48. package/dist/types/index.d.ts +1 -1
  49. package/dist/types/services/use-plugins/index.d.ts +6 -5
  50. package/dist/types/services/use-search-query/index.d.ts +3 -0
  51. package/dist/types/ui/link-picker/index.d.ts +2 -0
  52. package/dist/types/ui/link-picker/link-search-error/index.d.ts +4 -0
  53. package/dist/types/ui/link-picker/messages.d.ts +10 -0
  54. package/dist/types/ui/link-picker/text-input/index.d.ts +0 -1
  55. package/dist/types/ui/types.d.ts +5 -2
  56. package/package.json +11 -5
  57. package/report.api.md +11 -5
@@ -6,7 +6,6 @@ export interface Props extends Omit<TextFieldProps, 'value' | 'onChange' | 'auto
6
6
  autoFocus?: boolean;
7
7
  value: string;
8
8
  onChange: (value: string) => void;
9
- onSubmit?: (value: string) => void;
10
9
  onUndo?: Function;
11
10
  onRedo?: Function;
12
11
  onClear?: Function;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { ReactNode } from 'react';
2
2
  import { MessageDescriptor } from 'react-intl-next';
3
3
  export declare type LinkInputType = 'manual' | 'typeAhead';
4
4
  export interface LinkSearchListItemData {
@@ -36,9 +36,12 @@ export interface ResolveResult {
36
36
  data: LinkSearchListItemData[];
37
37
  }
38
38
  export interface LinkPickerPlugin {
39
+ resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
39
40
  /** Uniquely identify the tab */
40
41
  tabKey?: string;
41
42
  /** Human-readable label for the plugin */
42
43
  tabTitle?: string;
43
- resolve: (state: LinkPickerState) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
44
+ /** Render function to customise the UI that is displayed when an error occurs resolving results */
45
+ errorFallback?: LinkPickerPluginErrorFallback;
44
46
  }
47
+ 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.6.1",
3
+ "version": "1.8.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -26,7 +26,8 @@
26
26
  ".": "./src/index.ts"
27
27
  },
28
28
  "scripts": {
29
- "ak-postbuild": "ls -d dist/* | grep -v dist/types | xargs -n 1 copyfiles -u 1 -V src/**/*.svg"
29
+ "ak-postbuild": "ls -d dist/* | grep -v dist/types | xargs -n 1 copyfiles -u 1 -V src/**/*.svg",
30
+ "codegen-analytics": "ts-node --project ../../../tsconfig.node.json ./scripts/build/codegen-analytics"
30
31
  },
31
32
  "dependencies": {
32
33
  "@atlaskit/analytics-next": "^8.3.1",
@@ -52,26 +53,31 @@
52
53
  "react-intl-next": "npm:react-intl@^5.18.1"
53
54
  },
54
55
  "devDependencies": {
56
+ "@af/codegen": "*",
55
57
  "@atlaskit/activity-provider": "^2.3.2",
56
58
  "@atlaskit/docs": "*",
57
- "@atlaskit/link-test-helpers": "^1.3.0",
59
+ "@atlaskit/link-test-helpers": "^1.4.0",
58
60
  "@atlaskit/popup": "^1.4.0",
59
61
  "@atlaskit/ssr": "*",
60
62
  "@atlaskit/toggle": "^12.4.0",
61
63
  "@atlaskit/visual-regression": "*",
62
64
  "@atlaskit/webdriver-runner": "*",
63
65
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
64
- "@atlassian/link-picker-atlassian-plugin": "^16.0.0",
65
- "@atlassian/link-picker-plugins": "^3.0.0",
66
+ "@atlassian/link-picker-atlassian-plugin": "^18.0.0",
67
+ "@atlassian/link-picker-plugins": "^5.0.0",
68
+ "@atlassian/recent-work-client": "^1.5.0",
66
69
  "@atlassian/search-provider": "^2.3.0",
67
70
  "@testing-library/dom": "^7.7.3",
68
71
  "@testing-library/jest-dom": "^4.1.0",
69
72
  "@testing-library/react": "^8.0.1",
70
73
  "@testing-library/react-hooks": "^1.0.4",
71
74
  "@testing-library/user-event": "10.4.0",
75
+ "@types/js-yaml": "^3.12.5",
72
76
  "enzyme": "^3.10.0",
73
77
  "fetch-mock": "^8.0.0",
78
+ "js-yaml": "^3.13.1",
74
79
  "mockdate": "^3.0.2",
80
+ "prettier": "^2.1.1",
75
81
  "react-dom": "^16.8.0",
76
82
  "sinon": "^2.2.0",
77
83
  "typescript": "4.2.4"
package/report.api.md CHANGED
@@ -5,10 +5,9 @@
5
5
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
6
 
7
7
  ```ts
8
- /// <reference types="react" />
9
-
10
8
  import { MessageDescriptor } from 'react-intl-next';
11
9
  import { default as React_2 } from 'react';
10
+ import { ReactNode } from 'react';
12
11
 
13
12
  export declare type LinkInputType = 'manual' | 'typeAhead';
14
13
 
@@ -17,15 +16,22 @@ export declare const LinkPicker: React_2.MemoExoticComponent<(
17
16
  ) => JSX.Element>;
18
17
 
19
18
  export declare interface LinkPickerPlugin {
19
+ resolve: (
20
+ state: LinkPickerState,
21
+ ) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
20
22
  /** Uniquely identify the tab */
21
23
  tabKey?: string;
22
24
  /** Human-readable label for the plugin */
23
25
  tabTitle?: string;
24
- resolve: (
25
- state: LinkPickerState,
26
- ) => Promise<ResolveResult> | AsyncGenerator<ResolveResult, ResolveResult>;
26
+ /** Render function to customise the UI that is displayed when an error occurs resolving results */
27
+ errorFallback?: LinkPickerPluginErrorFallback;
27
28
  }
28
29
 
30
+ export declare type LinkPickerPluginErrorFallback = (
31
+ error: unknown,
32
+ retry: () => void,
33
+ ) => ReactNode;
34
+
29
35
  export declare interface LinkPickerProps {
30
36
  /** Callback to fire on form submission. */
31
37
  onSubmit: (arg: OnSubmitParameter) => void;