@jetbrains/ring-ui 4.2.16 → 4.2.18

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.
@@ -352,3 +352,40 @@ rangeWithCustomPlaceholders.parameters = {
352
352
  hermione: {skip: true}
353
353
  };
354
354
 
355
+ export const withEmptyPlaceholder = () => {
356
+ class DatePickerExample extends Component {
357
+ state = {
358
+ from: undefined,
359
+ to: undefined
360
+ };
361
+
362
+ setRange = ({from, to}) => {
363
+ this.setState({from, to});
364
+ };
365
+
366
+ render() {
367
+ return (
368
+ <div>
369
+ <DatePicker
370
+ from={this.state.from}
371
+ to={this.state.to}
372
+ onChange={this.setRange}
373
+ fromPlaceholder=""
374
+ toPlaceholder=""
375
+ rangePlaceholder=""
376
+ clear
377
+ range
378
+ />
379
+ </div>
380
+ );
381
+ }
382
+ }
383
+
384
+ return <DatePickerExample/>;
385
+ };
386
+
387
+ withEmptyPlaceholder.storyName = 'range with empty placeholder';
388
+ withEmptyPlaceholder.parameters = {
389
+ hermione: {skip: true}
390
+ };
391
+
@@ -206,15 +206,15 @@ export default class DatePicker extends PureComponent {
206
206
 
207
207
  let text;
208
208
  if (!range && !withTime) {
209
- text = date ? displayFormat(date, locale) : datePlaceholder || translations.setDate;
209
+ text = date ? displayFormat(date, locale) : (datePlaceholder ?? translations.setDate);
210
210
  } else if (!range && withTime) {
211
211
  if (!date && !time) {
212
- text = dateTimePlaceholder || translations.setDateTime;
212
+ text = dateTimePlaceholder ?? translations.setDateTime;
213
213
  } else {
214
214
  text = `${date && displayFormat(date, locale) || '—'}, ${time || '—'}`;
215
215
  }
216
216
  } else if (!from && !to) {
217
- text = rangePlaceholder || translations.setPeriod;
217
+ text = rangePlaceholder ?? translations.setPeriod;
218
218
  } else if (!to) {
219
219
  text = `${displayFormat(from, locale)} —`;
220
220
  } else if (!from) {
@@ -463,7 +463,7 @@ export default class QueryAssist extends Component {
463
463
  if (!this.props.disabled && (caret !== this.immediateState.caret || popupHidden)) {
464
464
  this.immediateState.caret = caret;
465
465
  this.scrollInput();
466
- if (this.props.autoOpen === 'force' || this.immediateState.query.length > 0) {
466
+ if (this.immediateState.query.length > 0) {
467
467
  this.requestData();
468
468
  }
469
469
  }
@@ -1013,6 +1013,16 @@ export const multipleWithLimit = args => <Select {...args}/>;
1013
1013
  multipleWithLimit.storyName = 'multiple with limit';
1014
1014
  multipleWithLimit.parameters = {hermione: {skip: true}};
1015
1015
 
1016
+ export const withEmptyPlaceholder = args => (
1017
+ <Select
1018
+ {...args}
1019
+ label={''}
1020
+ />
1021
+ );
1022
+
1023
+ withEmptyPlaceholder.storyName = 'with empty placeholder';
1024
+ withEmptyPlaceholder.parameters = {hermione: {skip: true}};
1025
+
1016
1026
  export const selectInPopup = args => (
1017
1027
  <Dropdown
1018
1028
  anchor="Open dropdown"
@@ -311,8 +311,8 @@ export default class Select extends Component {
311
311
 
312
312
  selected: null, // current selection (item / array of items)
313
313
 
314
- label: '', // BUTTON or INPUT label (nothing selected)
315
- selectedLabel: '', // BUTTON or INPUT label (something selected)
314
+ label: null, // BUTTON or INPUT label (nothing selected)
315
+ selectedLabel: null, // BUTTON or INPUT label (something selected)
316
316
  inputPlaceholder: '', // Placeholder for input modes
317
317
  hint: null, // hint text to display under the list
318
318
 
@@ -981,7 +981,7 @@ export default class Select extends Component {
981
981
  }
982
982
 
983
983
  _getLabel() {
984
- return this.props.label || this.props.selectedLabel || 'Select an option';
984
+ return this.props.label ?? this.props.selectedLabel ?? 'Select an option';
985
985
  }
986
986
 
987
987
  _getSelectedString() {
@@ -192,15 +192,15 @@ class DatePicker extends PureComponent {
192
192
  let text;
193
193
 
194
194
  if (!range && !withTime) {
195
- text = date ? displayFormat(date, locale) : datePlaceholder || translations.setDate;
195
+ text = date ? displayFormat(date, locale) : datePlaceholder !== null && datePlaceholder !== void 0 ? datePlaceholder : translations.setDate;
196
196
  } else if (!range && withTime) {
197
197
  if (!date && !time) {
198
- text = dateTimePlaceholder || translations.setDateTime;
198
+ text = dateTimePlaceholder !== null && dateTimePlaceholder !== void 0 ? dateTimePlaceholder : translations.setDateTime;
199
199
  } else {
200
200
  text = "".concat(date && displayFormat(date, locale) || '—', ", ").concat(time || '—');
201
201
  }
202
202
  } else if (!from && !to) {
203
- text = rangePlaceholder || translations.setPeriod;
203
+ text = rangePlaceholder !== null && rangePlaceholder !== void 0 ? rangePlaceholder : translations.setPeriod;
204
204
  } else if (!to) {
205
205
  text = "".concat(displayFormat(from, locale), " \u2014");
206
206
  } else if (!from) {
@@ -314,7 +314,7 @@ class QueryAssist extends Component {
314
314
  this.immediateState.caret = caret;
315
315
  this.scrollInput();
316
316
 
317
- if (this.props.autoOpen === 'force' || this.immediateState.query.length > 0) {
317
+ if (this.immediateState.query.length > 0) {
318
318
  this.requestData();
319
319
  }
320
320
  }
@@ -980,7 +980,9 @@ class Select extends Component {
980
980
  }
981
981
 
982
982
  _getLabel() {
983
- return this.props.label || this.props.selectedLabel || 'Select an option';
983
+ var _ref2, _this$props$label;
984
+
985
+ return (_ref2 = (_this$props$label = this.props.label) !== null && _this$props$label !== void 0 ? _this$props$label : this.props.selectedLabel) !== null && _ref2 !== void 0 ? _ref2 : 'Select an option';
984
986
  }
985
987
 
986
988
  _getSelectedString() {
@@ -1312,9 +1314,9 @@ _defineProperty(Select, "defaultProps", {
1312
1314
  directions: [Popup.PopupProps.Directions.BOTTOM_RIGHT, Popup.PopupProps.Directions.BOTTOM_LEFT, Popup.PopupProps.Directions.TOP_LEFT, Popup.PopupProps.Directions.TOP_RIGHT],
1313
1315
  selected: null,
1314
1316
  // current selection (item / array of items)
1315
- label: '',
1317
+ label: null,
1316
1318
  // BUTTON or INPUT label (nothing selected)
1317
- selectedLabel: '',
1319
+ selectedLabel: null,
1318
1320
  // BUTTON or INPUT label (something selected)
1319
1321
  inputPlaceholder: '',
1320
1322
  // Placeholder for input modes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "4.2.16",
3
+ "version": "4.2.18",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -221,5 +221,5 @@
221
221
  "node": ">=7.4",
222
222
  "npm": ">=6.0.0"
223
223
  },
224
- "gitHead": "d014a21eb36c71da5a1ce56d6a95f74497930c76"
224
+ "gitHead": "6b6f519b3990ff308b592a9b9fe42891c2591166"
225
225
  }