@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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics.codegen.js +1 -1
  3. package/dist/cjs/common/analytics/context.js +137 -0
  4. package/dist/cjs/common/analytics/index.js +27 -0
  5. package/dist/cjs/common/analytics/input-field-tracking.js +115 -0
  6. package/dist/cjs/common/constants.js +1 -1
  7. package/dist/cjs/ui/error-boundary/index.js +104 -0
  8. package/dist/cjs/ui/index.js +10 -6
  9. package/dist/cjs/ui/link-picker/index.js +56 -16
  10. package/dist/cjs/ui/link-picker/text-input/index.js +18 -23
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/analytics.codegen.js +1 -1
  13. package/dist/es2019/common/analytics/context.js +95 -0
  14. package/dist/es2019/common/analytics/index.js +2 -0
  15. package/dist/es2019/common/analytics/input-field-tracking.js +85 -0
  16. package/dist/es2019/common/constants.js +1 -1
  17. package/dist/es2019/ui/error-boundary/index.js +62 -0
  18. package/dist/es2019/ui/index.js +8 -5
  19. package/dist/es2019/ui/link-picker/index.js +51 -14
  20. package/dist/es2019/ui/link-picker/link-search-error/index.js +2 -2
  21. package/dist/es2019/ui/link-picker/text-input/index.js +14 -20
  22. package/dist/es2019/version.json +1 -1
  23. package/dist/esm/analytics.codegen.js +1 -1
  24. package/dist/esm/common/analytics/context.js +110 -0
  25. package/dist/esm/common/analytics/index.js +2 -0
  26. package/dist/esm/common/analytics/input-field-tracking.js +91 -0
  27. package/dist/esm/common/constants.js +1 -1
  28. package/dist/esm/ui/error-boundary/index.js +81 -0
  29. package/dist/esm/ui/index.js +8 -5
  30. package/dist/esm/ui/link-picker/index.js +54 -14
  31. package/dist/esm/ui/link-picker/link-search-error/index.js +2 -2
  32. package/dist/esm/ui/link-picker/text-input/index.js +16 -21
  33. package/dist/esm/version.json +1 -1
  34. package/dist/types/analytics.codegen.d.ts +21 -1
  35. package/dist/types/common/analytics/context.d.ts +28 -0
  36. package/dist/types/common/analytics/index.d.ts +2 -0
  37. package/dist/types/common/analytics/input-field-tracking.d.ts +17 -0
  38. package/dist/types/common/constants.d.ts +1 -1
  39. package/dist/types/ui/error-boundary/index.d.ts +27 -0
  40. package/dist/types/ui/index.d.ts +2 -5
  41. package/dist/types/ui/link-picker/text-input/index.d.ts +6 -8
  42. package/package.json +1 -1
  43. package/dist/cjs/services/with-link-picker-analytics/index.js +0 -33
  44. package/dist/es2019/services/with-link-picker-analytics/index.js +0 -15
  45. package/dist/esm/services/with-link-picker-analytics/index.js +0 -17
  46. 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 = "LinkPicker";
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;
@@ -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 interface Props extends Omit<TextFieldProps, 'value' | 'onChange' | 'autoFocus' | 'onSubmit'> {
3
+ export declare type TextInputProps = Omit<TextFieldProps, 'name' | 'value'> & {
4
4
  name: string;
5
- label?: string;
6
- autoFocus?: boolean;
7
5
  value: string;
8
- onChange: (value: string) => void;
6
+ label?: string;
9
7
  onUndo?: Function;
10
8
  onRedo?: Function;
11
- onClear?: Function;
9
+ onClear?: (name: string) => void;
12
10
  clearLabel?: string;
13
11
  error?: string | null;
14
- }
15
- declare const PanelTextInput: (props: Props) => jsx.JSX.Element;
16
- export default PanelTextInput;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -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
- }
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare function withLinkPickerAnalyticsContext<P extends {
3
- url?: string;
4
- }>(WrappedComponent: React.ComponentType<P>): React.ComponentType<P>;