@atlaskit/link-picker 1.9.2 → 1.9.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 +12 -0
- package/dist/cjs/analytics.codegen.js +1 -1
- package/dist/cjs/common/analytics/context.js +137 -0
- package/dist/cjs/common/analytics/index.js +27 -0
- package/dist/cjs/common/analytics/input-field-tracking.js +115 -0
- package/dist/cjs/common/constants.js +1 -1
- package/dist/cjs/ui/error-boundary/index.js +104 -0
- package/dist/cjs/ui/index.js +10 -6
- package/dist/cjs/ui/link-picker/index.js +56 -16
- package/dist/cjs/ui/link-picker/text-input/index.js +18 -23
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics.codegen.js +1 -1
- package/dist/es2019/common/analytics/context.js +95 -0
- package/dist/es2019/common/analytics/index.js +2 -0
- package/dist/es2019/common/analytics/input-field-tracking.js +85 -0
- package/dist/es2019/common/constants.js +1 -1
- package/dist/es2019/ui/error-boundary/index.js +62 -0
- package/dist/es2019/ui/index.js +8 -5
- package/dist/es2019/ui/link-picker/index.js +51 -14
- package/dist/es2019/ui/link-picker/link-search-error/index.js +2 -2
- package/dist/es2019/ui/link-picker/text-input/index.js +14 -20
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics.codegen.js +1 -1
- package/dist/esm/common/analytics/context.js +110 -0
- package/dist/esm/common/analytics/index.js +2 -0
- package/dist/esm/common/analytics/input-field-tracking.js +91 -0
- package/dist/esm/common/constants.js +1 -1
- package/dist/esm/ui/error-boundary/index.js +81 -0
- package/dist/esm/ui/index.js +8 -5
- package/dist/esm/ui/link-picker/index.js +54 -14
- package/dist/esm/ui/link-picker/link-search-error/index.js +2 -2
- package/dist/esm/ui/link-picker/text-input/index.js +16 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics.codegen.d.ts +21 -1
- package/dist/types/common/analytics/context.d.ts +28 -0
- package/dist/types/common/analytics/index.d.ts +2 -0
- package/dist/types/common/analytics/input-field-tracking.d.ts +17 -0
- package/dist/types/common/constants.d.ts +1 -1
- package/dist/types/ui/error-boundary/index.d.ts +27 -0
- package/dist/types/ui/index.d.ts +2 -5
- package/dist/types/ui/link-picker/text-input/index.d.ts +6 -8
- package/package.json +1 -1
- package/dist/cjs/services/with-link-picker-analytics/index.js +0 -33
- package/dist/es2019/services/with-link-picker-analytics/index.js +0 -15
- package/dist/esm/services/with-link-picker-analytics/index.js +0 -17
- package/dist/types/services/with-link-picker-analytics/index.d.ts +0 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinkPickerAnalyticsContextType } from '../../analytics.codegen';
|
|
3
|
+
declare type InputFields = 'link' | 'displayText';
|
|
4
|
+
/**
|
|
5
|
+
* Wraps an input field and connects it to the link picker analytics context to provide a baseline of analytics tracking
|
|
6
|
+
* @param WrappedComponent The input field to be tracked
|
|
7
|
+
* @param field The name of the field (ie matching actionSubjectId)
|
|
8
|
+
* @param filterOnChangeEventAttrs Function to hook into and filter/customise the default attribute tracking logic
|
|
9
|
+
* @returns HOC Input field with tracking
|
|
10
|
+
*/
|
|
11
|
+
export declare const withInputFieldTracking: <P extends {
|
|
12
|
+
onBlur?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
13
|
+
onChange?: ((e: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
14
|
+
onClear?: Function | undefined;
|
|
15
|
+
onFocus?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
16
|
+
}, Field extends InputFields>(WrappedComponent: React.ComponentType<P>, field: Field, filterOnChangeEventAttrs?: <OnChangeAttributes extends Partial<LinkPickerAnalyticsContextType>>(event: React.ChangeEvent<HTMLInputElement>, attributes: OnChangeAttributes) => OnChangeAttributes) => React.ComponentType<P>;
|
|
17
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const ANALYTICS_CHANNEL = "media";
|
|
2
|
-
export declare const COMPONENT_NAME = "
|
|
2
|
+
export declare const COMPONENT_NAME = "linkPicker";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { Component, ReactNode } from 'react';
|
|
2
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
+
declare type ErrorBoundaryErrorInfo = {
|
|
4
|
+
componentStack: string;
|
|
5
|
+
};
|
|
6
|
+
export interface ErrorBoundaryProps extends WithAnalyticsEventsProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
channel: string;
|
|
9
|
+
ErrorComponent?: React.ComponentType;
|
|
10
|
+
onError?: (error: Error, info?: ErrorBoundaryErrorInfo) => void;
|
|
11
|
+
}
|
|
12
|
+
declare type ErrorBoundaryPayload = {
|
|
13
|
+
error: Error | string;
|
|
14
|
+
info?: ErrorBoundaryErrorInfo;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
declare type ErrorBoundaryState = {
|
|
18
|
+
hasError: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare class BaseErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
21
|
+
constructor(props: ErrorBoundaryProps);
|
|
22
|
+
fireAnalytics: (analyticsErrorPayload: ErrorBoundaryPayload) => void;
|
|
23
|
+
componentDidCatch(error: Error, info?: ErrorBoundaryErrorInfo): void;
|
|
24
|
+
render(): React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
declare const ErrorBoundary: React.ForwardRefExoticComponent<Omit<ErrorBoundaryProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
27
|
+
export default ErrorBoundary;
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { PackageMetaDataType } from '../analytics.codegen';
|
|
2
3
|
import { LinkPickerProps } from './link-picker';
|
|
3
|
-
export declare const PACKAGE_DATA:
|
|
4
|
-
packageName: any;
|
|
5
|
-
packageVersion: any;
|
|
6
|
-
componentName: string;
|
|
7
|
-
};
|
|
4
|
+
export declare const PACKAGE_DATA: PackageMetaDataType;
|
|
8
5
|
export declare const ComposedLinkPicker: React.MemoExoticComponent<(props: LinkPickerProps) => JSX.Element>;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { TextFieldProps } from '@atlaskit/textfield';
|
|
3
|
-
export
|
|
3
|
+
export declare type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & {
|
|
4
4
|
name: string;
|
|
5
|
-
label?: string;
|
|
6
|
-
autoFocus?: boolean;
|
|
7
5
|
value: string;
|
|
8
|
-
|
|
6
|
+
label?: string;
|
|
9
7
|
onUndo?: Function;
|
|
10
8
|
onRedo?: Function;
|
|
11
|
-
onClear?:
|
|
9
|
+
onClear?: (name: string) => void;
|
|
12
10
|
clearLabel?: string;
|
|
13
11
|
error?: string | null;
|
|
14
|
-
}
|
|
15
|
-
declare const
|
|
16
|
-
export default
|
|
12
|
+
};
|
|
13
|
+
declare const TextInput: ({ name, label, autoFocus, onRedo, onUndo, onKeyDown, onClear, clearLabel, error, ...restProps }: TextInputProps) => jsx.JSX.Element;
|
|
14
|
+
export default TextInput;
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.withLinkPickerAnalyticsContext = withLinkPickerAnalyticsContext;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
|
-
|
|
14
|
-
var _url = require("../../common/utils/url");
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
function withLinkPickerAnalyticsContext(WrappedComponent) {
|
|
21
|
-
return function (props) {
|
|
22
|
-
var data = (0, _react.useMemo)(function () {
|
|
23
|
-
return {
|
|
24
|
-
attributes: {
|
|
25
|
-
linkState: (0, _url.normalizeUrl)(props.url) ? 'editLink' : 'newLink'
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}, [props.url]);
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
|
|
30
|
-
data: data
|
|
31
|
-
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, props));
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
3
|
-
import { normalizeUrl } from '../../common/utils/url';
|
|
4
|
-
export function withLinkPickerAnalyticsContext(WrappedComponent) {
|
|
5
|
-
return props => {
|
|
6
|
-
const data = useMemo(() => ({
|
|
7
|
-
attributes: {
|
|
8
|
-
linkState: normalizeUrl(props.url) ? 'editLink' : 'newLink'
|
|
9
|
-
}
|
|
10
|
-
}), [props.url]);
|
|
11
|
-
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
12
|
-
data: data
|
|
13
|
-
}, /*#__PURE__*/React.createElement(WrappedComponent, props));
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
3
|
-
import { normalizeUrl } from '../../common/utils/url';
|
|
4
|
-
export function withLinkPickerAnalyticsContext(WrappedComponent) {
|
|
5
|
-
return function (props) {
|
|
6
|
-
var data = useMemo(function () {
|
|
7
|
-
return {
|
|
8
|
-
attributes: {
|
|
9
|
-
linkState: normalizeUrl(props.url) ? 'editLink' : 'newLink'
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}, [props.url]);
|
|
13
|
-
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
14
|
-
data: data
|
|
15
|
-
}, /*#__PURE__*/React.createElement(WrappedComponent, props));
|
|
16
|
-
};
|
|
17
|
-
}
|