@atlaskit/link-picker 1.2.0 → 1.2.1

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.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d17b35d4c20`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d17b35d4c20) - Display validation message when submitting empty input
8
+
3
9
  ## 1.2.0
4
10
 
5
11
  ### Minor Changes
@@ -243,24 +243,22 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
243
243
  url = _this$state5.url,
244
244
  selectedIndex = _this$state5.selectedIndex,
245
245
  items = _this$state5.items;
246
+ var intl = _this.props.intl;
246
247
  var selectedItem = items[selectedIndex];
247
248
 
248
249
  if (_this.isUrlPopulatedWithSelectedItem()) {
249
- _this.handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
250
- } else if (url.length > 0) {
251
- var normalized = (0, _url.normalizeUrl)(url);
252
-
253
- if (normalized) {
254
- _this.handleInsert(normalized, null, 'manual');
255
- } else {
256
- var intl = _this.props.intl;
257
- var linkInvalid = intl.formatMessage(_messages.messages.linkInvalid);
258
-
259
- _this.setState({
260
- invalidUrl: linkInvalid
261
- });
262
- }
250
+ return _this.handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
263
251
  }
252
+
253
+ var normalized = (0, _url.normalizeUrl)(url);
254
+
255
+ if (normalized) {
256
+ return _this.handleInsert(normalized, null, 'manual');
257
+ }
258
+
259
+ return _this.setState({
260
+ invalidUrl: intl.formatMessage(_messages.messages.linkInvalid)
261
+ });
264
262
  });
265
263
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeyDown", function (event) {
266
264
  var _this$state6 = _this.state,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -181,25 +181,24 @@ class LinkPicker extends PureComponent {
181
181
  selectedIndex,
182
182
  items
183
183
  } = this.state;
184
+ const {
185
+ intl
186
+ } = this.props;
184
187
  const selectedItem = items[selectedIndex];
185
188
 
186
189
  if (this.isUrlPopulatedWithSelectedItem()) {
187
- this.handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
188
- } else if (url.length > 0) {
189
- const normalized = normalizeUrl(url);
190
+ return this.handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
191
+ }
190
192
 
191
- if (normalized) {
192
- this.handleInsert(normalized, null, 'manual');
193
- } else {
194
- const {
195
- intl
196
- } = this.props;
197
- const linkInvalid = intl.formatMessage(messages.linkInvalid);
198
- this.setState({
199
- invalidUrl: linkInvalid
200
- });
201
- }
193
+ const normalized = normalizeUrl(url);
194
+
195
+ if (normalized) {
196
+ return this.handleInsert(normalized, null, 'manual');
202
197
  }
198
+
199
+ return this.setState({
200
+ invalidUrl: intl.formatMessage(messages.linkInvalid)
201
+ });
203
202
  });
204
203
 
205
204
  _defineProperty(this, "handleKeyDown", event => {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -216,24 +216,22 @@ var LinkPicker = /*#__PURE__*/function (_PureComponent) {
216
216
  url = _this$state5.url,
217
217
  selectedIndex = _this$state5.selectedIndex,
218
218
  items = _this$state5.items;
219
+ var intl = _this.props.intl;
219
220
  var selectedItem = items[selectedIndex];
220
221
 
221
222
  if (_this.isUrlPopulatedWithSelectedItem()) {
222
- _this.handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
223
- } else if (url.length > 0) {
224
- var normalized = normalizeUrl(url);
225
-
226
- if (normalized) {
227
- _this.handleInsert(normalized, null, 'manual');
228
- } else {
229
- var intl = _this.props.intl;
230
- var linkInvalid = intl.formatMessage(messages.linkInvalid);
231
-
232
- _this.setState({
233
- invalidUrl: linkInvalid
234
- });
235
- }
223
+ return _this.handleInsert(selectedItem.url, selectedItem.name, 'typeAhead');
236
224
  }
225
+
226
+ var normalized = normalizeUrl(url);
227
+
228
+ if (normalized) {
229
+ return _this.handleInsert(normalized, null, 'manual');
230
+ }
231
+
232
+ return _this.setState({
233
+ invalidUrl: intl.formatMessage(messages.linkInvalid)
234
+ });
237
235
  });
238
236
 
239
237
  _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {