@jetbrains/ring-ui 5.0.30 → 5.0.32

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.
@@ -28,7 +28,7 @@ export const basic = () => {
28
28
  <div class="example-block">
29
29
  <div class="ring-error-bubble-wrapper">
30
30
  <rg-query-assist
31
- class="ring-input-size_xs"
31
+ size="'S'"
32
32
  x-data-source="exampleCtrl.dataSource"
33
33
  glass="true"
34
34
  placeholder="'Extra-short'">
@@ -37,7 +37,7 @@ export const basic = () => {
37
37
  </div>
38
38
  <div class="ring-error-bubble-wrapper">
39
39
  <rg-query-assist
40
- class="ring-input-size_s"
40
+ size="'S'"
41
41
  x-data-source="exampleCtrl.dataSource"
42
42
  glass="true"
43
43
  placeholder="'Short'">
@@ -46,7 +46,7 @@ export const basic = () => {
46
46
  </div>
47
47
  <div class="ring-error-bubble-wrapper">
48
48
  <rg-query-assist
49
- class="ring-input-size_m"
49
+ size="'M'"
50
50
  x-data-source="exampleCtrl.dataSource"
51
51
  glass="true"
52
52
  placeholder="'Medium'">
@@ -55,7 +55,7 @@ export const basic = () => {
55
55
  </div>
56
56
  <div class="ring-error-bubble-wrapper">
57
57
  <rg-query-assist
58
- class="ring-input-size_l"
58
+ size="'L'"
59
59
  x-data-source="exampleCtrl.dataSource"
60
60
  glass="true"
61
61
  placeholder="'Long'">
@@ -64,6 +64,7 @@ export const basic = () => {
64
64
  </div>
65
65
  <div class="ring-error-bubble-wrapper">
66
66
  <rg-query-assist
67
+ size="'FULL'"
67
68
  x-data-source="exampleCtrl.dataSource"
68
69
  glass="true"
69
70
  placeholder="'Full-width'">
@@ -29,8 +29,6 @@
29
29
  .huge {
30
30
  --ring-input-padding-block: 5px;
31
31
 
32
- width: 100%;
33
-
34
32
  & .input {
35
33
  border-right: 0;
36
34
  border-top-right-radius: 0;
@@ -4,6 +4,7 @@ import Caret, { Position } from '../caret/caret';
4
4
  import PopupMenu from '../popup-menu/popup-menu';
5
5
  import Button from '../button/button';
6
6
  import Icon from '../icon/icon';
7
+ import { Size } from '../input/input';
7
8
  import { ShortcutsMap } from '../shortcuts/core';
8
9
  import { QueryAssistSuggestion, SuggestionItem } from './query-assist__suggestions';
9
10
  declare function noop(): void;
@@ -40,7 +41,7 @@ export interface QueryAssistProps {
40
41
  onClear: () => void;
41
42
  onFocusChange: (change: FocusChange) => void;
42
43
  translations: QueryAssistTranslations;
43
- autoOpen?: boolean | null | undefined;
44
+ autoOpen?: boolean | null | undefined | 'force';
44
45
  caret?: number | null | undefined;
45
46
  clear?: boolean | null | undefined;
46
47
  className?: string | null | undefined;
@@ -59,6 +60,7 @@ export interface QueryAssistProps {
59
60
  actions?: ReactNode[] | null | undefined;
60
61
  'data-test'?: string | null | undefined;
61
62
  huge?: boolean | null | undefined;
63
+ size: Size;
62
64
  }
63
65
  export interface StyleRange {
64
66
  style: string;
@@ -128,7 +130,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
128
130
  /**
129
131
  * Open suggestions popup during the initial render
130
132
  */
131
- autoOpen: PropTypes.Requireable<boolean>;
133
+ autoOpen: PropTypes.Requireable<string | boolean>;
132
134
  /**
133
135
  * Initial caret position
134
136
  */
@@ -210,6 +212,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
210
212
  actions: PropTypes.Requireable<any[]>;
211
213
  'data-test': PropTypes.Requireable<string>;
212
214
  huge: PropTypes.Requireable<boolean>;
215
+ size: PropTypes.Requireable<string>;
213
216
  };
214
217
  static defaultProps: {
215
218
  onApply: typeof noop;
@@ -217,6 +220,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
217
220
  onApplySuggestion: typeof noop;
218
221
  onClear: typeof noop;
219
222
  onFocusChange: typeof noop;
223
+ size: Size;
220
224
  translations: {
221
225
  searchTitle: string;
222
226
  clearTitle: string;
@@ -17,6 +17,8 @@ import rerenderHOC from '../global/rerender-hoc';
17
17
  import Button from '../button/button';
18
18
  import Icon from '../icon/icon';
19
19
  import { ControlsHeight, ControlsHeightContext } from '../global/controls-height';
20
+ import { Size } from '../input/input';
21
+ import inputStyles from '../input/input.css';
20
22
  import QueryAssistSuggestions from './query-assist__suggestions';
21
23
  import styles from './query-assist.css';
22
24
  const POPUP_COMPENSATION = PopupMenu.ListProps.Dimension.ITEM_PADDING +
@@ -70,7 +72,7 @@ export default class QueryAssist extends Component {
70
72
  /**
71
73
  * Open suggestions popup during the initial render
72
74
  */
73
- autoOpen: PropTypes.bool,
75
+ autoOpen: PropTypes.oneOf([true, false, 'force']),
74
76
  /**
75
77
  * Initial caret position
76
78
  */
@@ -151,7 +153,8 @@ export default class QueryAssist extends Component {
151
153
  translations: PropTypes.object,
152
154
  actions: PropTypes.array,
153
155
  'data-test': PropTypes.string,
154
- huge: PropTypes.bool
156
+ huge: PropTypes.bool,
157
+ size: PropTypes.string
155
158
  };
156
159
  static defaultProps = {
157
160
  onApply: noop,
@@ -159,6 +162,7 @@ export default class QueryAssist extends Component {
159
162
  onApplySuggestion: noop,
160
163
  onClear: noop,
161
164
  onFocusChange: noop,
165
+ size: Size.L,
162
166
  translations: {
163
167
  searchTitle: 'Search',
164
168
  clearTitle: 'Clear search input'
@@ -201,7 +205,7 @@ export default class QueryAssist extends Component {
201
205
  focus: Boolean(this.props.autoOpen || this.props.focus)
202
206
  };
203
207
  this.setupRequestHandler(this.props.delay);
204
- if (this.props.autoOpen && query.length > 0) {
208
+ if (this.props.autoOpen === 'force' || this.props.autoOpen && query.length > 0) {
205
209
  this.requestHandler().
206
210
  catch(noop);
207
211
  }
@@ -238,7 +242,7 @@ export default class QueryAssist extends Component {
238
242
  }
239
243
  if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
240
244
  this.immediateState.query = query;
241
- if (query && prevProps.autoOpen && query.length > 0) {
245
+ if (prevProps.autoOpen && query?.length > 0) {
242
246
  this.requestData?.();
243
247
  }
244
248
  else if (query) {
@@ -354,7 +358,7 @@ export default class QueryAssist extends Component {
354
358
  }
355
359
  this.immediateState = props;
356
360
  this.props.onChange(props);
357
- if (props.query.length > 0) {
361
+ if (this.props.autoOpen === 'force' || props.query.length > 0) {
358
362
  this.requestData?.();
359
363
  }
360
364
  };
@@ -427,7 +431,7 @@ export default class QueryAssist extends Component {
427
431
  if (!this.props.disabled && (caret !== this.immediateState.caret || popupHidden)) {
428
432
  this.immediateState.caret = caret;
429
433
  this.scrollInput();
430
- if (this.immediateState.query.length > 0) {
434
+ if (this.props.autoOpen === 'force' || this.immediateState.query.length > 0) {
431
435
  this.requestData?.();
432
436
  }
433
437
  }
@@ -755,12 +759,12 @@ export default class QueryAssist extends Component {
755
759
  return actions;
756
760
  }
757
761
  render() {
758
- const { glass, 'data-test': dataTest, className, useCustomItemRender, huge } = this.props;
762
+ const { glass, 'data-test': dataTest, className, useCustomItemRender, huge, size } = this.props;
759
763
  const renderPlaceholder = !!this.props.placeholder && this.state.placeholderEnabled;
760
764
  const renderLoader = this.props.loader !== false && this.state.loading;
761
765
  const renderGlass = glass && !renderLoader;
762
766
  const actions = this.renderActions();
763
- const containerClasses = classNames(className, {
767
+ const containerClasses = classNames(className, inputStyles[`size${huge ? Size.FULL : size}`], {
764
768
  [styles.queryAssist]: true,
765
769
  [styles.withIcon]: (renderGlass && !huge) || renderLoader,
766
770
  [styles.huge]: huge
@@ -774,8 +778,7 @@ export default class QueryAssist extends Component {
774
778
  });
775
779
  return (<ControlsHeightContext.Provider value={ControlsHeight.M}>
776
780
  <div data-test={dataTests('ring-query-assist', dataTest)} className={containerClasses} role="presentation" ref={this.nodeRef}>
777
- {this.state.shortcuts &&
778
- (<Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>)}
781
+ {this.state.shortcuts && (<Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>)}
779
782
 
780
783
  {renderGlass && !huge && (<Icon glyph={searchIcon} className={styles.icon} title={this.props.translations.searchTitle} ref={this.glassRef} data-test="query-assist-search-icon"/>)}
781
784
 
@@ -4,6 +4,7 @@ import Caret, { Position } from '../caret/caret';
4
4
  import PopupMenu from '../popup-menu/popup-menu';
5
5
  import Button from '../button/button';
6
6
  import Icon from '../icon/icon';
7
+ import { Size } from '../input/input';
7
8
  import { ShortcutsMap } from '../shortcuts/core';
8
9
  import { QueryAssistSuggestion, SuggestionItem } from './query-assist__suggestions';
9
10
  declare function noop(): void;
@@ -40,7 +41,7 @@ export interface QueryAssistProps {
40
41
  onClear: () => void;
41
42
  onFocusChange: (change: FocusChange) => void;
42
43
  translations: QueryAssistTranslations;
43
- autoOpen?: boolean | null | undefined;
44
+ autoOpen?: boolean | null | undefined | 'force';
44
45
  caret?: number | null | undefined;
45
46
  clear?: boolean | null | undefined;
46
47
  className?: string | null | undefined;
@@ -59,6 +60,7 @@ export interface QueryAssistProps {
59
60
  actions?: ReactNode[] | null | undefined;
60
61
  'data-test'?: string | null | undefined;
61
62
  huge?: boolean | null | undefined;
63
+ size: Size;
62
64
  }
63
65
  export interface StyleRange {
64
66
  style: string;
@@ -128,7 +130,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
128
130
  /**
129
131
  * Open suggestions popup during the initial render
130
132
  */
131
- autoOpen: PropTypes.Requireable<boolean>;
133
+ autoOpen: PropTypes.Requireable<string | boolean>;
132
134
  /**
133
135
  * Initial caret position
134
136
  */
@@ -210,6 +212,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
210
212
  actions: PropTypes.Requireable<any[]>;
211
213
  'data-test': PropTypes.Requireable<string>;
212
214
  huge: PropTypes.Requireable<boolean>;
215
+ size: PropTypes.Requireable<string>;
213
216
  };
214
217
  static defaultProps: {
215
218
  onApply: typeof noop;
@@ -217,6 +220,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
217
220
  onApplySuggestion: typeof noop;
218
221
  onClear: typeof noop;
219
222
  onFocusChange: typeof noop;
223
+ size: Size;
220
224
  translations: {
221
225
  searchTitle: string;
222
226
  clearTitle: string;
@@ -18,6 +18,8 @@ import rerenderHOC from '../global/rerender-hoc.js';
18
18
  import { Button } from '../button/button.js';
19
19
  import Icon from '../icon/icon.js';
20
20
  import { ControlsHeightContext, ControlsHeight } from '../global/controls-height.js';
21
+ import { Size } from '../input/input.js';
22
+ import { m as modules_88cfaf40 } from '../_helpers/input.js';
21
23
  import { Q as QueryAssistSuggestions, m as modules_da7ab055 } from '../_helpers/query-assist__suggestions.js';
22
24
  import 'react-dom/server';
23
25
  import '../popup/popup.js';
@@ -68,6 +70,7 @@ import '../global/react-render-adapter.js';
68
70
  import '../global/composeRefs.js';
69
71
  import '@jetbrains/icons/chevron-10px';
70
72
  import '../_helpers/button__classes.js';
73
+ import '../global/prop-types.js';
71
74
 
72
75
  const POPUP_COMPENSATION = PopupMenu.ListProps.Dimension.ITEM_PADDING + PopupMenu.PopupProps.Dimension.BORDER_WIDTH;
73
76
  const ngModelStateField = 'query';
@@ -263,7 +266,7 @@ class QueryAssist extends Component {
263
266
  this.immediateState = props;
264
267
  this.props.onChange(props);
265
268
 
266
- if (props.query.length > 0) {
269
+ if (this.props.autoOpen === 'force' || props.query.length > 0) {
267
270
  var _this$requestData;
268
271
 
269
272
  (_this$requestData = this.requestData) === null || _this$requestData === void 0 ? void 0 : _this$requestData.call(this);
@@ -349,7 +352,7 @@ class QueryAssist extends Component {
349
352
  this.immediateState.caret = caret;
350
353
  this.scrollInput();
351
354
 
352
- if (this.immediateState.query.length > 0) {
355
+ if (this.props.autoOpen === 'force' || this.immediateState.query.length > 0) {
353
356
  var _this$requestData2;
354
357
 
355
358
  (_this$requestData2 = this.requestData) === null || _this$requestData2 === void 0 ? void 0 : _this$requestData2.call(this);
@@ -633,7 +636,7 @@ class QueryAssist extends Component {
633
636
  };
634
637
  this.setupRequestHandler(this.props.delay);
635
638
 
636
- if (this.props.autoOpen && query.length > 0) {
639
+ if (this.props.autoOpen === 'force' || this.props.autoOpen && query.length > 0) {
637
640
  this.requestHandler().catch(noop);
638
641
  } else {
639
642
  this.requestStyleRanges().catch(noop);
@@ -666,7 +669,7 @@ class QueryAssist extends Component {
666
669
  if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
667
670
  this.immediateState.query = query;
668
671
 
669
- if (query && prevProps.autoOpen && query.length > 0) {
672
+ if (prevProps.autoOpen && (query === null || query === void 0 ? void 0 : query.length) > 0) {
670
673
  var _this$requestData5;
671
674
 
672
675
  (_this$requestData5 = this.requestData) === null || _this$requestData5 === void 0 ? void 0 : _this$requestData5.call(this);
@@ -928,13 +931,14 @@ class QueryAssist extends Component {
928
931
  'data-test': dataTest,
929
932
  className,
930
933
  useCustomItemRender,
931
- huge
934
+ huge,
935
+ size
932
936
  } = this.props;
933
937
  const renderPlaceholder = !!this.props.placeholder && this.state.placeholderEnabled;
934
938
  const renderLoader = this.props.loader !== false && this.state.loading;
935
939
  const renderGlass = glass && !renderLoader;
936
940
  const actions = this.renderActions();
937
- const containerClasses = classNames(className, {
941
+ const containerClasses = classNames(className, modules_88cfaf40[`size${huge ? Size.FULL : size}`], {
938
942
  [modules_da7ab055.queryAssist]: true,
939
943
  [modules_da7ab055.withIcon]: renderGlass && !huge || renderLoader,
940
944
  [modules_da7ab055.huge]: huge
@@ -1033,7 +1037,7 @@ _defineProperty(QueryAssist, "propTypes", {
1033
1037
  /**
1034
1038
  * Open suggestions popup during the initial render
1035
1039
  */
1036
- autoOpen: PropTypes.bool,
1040
+ autoOpen: PropTypes.oneOf([true, false, 'force']),
1037
1041
 
1038
1042
  /**
1039
1043
  * Initial caret position
@@ -1133,7 +1137,8 @@ _defineProperty(QueryAssist, "propTypes", {
1133
1137
  translations: PropTypes.object,
1134
1138
  actions: PropTypes.array,
1135
1139
  'data-test': PropTypes.string,
1136
- huge: PropTypes.bool
1140
+ huge: PropTypes.bool,
1141
+ size: PropTypes.string
1137
1142
  });
1138
1143
 
1139
1144
  _defineProperty(QueryAssist, "defaultProps", {
@@ -1142,6 +1147,7 @@ _defineProperty(QueryAssist, "defaultProps", {
1142
1147
  onApplySuggestion: noop,
1143
1148
  onClear: noop,
1144
1149
  onFocusChange: noop,
1150
+ size: Size.L,
1145
1151
  translations: {
1146
1152
  searchTitle: 'Search',
1147
1153
  clearTitle: 'Clear search input'
@@ -72,6 +72,9 @@ import '../button/button.js';
72
72
  import '@jetbrains/icons/chevron-10px';
73
73
  import '../global/controls-height.js';
74
74
  import '../_helpers/button__classes.js';
75
+ import '../input/input.js';
76
+ import '../global/prop-types.js';
77
+ import '../_helpers/input.js';
75
78
  import '../_helpers/query-assist__suggestions.js';
76
79
 
77
80
  var queryAssistNg = angularComponentFactory(QueryAssist, 'QueryAssist').name;