@jetbrains/ring-ui 5.0.68 → 5.0.70

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.
@@ -34,6 +34,26 @@
34
34
  &.inline {
35
35
  padding: 0;
36
36
  }
37
+
38
+ &.sizeS {
39
+ width: calc(unit * 12);
40
+ }
41
+
42
+ &.sizeM {
43
+ width: calc(unit * 30);
44
+ }
45
+
46
+ &.sizeL {
47
+ width: calc(unit * 50);
48
+ }
49
+
50
+ &.sizeFULL {
51
+ width: 100%;
52
+ }
53
+
54
+ &.sizeAUTO {
55
+ max-width: 100%;
56
+ }
37
57
  }
38
58
 
39
59
  .displayDate {
@@ -95,10 +115,11 @@
95
115
  }
96
116
 
97
117
  .anchor {
98
- min-width: calc(unit * 30);
118
+ width: 100%;
99
119
  padding: 0 unit;
100
120
 
101
121
  text-align: start;
122
+ white-space: nowrap;
102
123
 
103
124
  @nest .inline & {
104
125
  min-width: initial;
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import type { Locale } from 'date-fns';
4
4
  import Popup from '../popup/popup';
5
5
  import { DropdownAttrs } from '../dropdown/dropdown';
6
+ import { Size } from '../input/input';
6
7
  import { DatePopupProps } from './date-popup';
7
8
  import { DateInputTranslations, DatePickerChange } from './consts';
8
9
  export interface DatePickerTranslations extends Partial<DateInputTranslations> {
@@ -26,6 +27,7 @@ export type DatePickerProps = Omit<DatePopupProps, 'translations' | 'parseDateIn
26
27
  rangePlaceholder: string;
27
28
  disabled?: boolean | null | undefined;
28
29
  parseDateInput: (input: string | null | undefined) => Date | null;
30
+ size?: Size;
29
31
  };
30
32
  /**
31
33
  * @name Date Picker
@@ -57,6 +59,7 @@ export default class DatePicker extends PureComponent<DatePickerProps> {
57
59
  maxDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
58
60
  translations: PropTypes.Requireable<object>;
59
61
  locale: PropTypes.Requireable<object>;
62
+ size: PropTypes.Requireable<Size>;
60
63
  };
61
64
  static defaultProps: DatePickerProps;
62
65
  handleChange: (change: DatePickerChange | Date | null | undefined) => void;
@@ -16,6 +16,7 @@ import Dropdown from '../dropdown/dropdown';
16
16
  import Icon from '../icon';
17
17
  import Button from '../button/button';
18
18
  import Link from '../link/link';
19
+ import { Size } from '../input/input';
19
20
  import DatePopup from './date-popup';
20
21
  import { dateType } from './consts';
21
22
  import styles from './date-picker.css';
@@ -66,7 +67,8 @@ export default class DatePicker extends PureComponent {
66
67
  minDate: dateType,
67
68
  maxDate: dateType,
68
69
  translations: PropTypes.object,
69
- locale: PropTypes.object
70
+ locale: PropTypes.object,
71
+ size: PropTypes.oneOf(Object.values(Size))
70
72
  };
71
73
  static defaultProps = {
72
74
  className: '',
@@ -77,6 +79,7 @@ export default class DatePicker extends PureComponent {
77
79
  to: null,
78
80
  clear: false,
79
81
  inline: false,
82
+ size: Size.M,
80
83
  displayFormat: (date, locale) => (date ? formatDate(date, 'd MMM yyyy', { locale }) : ''),
81
84
  displayMonthFormat: (date, locale) => (date ? formatDate(date, 'd MMM', { locale }) : ''),
82
85
  displayDayFormat: (date, locale) => (date ? formatDate(date, 'd', { locale }) : ''),
@@ -202,7 +205,7 @@ export default class DatePicker extends PureComponent {
202
205
  </Button>);
203
206
  }
204
207
  const { className, popupClassName, clear, inline, dropdownProps, translations, ...datePopupProps } = this.props;
205
- const classes = classNames(styles.datePicker, className, {
208
+ const classes = classNames(styles.datePicker, className, styles[`size${this.props.size}`], {
206
209
  [styles.inline]: inline
207
210
  });
208
211
  return (<Dropdown className={classes} anchor={inline
@@ -40,21 +40,14 @@
40
40
 
41
41
  .icons {
42
42
  position: absolute;
43
- top: -3px;
43
+ top: 0;
44
44
  right: 5px;
45
+ bottom: 0;
45
46
 
46
47
  transition: color var(--ring-ease);
47
48
 
48
49
  color: var(--ring-icon-secondary-color);
49
50
 
50
- line-height: calc(unit * 4);
51
-
52
- & :global(.ring-loader_inline) {
53
- top: 2px;
54
-
55
- margin-right: 2px;
56
- }
57
-
58
51
  @nest .inputMode & {
59
52
  font-size: var(--ring-font-size);
60
53
  }
@@ -235,7 +228,3 @@
235
228
 
236
229
  color: inherit;
237
230
  }
238
-
239
- .heightS .icons {
240
- top: -5px;
241
- }
@@ -740,14 +740,15 @@ export default class Select extends Component {
740
740
  const { selected } = this.state;
741
741
  const { disabled, clear, hideArrow } = this.props;
742
742
  const icons = [];
743
+ const height = this.props.height || this.context;
743
744
  if (!Array.isArray(selected) && selected?.icon) {
744
745
  icons.push(<button title="Toggle options popup" type="button" className={styles.selectedIcon} key="selected" disabled={this.props.disabled} onClick={this._clickHandler} style={{ backgroundImage: `url(${selected.icon})` }}/>);
745
746
  }
746
747
  if (clear && !disabled && !this._selectionIsEmpty()) {
747
- icons.push(<Button title="Clear selection" data-test="ring-clear-select" className={styles.clearIcon} key="close" disabled={this.props.disabled} onClick={this.clear} icon={closeIcon}/>);
748
+ icons.push(<Button title="Clear selection" data-test="ring-clear-select" className={styles.clearIcon} key="close" disabled={this.props.disabled} onClick={this.clear} height={height} icon={closeIcon}/>);
748
749
  }
749
750
  if (!hideArrow) {
750
- icons.push(<Button title="Toggle options popup" className={styles.chevron} iconClassName={styles.chevronIcon} icon={chevronDownIcon} key="hide" disabled={this.props.disabled} onClick={this._clickHandler}/>);
751
+ icons.push(<Button title="Toggle options popup" className={styles.chevron} iconClassName={styles.chevronIcon} icon={chevronDownIcon} key="hide" disabled={this.props.disabled} height={height} onClick={this._clickHandler}/>);
751
752
  }
752
753
  return icons;
753
754
  }
@@ -782,7 +783,7 @@ export default class Select extends Component {
782
783
  });
783
784
  const icons = this._getIcons();
784
785
  const style = getStyle(icons.length);
785
- const iconsNode = <span className={styles.icons}>{icons}</span>;
786
+ const iconsNode = <div className={styles.icons}>{icons}</div>;
786
787
  const ariaProps = this.state.showPopup
787
788
  ? {
788
789
  'aria-owns': this.listId,
@@ -1,4 +1,5 @@
1
1
  function _defineProperty(obj, key, value) {
2
+ key = _toPropertyKey(key);
2
3
  if (key in obj) {
3
4
  Object.defineProperty(obj, key, {
4
5
  value: value,
@@ -25,5 +26,19 @@ function _extends() {
25
26
  };
26
27
  return _extends.apply(this, arguments);
27
28
  }
29
+ function _toPrimitive(input, hint) {
30
+ if (typeof input !== "object" || input === null) return input;
31
+ var prim = input[Symbol.toPrimitive];
32
+ if (prim !== undefined) {
33
+ var res = prim.call(input, hint || "default");
34
+ if (typeof res !== "object") return res;
35
+ throw new TypeError("@@toPrimitive must return a primitive value.");
36
+ }
37
+ return (hint === "string" ? String : Number)(input);
38
+ }
39
+ function _toPropertyKey(arg) {
40
+ var key = _toPrimitive(arg, "string");
41
+ return typeof key === "symbol" ? key : String(key);
42
+ }
28
43
 
29
44
  export { _defineProperty as _, _extends as a };
@@ -1,3 +1,3 @@
1
- var modules_0c7b7d96 = {"unit":"8px","footer-height":"64px","breakpoint-small":"640px","breakpoint-middle":"960px","breakpoint-large":"1200px","extra-small-screen-media":"(max-width: 639px)","small-screen-media":"(min-width: 640px) and (max-width: 959px)","middle-screen-media":"(min-width: 960px) and (max-width: 1199px)","large-screen-media":"(min-width: 1200px)","cellSize":"24px","calHeight":"288px","calWidth":"296px","yearHeight":"32px","yearWidth":"48px","light":"light_rui_e0bd","clearfix":"clearfix_rui_e0bd","font":"font_rui_e0bd","font-lower":"font-lower_rui_e0bd font_rui_e0bd","font-smaller":"font-smaller_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","font-smaller-lower":"font-smaller-lower_rui_e0bd font-smaller_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","font-larger-lower":"font-larger-lower_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","font-larger":"font-larger_rui_e0bd font-larger-lower_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","thin-font":"thin-font_rui_e0bd","monospace-font":"monospace-font_rui_e0bd","ellipsis":"ellipsis_rui_e0bd","resetButton":"resetButton_rui_e0bd","container":"container_rui_e0bd","hoverable":"hoverable_rui_e0bd","datePicker":"datePicker_rui_e0bd","inline":"inline_rui_e0bd","displayDate":"displayDate_rui_e0bd","displayRange":"displayRange_rui_e0bd","clear":"clear_rui_e0bd","datePopup":"datePopup_rui_e0bd","filterWrapper":"filterWrapper_rui_e0bd filterWrapper_rui_531d","filter":"filter_rui_e0bd filter_rui_531d","calendarIcon":"calendarIcon_rui_e0bd","anchor":"anchor_rui_e0bd","anchorContent":"anchorContent_rui_e0bd","chevronDownIcon":"chevronDownIcon_rui_e0bd","fromInput":"fromInput_rui_e0bd","fromInputWithDivider":"fromInputWithDivider_rui_e0bd","toInput":"toInput_rui_e0bd","dateInput":"dateInput_rui_e0bd","timeInputWithDivider":"timeInputWithDivider_rui_e0bd","weekdays":"weekdays_rui_e0bd","weekday":"weekday_rui_e0bd","weekend":"weekend_rui_e0bd","calendar":"calendar_rui_e0bd","months":"months_rui_e0bd","days":"days_rui_e0bd","month":"month_rui_e0bd","monthTitle":"monthTitle_rui_e0bd","day":"day_rui_e0bd resetButton_rui_8bff","between":"between_rui_e0bd","activeBetween":"activeBetween_rui_e0bd","current":"current_rui_e0bd","active":"active_rui_e0bd","disabled":"disabled_rui_e0bd","from":"from_rui_e0bd","to":"to_rui_e0bd","Monday":"Monday_rui_e0bd","spread":"spread_rui_e0bd","activeSpread":"activeSpread_rui_e0bd","first":"first_rui_e0bd","Tuesday":"Tuesday_rui_e0bd","Friday":"Friday_rui_e0bd","Saturday":"Saturday_rui_e0bd","Sunday":"Sunday_rui_e0bd","empty":"empty_rui_e0bd","today":"today_rui_e0bd","year":"year_rui_e0bd hoverable_rui_e0bd resetButton_rui_8bff","monthNames":"monthNames_rui_e0bd","monthName":"monthName_rui_e0bd hoverable_rui_e0bd resetButton_rui_8bff","monthSlider":"monthSlider_rui_e0bd resetButton_rui_8bff","dragging":"dragging_rui_e0bd","range":"range_rui_e0bd","years":"years_rui_e0bd","currentYear":"currentYear_rui_e0bd"};
1
+ var modules_0c7b7d96 = {"unit":"8px","footer-height":"64px","breakpoint-small":"640px","breakpoint-middle":"960px","breakpoint-large":"1200px","extra-small-screen-media":"(max-width: 639px)","small-screen-media":"(min-width: 640px) and (max-width: 959px)","middle-screen-media":"(min-width: 960px) and (max-width: 1199px)","large-screen-media":"(min-width: 1200px)","cellSize":"24px","calHeight":"288px","calWidth":"296px","yearHeight":"32px","yearWidth":"48px","light":"light_rui_e0bd","clearfix":"clearfix_rui_e0bd","font":"font_rui_e0bd","font-lower":"font-lower_rui_e0bd font_rui_e0bd","font-smaller":"font-smaller_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","font-smaller-lower":"font-smaller-lower_rui_e0bd font-smaller_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","font-larger-lower":"font-larger-lower_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","font-larger":"font-larger_rui_e0bd font-larger-lower_rui_e0bd font-lower_rui_e0bd font_rui_e0bd","thin-font":"thin-font_rui_e0bd","monospace-font":"monospace-font_rui_e0bd","ellipsis":"ellipsis_rui_e0bd","resetButton":"resetButton_rui_e0bd","container":"container_rui_e0bd","hoverable":"hoverable_rui_e0bd","datePicker":"datePicker_rui_e0bd","inline":"inline_rui_e0bd","sizeS":"sizeS_rui_e0bd","sizeM":"sizeM_rui_e0bd","sizeL":"sizeL_rui_e0bd","sizeFULL":"sizeFULL_rui_e0bd","sizeAUTO":"sizeAUTO_rui_e0bd","displayDate":"displayDate_rui_e0bd","displayRange":"displayRange_rui_e0bd","clear":"clear_rui_e0bd","datePopup":"datePopup_rui_e0bd","filterWrapper":"filterWrapper_rui_e0bd filterWrapper_rui_531d","filter":"filter_rui_e0bd filter_rui_531d","calendarIcon":"calendarIcon_rui_e0bd","anchor":"anchor_rui_e0bd","anchorContent":"anchorContent_rui_e0bd","chevronDownIcon":"chevronDownIcon_rui_e0bd","fromInput":"fromInput_rui_e0bd","fromInputWithDivider":"fromInputWithDivider_rui_e0bd","toInput":"toInput_rui_e0bd","dateInput":"dateInput_rui_e0bd","timeInputWithDivider":"timeInputWithDivider_rui_e0bd","weekdays":"weekdays_rui_e0bd","weekday":"weekday_rui_e0bd","weekend":"weekend_rui_e0bd","calendar":"calendar_rui_e0bd","months":"months_rui_e0bd","days":"days_rui_e0bd","month":"month_rui_e0bd","monthTitle":"monthTitle_rui_e0bd","day":"day_rui_e0bd resetButton_rui_8bff","between":"between_rui_e0bd","activeBetween":"activeBetween_rui_e0bd","current":"current_rui_e0bd","active":"active_rui_e0bd","disabled":"disabled_rui_e0bd","from":"from_rui_e0bd","to":"to_rui_e0bd","Monday":"Monday_rui_e0bd","spread":"spread_rui_e0bd","activeSpread":"activeSpread_rui_e0bd","first":"first_rui_e0bd","Tuesday":"Tuesday_rui_e0bd","Friday":"Friday_rui_e0bd","Saturday":"Saturday_rui_e0bd","Sunday":"Sunday_rui_e0bd","empty":"empty_rui_e0bd","today":"today_rui_e0bd","year":"year_rui_e0bd hoverable_rui_e0bd resetButton_rui_8bff","monthNames":"monthNames_rui_e0bd","monthName":"monthName_rui_e0bd hoverable_rui_e0bd resetButton_rui_8bff","monthSlider":"monthSlider_rui_e0bd resetButton_rui_8bff","dragging":"dragging_rui_e0bd","range":"range_rui_e0bd","years":"years_rui_e0bd","currentYear":"currentYear_rui_e0bd"};
2
2
 
3
3
  export { modules_0c7b7d96 as m };
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import type { Locale } from 'date-fns';
4
4
  import Popup from '../popup/popup';
5
5
  import { DropdownAttrs } from '../dropdown/dropdown';
6
+ import { Size } from '../input/input';
6
7
  import { DatePopupProps } from './date-popup';
7
8
  import { DateInputTranslations, DatePickerChange } from './consts';
8
9
  export interface DatePickerTranslations extends Partial<DateInputTranslations> {
@@ -26,6 +27,7 @@ export type DatePickerProps = Omit<DatePopupProps, 'translations' | 'parseDateIn
26
27
  rangePlaceholder: string;
27
28
  disabled?: boolean | null | undefined;
28
29
  parseDateInput: (input: string | null | undefined) => Date | null;
30
+ size?: Size;
29
31
  };
30
32
  /**
31
33
  * @name Date Picker
@@ -57,6 +59,7 @@ export default class DatePicker extends PureComponent<DatePickerProps> {
57
59
  maxDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
58
60
  translations: PropTypes.Requireable<object>;
59
61
  locale: PropTypes.Requireable<object>;
62
+ size: PropTypes.Requireable<Size>;
60
63
  };
61
64
  static defaultProps: DatePickerProps;
62
65
  handleChange: (change: DatePickerChange | Date | null | undefined) => void;
@@ -17,6 +17,7 @@ import Dropdown from '../dropdown/dropdown.js';
17
17
  import Icon from '../icon/icon.js';
18
18
  import { Button } from '../button/button.js';
19
19
  import Link from '../link/link.js';
20
+ import { Size } from '../input/input.js';
20
21
  import DatePopup from './date-popup.js';
21
22
  import { dateType } from './consts.js';
22
23
  import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
@@ -48,6 +49,11 @@ import '../link/clickableLink.js';
48
49
  import '../global/controls-height.js';
49
50
  import '../_helpers/button__classes.js';
50
51
  import '../_helpers/link.js';
52
+ import '@jetbrains/icons/close-12px';
53
+ import '../global/prop-types.js';
54
+ import '../global/composeRefs.js';
55
+ import '../_helpers/input.js';
56
+ import '../input/input-label.js';
51
57
  import 'date-fns/isAfter';
52
58
  import 'date-fns/isBefore';
53
59
  import 'date-fns/startOfDay';
@@ -77,12 +83,6 @@ import 'date-fns/isThisYear';
77
83
  import 'date-fns/setYear';
78
84
  import './weekdays.js';
79
85
  import 'date-fns/add';
80
- import '../input/input.js';
81
- import '@jetbrains/icons/close-12px';
82
- import '../global/prop-types.js';
83
- import '../global/composeRefs.js';
84
- import '../_helpers/input.js';
85
- import '../input/input-label.js';
86
86
 
87
87
  const PopupComponent = _ref => {
88
88
  let {
@@ -242,7 +242,7 @@ class DatePicker extends PureComponent {
242
242
  translations,
243
243
  ...datePopupProps
244
244
  } = this.props;
245
- const classes = classNames(modules_0c7b7d96.datePicker, className, {
245
+ const classes = classNames(modules_0c7b7d96.datePicker, className, modules_0c7b7d96[`size${this.props.size}`], {
246
246
  [modules_0c7b7d96.inline]: inline
247
247
  });
248
248
  return /*#__PURE__*/React.createElement(Dropdown, _extends({
@@ -298,7 +298,8 @@ _defineProperty(DatePicker, "propTypes", {
298
298
  minDate: dateType,
299
299
  maxDate: dateType,
300
300
  translations: PropTypes.object,
301
- locale: PropTypes.object
301
+ locale: PropTypes.object,
302
+ size: PropTypes.oneOf(Object.values(Size))
302
303
  });
303
304
  _defineProperty(DatePicker, "defaultProps", {
304
305
  className: '',
@@ -309,6 +310,7 @@ _defineProperty(DatePicker, "defaultProps", {
309
310
  to: null,
310
311
  clear: false,
311
312
  inline: false,
313
+ size: Size.M,
312
314
  displayFormat: (date, locale) => date ? format(date, 'd MMM yyyy', {
313
315
  locale
314
316
  }) : '',
@@ -857,6 +857,7 @@ class Select extends Component {
857
857
  hideArrow
858
858
  } = this.props;
859
859
  const icons = [];
860
+ const height = this.props.height || this.context;
860
861
  if (!Array.isArray(selected) && selected !== null && selected !== void 0 && selected.icon) {
861
862
  icons.push( /*#__PURE__*/React.createElement("button", {
862
863
  title: "Toggle options popup",
@@ -878,6 +879,7 @@ class Select extends Component {
878
879
  key: "close",
879
880
  disabled: this.props.disabled,
880
881
  onClick: this.clear,
882
+ height: height,
881
883
  icon: closeIcon
882
884
  }));
883
885
  }
@@ -889,6 +891,7 @@ class Select extends Component {
889
891
  icon: chevronDownIcon,
890
892
  key: "hide",
891
893
  disabled: this.props.disabled,
894
+ height: height,
892
895
  onClick: this._clickHandler
893
896
  }));
894
897
  }
@@ -931,7 +934,7 @@ class Select extends Component {
931
934
  });
932
935
  const icons = this._getIcons();
933
936
  const style = getStyle(icons.length);
934
- const iconsNode = /*#__PURE__*/React.createElement("span", {
937
+ const iconsNode = /*#__PURE__*/React.createElement("div", {
935
938
  className: modules_9d0de074.icons
936
939
  }, icons);
937
940
  const ariaProps = this.state.showPopup ? {