@atlaskit/link-picker 1.40.0 → 1.41.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 +20 -0
- package/dist/cjs/index.js +12 -4
- package/dist/cjs/lazy.js +13 -0
- package/dist/cjs/ui/index.js +17 -81
- package/dist/cjs/ui/lazy.js +27 -0
- package/dist/cjs/ui/link-picker/index.js +1 -1
- package/dist/cjs/ui/main.js +81 -0
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/lazy.js +1 -0
- package/dist/es2019/ui/index.js +15 -82
- package/dist/es2019/ui/lazy.js +12 -0
- package/dist/es2019/ui/link-picker/index.js +2 -2
- package/dist/es2019/ui/main.js +79 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/lazy.js +1 -0
- package/dist/esm/ui/index.js +15 -76
- package/dist/esm/ui/lazy.js +15 -0
- package/dist/esm/ui/link-picker/index.js +2 -2
- package/dist/esm/ui/main.js +70 -0
- package/dist/types/common/analytics/context.d.ts +2 -2
- package/dist/types/common/types.d.ts +83 -2
- package/dist/types/index.d.ts +3 -2
- package/dist/types/lazy.d.ts +1 -0
- package/dist/types/ui/index.d.ts +13 -12
- package/dist/types/ui/lazy.d.ts +3 -0
- package/dist/types/ui/link-picker/index.d.ts +1 -83
- package/dist/types/ui/main.d.ts +13 -0
- package/dist/types-ts4.5/common/analytics/context.d.ts +2 -2
- package/dist/types-ts4.5/common/types.d.ts +83 -2
- package/dist/types-ts4.5/index.d.ts +3 -2
- package/dist/types-ts4.5/lazy.d.ts +1 -0
- package/dist/types-ts4.5/ui/index.d.ts +13 -12
- package/dist/types-ts4.5/ui/lazy.d.ts +3 -0
- package/dist/types-ts4.5/ui/link-picker/index.d.ts +1 -83
- package/dist/types-ts4.5/ui/main.d.ts +13 -0
- package/lazy/package.json +15 -0
- package/package.json +4 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { lazyForPaint } from 'react-loosely-lazy';
|
|
2
|
+
import { composeLinkPicker } from './main';
|
|
3
|
+
var LazyLinkPickerComponent = lazyForPaint(function () {
|
|
4
|
+
return import( /* webpackChunkName: "@atlaskit-internal_link-picker" */
|
|
5
|
+
'./link-picker').then(function (_ref) {
|
|
6
|
+
var LinkPicker = _ref.LinkPicker;
|
|
7
|
+
return {
|
|
8
|
+
default: LinkPicker
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Must be a default export to be able to support prop docs
|
|
14
|
+
// eslint-disable-next-line import/no-default-export
|
|
15
|
+
export default composeLinkPicker(LazyLinkPickerComponent);
|
|
@@ -15,7 +15,7 @@ import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
|
15
15
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
16
|
import { isSafeUrl, normalizeUrl } from '@atlaskit/linking-common/url';
|
|
17
17
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
18
|
-
import {
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
19
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
20
20
|
import { useLinkPickerAnalytics, withInputFieldTracking, withLinkPickerAnalyticsContext } from '../../common/analytics';
|
|
21
21
|
import { ANALYTICS_CHANNEL } from '../../common/constants';
|
|
@@ -389,7 +389,7 @@ export var LinkPicker = withLinkPickerAnalyticsContext( /*#__PURE__*/memo(functi
|
|
|
389
389
|
css: !queryState || !(plugins !== null && plugins !== void 0 && plugins.length) ? formFooterMargin : undefined
|
|
390
390
|
/* Show the feature discovery pulse when we're on the Jira tab, we haven't started typing a url and
|
|
391
391
|
the feature flag is enabled */,
|
|
392
|
-
createFeatureDiscovery: (activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.tabKey) === 'jira' && allowCreateFeatureDiscovery &&
|
|
392
|
+
createFeatureDiscovery: (activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.tabKey) === 'jira' && allowCreateFeatureDiscovery && fg('platform.linking-platform.link-picker.enable-jira-create'),
|
|
393
393
|
customSubmitButtonLabel: customMessages !== null && customMessages !== void 0 && customMessages.submitButtonLabel ? customMessages.submitButtonLabel : undefined
|
|
394
394
|
}));
|
|
395
395
|
}));
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
/**
|
|
4
|
+
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
6
|
+
*/
|
|
7
|
+
import React, { Fragment, memo } from 'react';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
|
+
import { jsx } from '@emotion/react';
|
|
11
|
+
import { LazySuspense } from 'react-loosely-lazy';
|
|
12
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { COMPONENT_NAME, LINK_PICKER_WIDTH_IN_PX } from '../common/constants';
|
|
15
|
+
import { LinkPickerSessionProvider } from '../controllers/session-provider';
|
|
16
|
+
import { ErrorBoundary } from './error-boundary';
|
|
17
|
+
import { LoaderFallback } from './loader-fallback';
|
|
18
|
+
import { MessagesProvider } from './messages-provider';
|
|
19
|
+
import { fixedWidthContainerStyles } from './styled';
|
|
20
|
+
export var testIds = {
|
|
21
|
+
linkPickerRoot: 'link-picker-root'
|
|
22
|
+
};
|
|
23
|
+
export var PACKAGE_DATA = {
|
|
24
|
+
packageName: "@atlaskit/link-picker" || '',
|
|
25
|
+
packageVersion: "1.41.0" || '',
|
|
26
|
+
componentName: COMPONENT_NAME,
|
|
27
|
+
source: COMPONENT_NAME
|
|
28
|
+
};
|
|
29
|
+
var DefaultRootComponent = function DefaultRootComponent(_ref) {
|
|
30
|
+
var children = _ref.children;
|
|
31
|
+
return jsx("div", {
|
|
32
|
+
"data-testid": testIds.linkPickerRoot
|
|
33
|
+
}, children);
|
|
34
|
+
};
|
|
35
|
+
var FixedWidthContainer = function FixedWidthContainer(props) {
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
37
|
+
return jsx("div", _extends({
|
|
38
|
+
css: fixedWidthContainerStyles
|
|
39
|
+
}, props));
|
|
40
|
+
};
|
|
41
|
+
export var composeLinkPicker = function composeLinkPicker(Component) {
|
|
42
|
+
return /*#__PURE__*/memo(function (props) {
|
|
43
|
+
var _props$paddingLeft, _props$paddingRight, _props$paddingTop, _props$paddingBottom, _ref2;
|
|
44
|
+
var component = props.component;
|
|
45
|
+
var RootComponent = component !== null && component !== void 0 ? component : DefaultRootComponent;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* When ff enabled: root container will provide width to component + loader + error boundary
|
|
49
|
+
* When ff disabled: component + loader + error boundary each providing their own width
|
|
50
|
+
* Cannot make this change easier at risk of regression as external adopters may have css override on the form element
|
|
51
|
+
*/
|
|
52
|
+
var RootFixedWidthContainer = fg('platform.linking-platform.link-picker.fixed-height-search-results') ? FixedWidthContainer : Fragment;
|
|
53
|
+
var LoaderFallbackContainer = fg('platform.linking-platform.link-picker.fixed-height-search-results') ? Fragment : FixedWidthContainer;
|
|
54
|
+
return jsx(AnalyticsContext, {
|
|
55
|
+
data: PACKAGE_DATA
|
|
56
|
+
}, jsx(LinkPickerSessionProvider, null, jsx(MessagesProvider, null, jsx("div", {
|
|
57
|
+
style: (_ref2 = {}, _defineProperty(_ref2, '--link-picker-width', props.disableWidth ? '100%' : // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
58
|
+
"".concat(LINK_PICKER_WIDTH_IN_PX, "px")), _defineProperty(_ref2, '--link-picker-padding-left', (_props$paddingLeft = props.paddingLeft) !== null && _props$paddingLeft !== void 0 ? _props$paddingLeft : "var(--ds-space-200, 16px)"), _defineProperty(_ref2, '--link-picker-padding-right', (_props$paddingRight = props.paddingRight) !== null && _props$paddingRight !== void 0 ? _props$paddingRight : "var(--ds-space-200, 16px)"), _defineProperty(_ref2, '--link-picker-padding-top', (_props$paddingTop = props.paddingTop) !== null && _props$paddingTop !== void 0 ? _props$paddingTop : "var(--ds-space-200, 16px)"), _defineProperty(_ref2, '--link-picker-padding-bottom', (_props$paddingBottom = props.paddingBottom) !== null && _props$paddingBottom !== void 0 ? _props$paddingBottom : "var(--ds-space-200, 16px)"), _ref2)
|
|
59
|
+
}, jsx(RootFixedWidthContainer, null, jsx(ErrorBoundary, null, jsx(LazySuspense, {
|
|
60
|
+
fallback: jsx(LoaderFallbackContainer, null, jsx(LoaderFallback, {
|
|
61
|
+
url: props.url,
|
|
62
|
+
hideDisplayText: props.hideDisplayText,
|
|
63
|
+
isLoadingPlugins: props.isLoadingPlugins,
|
|
64
|
+
plugins: props.plugins
|
|
65
|
+
}))
|
|
66
|
+
}, jsx(RootComponent, _extends({}, props, {
|
|
67
|
+
"data-testid": testIds.linkPickerRoot
|
|
68
|
+
}), jsx(Component, props)))))))));
|
|
69
|
+
});
|
|
70
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { LinkPickerProps } from '../types';
|
|
3
|
+
import type { LinkPickerAnalyticsContextType } from '../utils/analytics/analytics.codegen';
|
|
4
4
|
type AnalyticsContextAttributesType = LinkPickerAnalyticsContextType;
|
|
5
5
|
export type TrackAttribute = <K extends keyof LinkPickerAnalyticsContextType>(attribute: K, value: AnalyticsContextAttributesType[K]) => void;
|
|
6
6
|
interface AnalyticsContextType {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { MessageDescriptor } from 'react-intl-next';
|
|
3
|
+
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
4
|
export type LinkInputType = 'manual' | 'typeAhead';
|
|
4
5
|
export interface LinkSearchListItemData {
|
|
5
6
|
/** Unique identifiable attribute for the item */
|
|
@@ -72,3 +73,83 @@ export interface PickerState {
|
|
|
72
73
|
preventHidingRecents: boolean;
|
|
73
74
|
allowCreateFeatureDiscovery: boolean;
|
|
74
75
|
}
|
|
76
|
+
interface Meta {
|
|
77
|
+
/** Indicates how the link was picked. */
|
|
78
|
+
inputMethod: LinkInputType;
|
|
79
|
+
}
|
|
80
|
+
interface OnSubmitParameter {
|
|
81
|
+
/** The `url` of the linked resource. */
|
|
82
|
+
url: string;
|
|
83
|
+
/** The desired text to be displayed alternatively to the title of the linked resource. */
|
|
84
|
+
displayText: string | null;
|
|
85
|
+
/** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
|
|
86
|
+
title: string | null;
|
|
87
|
+
/** Meta data about the link picking submission. */
|
|
88
|
+
meta: Meta;
|
|
89
|
+
/**
|
|
90
|
+
* The input value of the `url` field at time of submission if inserted "manually".
|
|
91
|
+
* This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
|
|
92
|
+
* @example
|
|
93
|
+
* { url: 'https://google.com', rawUrl: 'google.com' }
|
|
94
|
+
*/
|
|
95
|
+
rawUrl?: string;
|
|
96
|
+
/** Raw object from the selected resource */
|
|
97
|
+
data?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
export interface LinkPickerProps {
|
|
100
|
+
/**
|
|
101
|
+
* Callback to fire on form submission.
|
|
102
|
+
*/
|
|
103
|
+
onSubmit: (arg: OnSubmitParameter, analytic?: UIAnalyticsEvent | null) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Callback to fire when the cancel button is clicked.
|
|
106
|
+
* If not provided, cancel button is not displayed.
|
|
107
|
+
*/
|
|
108
|
+
onCancel?: () => void;
|
|
109
|
+
/** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
|
|
110
|
+
onContentResize?: () => void;
|
|
111
|
+
/** The url of the linked resource for editing. */
|
|
112
|
+
url?: string;
|
|
113
|
+
/** The desired text to be displayed alternatively to the title of the linked resource for editing. */
|
|
114
|
+
displayText?: string | null;
|
|
115
|
+
/** Plugins that provide link suggestions / search capabilities. */
|
|
116
|
+
plugins?: LinkPickerPlugin[];
|
|
117
|
+
/** If set true, Link picker will show the loading spinner where the tabs and results will show. */
|
|
118
|
+
isLoadingPlugins?: boolean;
|
|
119
|
+
/** Hides the link picker display text field if set to true. */
|
|
120
|
+
hideDisplayText?: boolean;
|
|
121
|
+
/** Disables the default width containing the link picker. */
|
|
122
|
+
disableWidth?: boolean;
|
|
123
|
+
/** Override the default left padding. */
|
|
124
|
+
paddingLeft?: string;
|
|
125
|
+
/** Override the default right padding. */
|
|
126
|
+
paddingRight?: string;
|
|
127
|
+
/** Override the default top padding. */
|
|
128
|
+
paddingTop?: string;
|
|
129
|
+
/** Override the default bottom padding. */
|
|
130
|
+
paddingBottom?: string;
|
|
131
|
+
/** Customise the link picker root component */
|
|
132
|
+
component?: React.ComponentType<Partial<LinkPickerProps> & {
|
|
133
|
+
children: React.ReactElement;
|
|
134
|
+
}>;
|
|
135
|
+
/** Allows for customisation of text in the link picker. */
|
|
136
|
+
customMessages?: CustomLinkPickerMessages;
|
|
137
|
+
featureFlags?: Record<string, unknown>;
|
|
138
|
+
/** Controls showing a "submission in-progres" UX */
|
|
139
|
+
isSubmitting?: boolean;
|
|
140
|
+
}
|
|
141
|
+
type CustomLinkPickerMessages = {
|
|
142
|
+
/** Label for the link input field */
|
|
143
|
+
linkLabel?: MessageDescriptor;
|
|
144
|
+
/** Aria label for the link input field */
|
|
145
|
+
linkAriaLabel?: MessageDescriptor;
|
|
146
|
+
/** Placeholder for the link input field */
|
|
147
|
+
linkPlaceholder?: MessageDescriptor;
|
|
148
|
+
/** Label for the link display text field */
|
|
149
|
+
linkTextLabel?: MessageDescriptor;
|
|
150
|
+
/** Placeholder for the link display text field */
|
|
151
|
+
linkTextPlaceholder?: MessageDescriptor;
|
|
152
|
+
/** Label for the submit button */
|
|
153
|
+
submitButtonLabel?: MessageDescriptor;
|
|
154
|
+
};
|
|
155
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export
|
|
1
|
+
export { default } from './ui';
|
|
2
|
+
export { DeprecatedLazyLinkPickerExport as LinkPicker } from './ui';
|
|
3
|
+
export type { LinkPickerProps } from './common/types';
|
|
3
4
|
export type { LinkInputType, LinkPickerPluginAction, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, LinkPickerPluginEmptyStateNoResults, } from './common/types';
|
|
4
5
|
export { UnauthenticatedError } from './common/utils/errors';
|
|
5
6
|
export { LoaderFallback } from './ui/loader-fallback';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LazyLinkPicker } from './ui/lazy';
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* @
|
|
3
|
+
* @deprecated A `/lazy` entrypoint has been added.
|
|
4
|
+
* @example Prefer the default export from the default entrypoint if you do not want a lazy-loaded version.
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import LinkPicker from '@atlaskit/link-picker';
|
|
7
|
+
* ```
|
|
8
|
+
* @example Prefer the `LazyLinkPicker` export from the `/lazy` entrypoint if you want a lazy-loaded version.
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { LazyLinkPicker } from '@atlaskit/link-picker/lazy';
|
|
11
|
+
* ```
|
|
4
12
|
*/
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type LinkPickerProps } from './link-picker';
|
|
9
|
-
export declare const testIds: {
|
|
10
|
-
linkPickerRoot: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
13
|
-
declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => jsx.JSX.Element>;
|
|
14
|
-
export default ComposedLinkPicker;
|
|
13
|
+
export declare const DeprecatedLazyLinkPickerExport: import("react").MemoExoticComponent<(props: import("..").LinkPickerProps) => import("@emotion/react").jsx.JSX.Element>;
|
|
14
|
+
declare const _default: import("react").MemoExoticComponent<(props: import("..").LinkPickerProps) => import("@emotion/react").jsx.JSX.Element>;
|
|
15
|
+
export default _default;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
import { type LinkInputType, type LinkPickerPlugin } from '../../common/types';
|
|
2
|
+
import type { LinkPickerProps } from '../../common/types';
|
|
5
3
|
export declare const testIds: {
|
|
6
4
|
readonly urlError: string;
|
|
7
5
|
readonly clearUrlButton: string;
|
|
@@ -25,84 +23,4 @@ export declare const testIds: {
|
|
|
25
23
|
readonly urlInputField: "link-url";
|
|
26
24
|
readonly textInputField: "link-text";
|
|
27
25
|
};
|
|
28
|
-
interface Meta {
|
|
29
|
-
/** Indicates how the link was picked. */
|
|
30
|
-
inputMethod: LinkInputType;
|
|
31
|
-
}
|
|
32
|
-
interface OnSubmitParameter {
|
|
33
|
-
/** The `url` of the linked resource. */
|
|
34
|
-
url: string;
|
|
35
|
-
/** The desired text to be displayed alternatively to the title of the linked resource. */
|
|
36
|
-
displayText: string | null;
|
|
37
|
-
/** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
|
|
38
|
-
title: string | null;
|
|
39
|
-
/** Meta data about the link picking submission. */
|
|
40
|
-
meta: Meta;
|
|
41
|
-
/**
|
|
42
|
-
* The input value of the `url` field at time of submission if inserted "manually".
|
|
43
|
-
* This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
|
|
44
|
-
* @example
|
|
45
|
-
* { url: 'https://google.com', rawUrl: 'google.com' }
|
|
46
|
-
*/
|
|
47
|
-
rawUrl?: string;
|
|
48
|
-
/** Raw object from the selected resource */
|
|
49
|
-
data?: Record<string, unknown>;
|
|
50
|
-
}
|
|
51
|
-
export interface LinkPickerProps {
|
|
52
|
-
/**
|
|
53
|
-
* Callback to fire on form submission.
|
|
54
|
-
*/
|
|
55
|
-
onSubmit: (arg: OnSubmitParameter, analytic?: UIAnalyticsEvent | null) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Callback to fire when the cancel button is clicked.
|
|
58
|
-
* If not provided, cancel button is not displayed.
|
|
59
|
-
*/
|
|
60
|
-
onCancel?: () => void;
|
|
61
|
-
/** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
|
|
62
|
-
onContentResize?: () => void;
|
|
63
|
-
/** The url of the linked resource for editing. */
|
|
64
|
-
url?: string;
|
|
65
|
-
/** The desired text to be displayed alternatively to the title of the linked resource for editing. */
|
|
66
|
-
displayText?: string | null;
|
|
67
|
-
/** Plugins that provide link suggestions / search capabilities. */
|
|
68
|
-
plugins?: LinkPickerPlugin[];
|
|
69
|
-
/** If set true, Link picker will show the loading spinner where the tabs and results will show. */
|
|
70
|
-
isLoadingPlugins?: boolean;
|
|
71
|
-
/** Hides the link picker display text field if set to true. */
|
|
72
|
-
hideDisplayText?: boolean;
|
|
73
|
-
/** Disables the default width containing the link picker. */
|
|
74
|
-
disableWidth?: boolean;
|
|
75
|
-
/** Override the default left padding. */
|
|
76
|
-
paddingLeft?: string;
|
|
77
|
-
/** Override the default right padding. */
|
|
78
|
-
paddingRight?: string;
|
|
79
|
-
/** Override the default top padding. */
|
|
80
|
-
paddingTop?: string;
|
|
81
|
-
/** Override the default bottom padding. */
|
|
82
|
-
paddingBottom?: string;
|
|
83
|
-
/** Customise the link picker root component */
|
|
84
|
-
component?: React.ComponentType<Partial<LinkPickerProps> & {
|
|
85
|
-
children: React.ReactElement;
|
|
86
|
-
}>;
|
|
87
|
-
/** Allows for customisation of text in the link picker. */
|
|
88
|
-
customMessages?: CustomLinkPickerMessages;
|
|
89
|
-
featureFlags?: Record<string, unknown>;
|
|
90
|
-
/** Controls showing a "submission in-progres" UX */
|
|
91
|
-
isSubmitting?: boolean;
|
|
92
|
-
}
|
|
93
|
-
type CustomLinkPickerMessages = {
|
|
94
|
-
/** Label for the link input field */
|
|
95
|
-
linkLabel?: MessageDescriptor;
|
|
96
|
-
/** Aria label for the link input field */
|
|
97
|
-
linkAriaLabel?: MessageDescriptor;
|
|
98
|
-
/** Placeholder for the link input field */
|
|
99
|
-
linkPlaceholder?: MessageDescriptor;
|
|
100
|
-
/** Label for the link display text field */
|
|
101
|
-
linkTextLabel?: MessageDescriptor;
|
|
102
|
-
/** Placeholder for the link display text field */
|
|
103
|
-
linkTextPlaceholder?: MessageDescriptor;
|
|
104
|
-
/** Label for the submit button */
|
|
105
|
-
submitButtonLabel?: MessageDescriptor;
|
|
106
|
-
};
|
|
107
26
|
export declare const LinkPicker: import("react").ComponentType<LinkPickerProps>;
|
|
108
|
-
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import type { LinkPickerProps } from '../common/types';
|
|
8
|
+
import type { PackageMetaDataType } from '../common/utils/analytics/analytics.codegen';
|
|
9
|
+
export declare const testIds: {
|
|
10
|
+
linkPickerRoot: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
13
|
+
export declare const composeLinkPicker: (Component: React.ComponentType<LinkPickerProps>) => React.MemoExoticComponent<(props: LinkPickerProps) => jsx.JSX.Element>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { LinkPickerProps } from '../types';
|
|
3
|
+
import type { LinkPickerAnalyticsContextType } from '../utils/analytics/analytics.codegen';
|
|
4
4
|
type AnalyticsContextAttributesType = LinkPickerAnalyticsContextType;
|
|
5
5
|
export type TrackAttribute = <K extends keyof LinkPickerAnalyticsContextType>(attribute: K, value: AnalyticsContextAttributesType[K]) => void;
|
|
6
6
|
interface AnalyticsContextType {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { MessageDescriptor } from 'react-intl-next';
|
|
3
|
+
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
4
|
export type LinkInputType = 'manual' | 'typeAhead';
|
|
4
5
|
export interface LinkSearchListItemData {
|
|
5
6
|
/** Unique identifiable attribute for the item */
|
|
@@ -72,3 +73,83 @@ export interface PickerState {
|
|
|
72
73
|
preventHidingRecents: boolean;
|
|
73
74
|
allowCreateFeatureDiscovery: boolean;
|
|
74
75
|
}
|
|
76
|
+
interface Meta {
|
|
77
|
+
/** Indicates how the link was picked. */
|
|
78
|
+
inputMethod: LinkInputType;
|
|
79
|
+
}
|
|
80
|
+
interface OnSubmitParameter {
|
|
81
|
+
/** The `url` of the linked resource. */
|
|
82
|
+
url: string;
|
|
83
|
+
/** The desired text to be displayed alternatively to the title of the linked resource. */
|
|
84
|
+
displayText: string | null;
|
|
85
|
+
/** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
|
|
86
|
+
title: string | null;
|
|
87
|
+
/** Meta data about the link picking submission. */
|
|
88
|
+
meta: Meta;
|
|
89
|
+
/**
|
|
90
|
+
* The input value of the `url` field at time of submission if inserted "manually".
|
|
91
|
+
* This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
|
|
92
|
+
* @example
|
|
93
|
+
* { url: 'https://google.com', rawUrl: 'google.com' }
|
|
94
|
+
*/
|
|
95
|
+
rawUrl?: string;
|
|
96
|
+
/** Raw object from the selected resource */
|
|
97
|
+
data?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
export interface LinkPickerProps {
|
|
100
|
+
/**
|
|
101
|
+
* Callback to fire on form submission.
|
|
102
|
+
*/
|
|
103
|
+
onSubmit: (arg: OnSubmitParameter, analytic?: UIAnalyticsEvent | null) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Callback to fire when the cancel button is clicked.
|
|
106
|
+
* If not provided, cancel button is not displayed.
|
|
107
|
+
*/
|
|
108
|
+
onCancel?: () => void;
|
|
109
|
+
/** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
|
|
110
|
+
onContentResize?: () => void;
|
|
111
|
+
/** The url of the linked resource for editing. */
|
|
112
|
+
url?: string;
|
|
113
|
+
/** The desired text to be displayed alternatively to the title of the linked resource for editing. */
|
|
114
|
+
displayText?: string | null;
|
|
115
|
+
/** Plugins that provide link suggestions / search capabilities. */
|
|
116
|
+
plugins?: LinkPickerPlugin[];
|
|
117
|
+
/** If set true, Link picker will show the loading spinner where the tabs and results will show. */
|
|
118
|
+
isLoadingPlugins?: boolean;
|
|
119
|
+
/** Hides the link picker display text field if set to true. */
|
|
120
|
+
hideDisplayText?: boolean;
|
|
121
|
+
/** Disables the default width containing the link picker. */
|
|
122
|
+
disableWidth?: boolean;
|
|
123
|
+
/** Override the default left padding. */
|
|
124
|
+
paddingLeft?: string;
|
|
125
|
+
/** Override the default right padding. */
|
|
126
|
+
paddingRight?: string;
|
|
127
|
+
/** Override the default top padding. */
|
|
128
|
+
paddingTop?: string;
|
|
129
|
+
/** Override the default bottom padding. */
|
|
130
|
+
paddingBottom?: string;
|
|
131
|
+
/** Customise the link picker root component */
|
|
132
|
+
component?: React.ComponentType<Partial<LinkPickerProps> & {
|
|
133
|
+
children: React.ReactElement;
|
|
134
|
+
}>;
|
|
135
|
+
/** Allows for customisation of text in the link picker. */
|
|
136
|
+
customMessages?: CustomLinkPickerMessages;
|
|
137
|
+
featureFlags?: Record<string, unknown>;
|
|
138
|
+
/** Controls showing a "submission in-progres" UX */
|
|
139
|
+
isSubmitting?: boolean;
|
|
140
|
+
}
|
|
141
|
+
type CustomLinkPickerMessages = {
|
|
142
|
+
/** Label for the link input field */
|
|
143
|
+
linkLabel?: MessageDescriptor;
|
|
144
|
+
/** Aria label for the link input field */
|
|
145
|
+
linkAriaLabel?: MessageDescriptor;
|
|
146
|
+
/** Placeholder for the link input field */
|
|
147
|
+
linkPlaceholder?: MessageDescriptor;
|
|
148
|
+
/** Label for the link display text field */
|
|
149
|
+
linkTextLabel?: MessageDescriptor;
|
|
150
|
+
/** Placeholder for the link display text field */
|
|
151
|
+
linkTextPlaceholder?: MessageDescriptor;
|
|
152
|
+
/** Label for the submit button */
|
|
153
|
+
submitButtonLabel?: MessageDescriptor;
|
|
154
|
+
};
|
|
155
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export
|
|
1
|
+
export { default } from './ui';
|
|
2
|
+
export { DeprecatedLazyLinkPickerExport as LinkPicker } from './ui';
|
|
3
|
+
export type { LinkPickerProps } from './common/types';
|
|
3
4
|
export type { LinkInputType, LinkPickerPluginAction, LinkPickerPlugin, LinkPickerState, LinkSearchListItemData, LinkPickerPluginErrorFallback, LinkPickerPluginEmptyStateNoResults, } from './common/types';
|
|
4
5
|
export { UnauthenticatedError } from './common/utils/errors';
|
|
5
6
|
export { LoaderFallback } from './ui/loader-fallback';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LazyLinkPicker } from './ui/lazy';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* @
|
|
3
|
+
* @deprecated A `/lazy` entrypoint has been added.
|
|
4
|
+
* @example Prefer the default export from the default entrypoint if you do not want a lazy-loaded version.
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import LinkPicker from '@atlaskit/link-picker';
|
|
7
|
+
* ```
|
|
8
|
+
* @example Prefer the `LazyLinkPicker` export from the `/lazy` entrypoint if you want a lazy-loaded version.
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { LazyLinkPicker } from '@atlaskit/link-picker/lazy';
|
|
11
|
+
* ```
|
|
4
12
|
*/
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type LinkPickerProps } from './link-picker';
|
|
9
|
-
export declare const testIds: {
|
|
10
|
-
linkPickerRoot: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
13
|
-
declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => jsx.JSX.Element>;
|
|
14
|
-
export default ComposedLinkPicker;
|
|
13
|
+
export declare const DeprecatedLazyLinkPickerExport: import("react").MemoExoticComponent<(props: import("..").LinkPickerProps) => import("@emotion/react").jsx.JSX.Element>;
|
|
14
|
+
declare const _default: import("react").MemoExoticComponent<(props: import("..").LinkPickerProps) => import("@emotion/react").jsx.JSX.Element>;
|
|
15
|
+
export default _default;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
import { type LinkInputType, type LinkPickerPlugin } from '../../common/types';
|
|
2
|
+
import type { LinkPickerProps } from '../../common/types';
|
|
5
3
|
export declare const testIds: {
|
|
6
4
|
readonly urlError: string;
|
|
7
5
|
readonly clearUrlButton: string;
|
|
@@ -25,84 +23,4 @@ export declare const testIds: {
|
|
|
25
23
|
readonly urlInputField: "link-url";
|
|
26
24
|
readonly textInputField: "link-text";
|
|
27
25
|
};
|
|
28
|
-
interface Meta {
|
|
29
|
-
/** Indicates how the link was picked. */
|
|
30
|
-
inputMethod: LinkInputType;
|
|
31
|
-
}
|
|
32
|
-
interface OnSubmitParameter {
|
|
33
|
-
/** The `url` of the linked resource. */
|
|
34
|
-
url: string;
|
|
35
|
-
/** The desired text to be displayed alternatively to the title of the linked resource. */
|
|
36
|
-
displayText: string | null;
|
|
37
|
-
/** The resolved `title` of the resource at the time of link picking (if applicable, null if not known). */
|
|
38
|
-
title: string | null;
|
|
39
|
-
/** Meta data about the link picking submission. */
|
|
40
|
-
meta: Meta;
|
|
41
|
-
/**
|
|
42
|
-
* The input value of the `url` field at time of submission if inserted "manually".
|
|
43
|
-
* This can useful if the `url` was manually inserted with a value that is different from the normalised value returned as `url`.
|
|
44
|
-
* @example
|
|
45
|
-
* { url: 'https://google.com', rawUrl: 'google.com' }
|
|
46
|
-
*/
|
|
47
|
-
rawUrl?: string;
|
|
48
|
-
/** Raw object from the selected resource */
|
|
49
|
-
data?: Record<string, unknown>;
|
|
50
|
-
}
|
|
51
|
-
export interface LinkPickerProps {
|
|
52
|
-
/**
|
|
53
|
-
* Callback to fire on form submission.
|
|
54
|
-
*/
|
|
55
|
-
onSubmit: (arg: OnSubmitParameter, analytic?: UIAnalyticsEvent | null) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Callback to fire when the cancel button is clicked.
|
|
58
|
-
* If not provided, cancel button is not displayed.
|
|
59
|
-
*/
|
|
60
|
-
onCancel?: () => void;
|
|
61
|
-
/** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
|
|
62
|
-
onContentResize?: () => void;
|
|
63
|
-
/** The url of the linked resource for editing. */
|
|
64
|
-
url?: string;
|
|
65
|
-
/** The desired text to be displayed alternatively to the title of the linked resource for editing. */
|
|
66
|
-
displayText?: string | null;
|
|
67
|
-
/** Plugins that provide link suggestions / search capabilities. */
|
|
68
|
-
plugins?: LinkPickerPlugin[];
|
|
69
|
-
/** If set true, Link picker will show the loading spinner where the tabs and results will show. */
|
|
70
|
-
isLoadingPlugins?: boolean;
|
|
71
|
-
/** Hides the link picker display text field if set to true. */
|
|
72
|
-
hideDisplayText?: boolean;
|
|
73
|
-
/** Disables the default width containing the link picker. */
|
|
74
|
-
disableWidth?: boolean;
|
|
75
|
-
/** Override the default left padding. */
|
|
76
|
-
paddingLeft?: string;
|
|
77
|
-
/** Override the default right padding. */
|
|
78
|
-
paddingRight?: string;
|
|
79
|
-
/** Override the default top padding. */
|
|
80
|
-
paddingTop?: string;
|
|
81
|
-
/** Override the default bottom padding. */
|
|
82
|
-
paddingBottom?: string;
|
|
83
|
-
/** Customise the link picker root component */
|
|
84
|
-
component?: React.ComponentType<Partial<LinkPickerProps> & {
|
|
85
|
-
children: React.ReactElement;
|
|
86
|
-
}>;
|
|
87
|
-
/** Allows for customisation of text in the link picker. */
|
|
88
|
-
customMessages?: CustomLinkPickerMessages;
|
|
89
|
-
featureFlags?: Record<string, unknown>;
|
|
90
|
-
/** Controls showing a "submission in-progres" UX */
|
|
91
|
-
isSubmitting?: boolean;
|
|
92
|
-
}
|
|
93
|
-
type CustomLinkPickerMessages = {
|
|
94
|
-
/** Label for the link input field */
|
|
95
|
-
linkLabel?: MessageDescriptor;
|
|
96
|
-
/** Aria label for the link input field */
|
|
97
|
-
linkAriaLabel?: MessageDescriptor;
|
|
98
|
-
/** Placeholder for the link input field */
|
|
99
|
-
linkPlaceholder?: MessageDescriptor;
|
|
100
|
-
/** Label for the link display text field */
|
|
101
|
-
linkTextLabel?: MessageDescriptor;
|
|
102
|
-
/** Placeholder for the link display text field */
|
|
103
|
-
linkTextPlaceholder?: MessageDescriptor;
|
|
104
|
-
/** Label for the submit button */
|
|
105
|
-
submitButtonLabel?: MessageDescriptor;
|
|
106
|
-
};
|
|
107
26
|
export declare const LinkPicker: import("react").ComponentType<LinkPickerProps>;
|
|
108
|
-
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import type { LinkPickerProps } from '../common/types';
|
|
8
|
+
import type { PackageMetaDataType } from '../common/utils/analytics/analytics.codegen';
|
|
9
|
+
export declare const testIds: {
|
|
10
|
+
linkPickerRoot: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
13
|
+
export declare const composeLinkPicker: (Component: React.ComponentType<LinkPickerProps>) => React.MemoExoticComponent<(props: LinkPickerProps) => jsx.JSX.Element>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/link-picker/lazy",
|
|
3
|
+
"main": "../dist/cjs/lazy.js",
|
|
4
|
+
"module": "../dist/esm/lazy.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/lazy.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/lazy.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.4": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/lazy.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|