@atlaskit/link-picker 1.5.1 → 1.6.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c9c0a119587`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c9c0a119587) - [ux] EDM-3881: add onContentRezise prop to allow callbacks after contents changed in items, plugin, tabs, etc.
8
+
3
9
  ## 1.5.1
4
10
 
5
11
  ### Patch Changes
@@ -102,6 +102,7 @@ function reducer(state, payload) {
102
102
  function LinkPicker(_ref) {
103
103
  var onSubmit = _ref.onSubmit,
104
104
  onCancel = _ref.onCancel,
105
+ onContentResize = _ref.onContentResize,
105
106
  plugins = _ref.plugins,
106
107
  initUrl = _ref.url,
107
108
  initDisplayText = _ref.displayText;
@@ -129,6 +130,11 @@ function LinkPicker(_ref) {
129
130
  isActivePlugin = _usePlugins.isActivePlugin,
130
131
  tabs = _usePlugins.tabs;
131
132
 
133
+ (0, _react.useLayoutEffect)(function () {
134
+ if (onContentResize) {
135
+ onContentResize();
136
+ }
137
+ }, [onContentResize, items, isLoading, isActivePlugin, tabs]);
132
138
  var handleChangeUrl = (0, _react.useCallback)(function (url) {
133
139
  dispatch({
134
140
  url: url
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { useCallback, useReducer } from 'react';
4
+ import { useCallback, useLayoutEffect, useReducer } from 'react';
5
5
  import { jsx } from '@emotion/react';
6
6
  import { useIntl, FormattedMessage } from 'react-intl-next';
7
7
  import Button, { ButtonGroup } from '@atlaskit/button';
@@ -63,6 +63,7 @@ function reducer(state, payload) {
63
63
  function LinkPicker({
64
64
  onSubmit,
65
65
  onCancel,
66
+ onContentResize,
66
67
  plugins,
67
68
  url: initUrl,
68
69
  displayText: initDisplayText
@@ -87,6 +88,11 @@ function LinkPicker({
87
88
  isActivePlugin,
88
89
  tabs
89
90
  } = usePlugins(state, plugins);
91
+ useLayoutEffect(() => {
92
+ if (onContentResize) {
93
+ onContentResize();
94
+ }
95
+ }, [onContentResize, items, isLoading, isActivePlugin, tabs]);
90
96
  const handleChangeUrl = useCallback(url => {
91
97
  dispatch({
92
98
  url
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -7,7 +7,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
7
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
8
 
9
9
  /** @jsx jsx */
10
- import { useCallback, useReducer } from 'react';
10
+ import { useCallback, useLayoutEffect, useReducer } from 'react';
11
11
  import { jsx } from '@emotion/react';
12
12
  import { useIntl, FormattedMessage } from 'react-intl-next';
13
13
  import Button, { ButtonGroup } from '@atlaskit/button';
@@ -66,6 +66,7 @@ function reducer(state, payload) {
66
66
  function LinkPicker(_ref) {
67
67
  var onSubmit = _ref.onSubmit,
68
68
  onCancel = _ref.onCancel,
69
+ onContentResize = _ref.onContentResize,
69
70
  plugins = _ref.plugins,
70
71
  initUrl = _ref.url,
71
72
  initDisplayText = _ref.displayText;
@@ -93,6 +94,11 @@ function LinkPicker(_ref) {
93
94
  isActivePlugin = _usePlugins.isActivePlugin,
94
95
  tabs = _usePlugins.tabs;
95
96
 
97
+ useLayoutEffect(function () {
98
+ if (onContentResize) {
99
+ onContentResize();
100
+ }
101
+ }, [onContentResize, items, isLoading, isActivePlugin, tabs]);
96
102
  var handleChangeUrl = useCallback(function (url) {
97
103
  dispatch({
98
104
  url: url
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -44,6 +44,8 @@ export interface LinkPickerProps {
44
44
  onSubmit: (arg: OnSubmitParameter) => void;
45
45
  /** Callback to fire when the cancel button is clicked. */
46
46
  onCancel: () => void;
47
+ /** Callback to fire when content is changed inside the link picker e.g. items, when loading, tabs */
48
+ onContentResize?: () => void;
47
49
  /** The url of the linked resource for editing. */
48
50
  url?: string;
49
51
  /** The desired text to be displayed alternatively to the title of the linked resource for editing. */
@@ -59,5 +61,5 @@ export interface PickerState {
59
61
  invalidUrl: boolean;
60
62
  activeTab: number;
61
63
  }
62
- declare function LinkPicker({ onSubmit, onCancel, plugins, url: initUrl, displayText: initDisplayText, }: LinkPickerProps): jsx.JSX.Element;
64
+ declare function LinkPicker({ onSubmit, onCancel, onContentResize, plugins, url: initUrl, displayText: initDisplayText, }: LinkPickerProps): jsx.JSX.Element;
63
65
  export default LinkPicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -57,11 +57,12 @@
57
57
  "@atlaskit/link-test-helpers": "^1.3.0",
58
58
  "@atlaskit/popup": "^1.3.5",
59
59
  "@atlaskit/ssr": "*",
60
+ "@atlaskit/toggle": "^12.4.0",
60
61
  "@atlaskit/visual-regression": "*",
61
62
  "@atlaskit/webdriver-runner": "*",
62
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
63
- "@atlassian/link-picker-atlassian-plugin": "^15.0.0",
64
- "@atlassian/link-picker-plugins": "^2.0.0",
64
+ "@atlassian/link-picker-atlassian-plugin": "^16.0.0",
65
+ "@atlassian/link-picker-plugins": "^3.0.0",
65
66
  "@atlassian/search-provider": "^2.3.0",
66
67
  "@testing-library/dom": "^7.7.3",
67
68
  "@testing-library/jest-dom": "^4.1.0",