@jetbrains/ring-ui 5.0.94 → 5.0.96

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.
@@ -4,6 +4,7 @@ import isAfter from 'date-fns/isAfter';
4
4
  import isBefore from 'date-fns/isBefore';
5
5
  import isSameDay from 'date-fns/isSameDay';
6
6
  import startOfDay from 'date-fns/startOfDay';
7
+ import { set } from 'date-fns';
7
8
  import memoize from '../global/memoize';
8
9
  import DateInput from './date-input';
9
10
  import Months from './months';
@@ -105,7 +106,12 @@ export default class DatePopup extends Component {
105
106
  text: null,
106
107
  scrollDate: null
107
108
  });
108
- this.props.onChange(changes.date);
109
+ const adjustedDate = changes.date && set(new Date(), {
110
+ year: changes.date.getFullYear(),
111
+ month: changes.date.getMonth(),
112
+ date: changes.date.getDate()
113
+ });
114
+ this.props.onChange(adjustedDate);
109
115
  this.props.onComplete();
110
116
  }
111
117
  else if (!range && withTime) {
@@ -36,8 +36,7 @@ let dy = 0;
36
36
  export default function Months(props) {
37
37
  const { scrollDate } = props;
38
38
  const monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate);
39
- // Creating midnight of the first day of the month in UTC to prevent the impact of user timezone
40
- const monthStart = new Date(Date.UTC(monthDate.getFullYear(), monthDate.getMonth(), 1));
39
+ const monthStart = startOfMonth(monthDate);
41
40
  let month = subMonths(monthStart, MONTHSBACK);
42
41
  const months = [month];
43
42
  for (let i = 0; i < MONTHSBACK * DOUBLE; i++) {
@@ -782,7 +782,7 @@ export default class QueryAssist extends Component {
782
782
  });
783
783
  const placeholderStyles = classNames({
784
784
  [styles.placeholder]: true,
785
- [styles.withoutGlass]: !this.isRenderingGlassOrLoader() || (!renderLoader && huge)
785
+ [styles.withoutGlass]: !glass || (!renderLoader && huge)
786
786
  });
787
787
  return (<ControlsHeightContext.Provider value={ControlsHeight.M}>
788
788
  <div data-test={dataTests('ring-query-assist', dataTest)} className={containerClasses} role="presentation" ref={this.nodeRef}>
@@ -805,7 +805,9 @@ export default class QueryAssist extends Component {
805
805
  {this.props.placeholder}
806
806
  </button>)}
807
807
 
808
- {actions && (<div data-test="ring-query-assist-actions" className={styles.actions}>{actions}</div>)}
808
+ {actions.length
809
+ ? (<div data-test="ring-query-assist-actions" className={styles.actions}>{actions}</div>)
810
+ : null}
809
811
 
810
812
  <PopupMenu hidden={!this.state.showPopup} onCloseAttempt={this.closePopup} ref={this.popupRef} anchorElement={this.node} keepMounted attached className={this.props.popupClassName} directions={[PopupMenu.PopupProps.Directions.BOTTOM_RIGHT]} data={useCustomItemRender ? this.state.suggestions : this.renderSuggestions()} data-test="ring-query-assist-popup" hint={this.props.hint} hintOnSelection={this.props.hintOnSelection} left={this.getPopupOffset(this.state.suggestions)} maxHeight={PopupMenu.PopupProps.MaxHeight.SCREEN} onMouseDown={this.trackPopupMouseState} onMouseUp={this.trackPopupMouseState} onSelect={item => this.handleComplete(item)}/>
811
813
 
@@ -57,6 +57,7 @@ import '../input/input-label.js';
57
57
  import 'date-fns/isAfter';
58
58
  import 'date-fns/isBefore';
59
59
  import 'date-fns/startOfDay';
60
+ import 'date-fns';
60
61
  import './months.js';
61
62
  import 'date-fns/addMonths';
62
63
  import 'date-fns/getDay';
@@ -5,6 +5,7 @@ import isAfter from 'date-fns/isAfter';
5
5
  import isBefore from 'date-fns/isBefore';
6
6
  import isSameDay from 'date-fns/isSameDay';
7
7
  import startOfDay from 'date-fns/startOfDay';
8
+ import { set } from 'date-fns';
8
9
  import memoize from '../global/memoize.js';
9
10
  import DateInput from './date-input.js';
10
11
  import Months from './months.js';
@@ -228,7 +229,12 @@ class DatePopup extends Component {
228
229
  text: null,
229
230
  scrollDate: null
230
231
  });
231
- this.props.onChange(changes.date);
232
+ const adjustedDate = changes.date && set(new Date(), {
233
+ year: changes.date.getFullYear(),
234
+ month: changes.date.getMonth(),
235
+ date: changes.date.getDate()
236
+ });
237
+ this.props.onChange(adjustedDate);
232
238
  this.props.onComplete();
233
239
  } else if (!range && withTime) {
234
240
  const date = this.parse(this.props.date, 'date');
@@ -62,8 +62,7 @@ function Months(props) {
62
62
  scrollDate
63
63
  } = props;
64
64
  const monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate);
65
- // Creating midnight of the first day of the month in UTC to prevent the impact of user timezone
66
- const monthStart = new Date(Date.UTC(monthDate.getFullYear(), monthDate.getMonth(), 1));
65
+ const monthStart = startOfMonth(monthDate);
67
66
  let month = subMonths(monthStart, MONTHSBACK);
68
67
  const months = [month];
69
68
  for (let i = 0; i < MONTHSBACK * DOUBLE; i++) {
@@ -781,7 +781,7 @@ class QueryAssist extends Component {
781
781
  });
782
782
  const placeholderStyles = classNames({
783
783
  [modules_da7ab055.placeholder]: true,
784
- [modules_da7ab055.withoutGlass]: !this.isRenderingGlassOrLoader() || !renderLoader && huge
784
+ [modules_da7ab055.withoutGlass]: !glass || !renderLoader && huge
785
785
  });
786
786
  return /*#__PURE__*/React.createElement(ControlsHeightContext.Provider, {
787
787
  value: ControlsHeight.M
@@ -832,10 +832,10 @@ class QueryAssist extends Component {
832
832
  ref: this.placeholderRef,
833
833
  onClick: this.handleCaretMove,
834
834
  "data-test": "query-assist-placeholder"
835
- }, this.props.placeholder), actions && /*#__PURE__*/React.createElement("div", {
835
+ }, this.props.placeholder), actions.length ? /*#__PURE__*/React.createElement("div", {
836
836
  "data-test": "ring-query-assist-actions",
837
837
  className: modules_da7ab055.actions
838
- }, actions), /*#__PURE__*/React.createElement(PopupMenu, {
838
+ }, actions) : null, /*#__PURE__*/React.createElement(PopupMenu, {
839
839
  hidden: !this.state.showPopup,
840
840
  onCloseAttempt: this.closePopup,
841
841
  ref: this.popupRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.94",
3
+ "version": "5.0.96",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",