@jetbrains/ring-ui 5.1.11 → 5.1.13

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.
@@ -172,6 +172,14 @@
172
172
  border-bottom-left-radius: var(--ring-border-radius);
173
173
  }
174
174
 
175
+ /* stylelint-disable-next-line selector-max-specificity */
176
+ .common > button:first-child > div:first-child,
177
+ .common > .button:first-child > div:first-child,
178
+ .common > :first-child .button > div:first-child {
179
+ border-top-right-radius: 0;
180
+ border-bottom-right-radius: 0;
181
+ }
182
+
175
183
  .common > .button:last-child,
176
184
  .common > button:last-child,
177
185
  .common > :last-child .button {
@@ -179,6 +187,14 @@
179
187
  border-bottom-right-radius: var(--ring-border-radius);
180
188
  }
181
189
 
190
+ /* stylelint-disable-next-line selector-max-specificity */
191
+ .common > .button:last-child > div:first-child,
192
+ .common > button:last-child > div:first-child,
193
+ .common > :last-child .button > div:first-child {
194
+ border-top-left-radius: 0;
195
+ border-bottom-left-radius: 0;
196
+ }
197
+
182
198
  .split .primary:not(:last-child) {
183
199
  margin-right: 1px;
184
200
  }
@@ -1,4 +1,5 @@
1
1
  import React, { ComponentType, ReactNode, SyntheticEvent } from 'react';
2
+ import { ReactElement } from 'react-markdown/lib/react-markdown';
2
3
  import { LinkProps } from '../link/link';
3
4
  import { IconType, Size } from '../icon/icon';
4
5
  import { ClickableLinkProps } from '../link/clickableLink';
@@ -55,6 +56,7 @@ export type ListDataItem<T = unknown> = T & Partial<Omit<LinkProps, 'onClick' |
55
56
  originalModel?: never;
56
57
  LinkComponent?: ComponentType<ClickableLinkProps> | string | null | undefined;
57
58
  template?: ReactNode | ((props: ListDataItemProps<T>) => ReactNode);
59
+ wrapper?: (children: ReactNode) => ReactElement;
58
60
  custom?: boolean | null | undefined;
59
61
  onClick?: ((item: ListDataItem<T>, event: Event | SyntheticEvent) => void) | null | undefined;
60
62
  onMouseUp?: ((item: ListDataItem<T>, event: Event | SyntheticEvent) => void) | null | undefined;
@@ -29,6 +29,7 @@ export interface ListProps<T = unknown> {
29
29
  onScrollToBottom: () => void;
30
30
  onResize: (info: Size) => void;
31
31
  shortcuts: boolean;
32
+ shortcutsMap?: ShortcutsMap;
32
33
  renderOptimization: boolean;
33
34
  disableMoveDownOverflow: boolean;
34
35
  ariaLabel: string;
@@ -99,6 +100,7 @@ export default class List<T = unknown> extends Component<ListProps<T>, ListState
99
100
  activateSingleItem: PropTypes.Requireable<boolean>;
100
101
  activateFirstItem: PropTypes.Requireable<boolean>;
101
102
  shortcuts: PropTypes.Requireable<boolean>;
103
+ shortcutsMap: PropTypes.Requireable<object>;
102
104
  onMouseOut: PropTypes.Requireable<(...args: any[]) => any>;
103
105
  onSelect: PropTypes.Requireable<(...args: any[]) => any>;
104
106
  onScrollToBottom: PropTypes.Requireable<(...args: any[]) => any>;
@@ -73,6 +73,7 @@ export default class List extends Component {
73
73
  activateSingleItem: PropTypes.bool,
74
74
  activateFirstItem: PropTypes.bool,
75
75
  shortcuts: PropTypes.bool,
76
+ shortcutsMap: PropTypes.object,
76
77
  onMouseOut: PropTypes.func,
77
78
  onSelect: PropTypes.func,
78
79
  onScrollToBottom: PropTypes.func,
@@ -480,7 +481,12 @@ export default class List extends Component {
480
481
  default:
481
482
  throw new Error(`Unknown menu element type: ${itemProps.rgItemType}`);
482
483
  }
483
- el = <ItemComponent {...itemProps}/>;
484
+ if (itemProps.wrapper) {
485
+ el = itemProps.wrapper(<ItemComponent {...itemProps}/>);
486
+ }
487
+ else {
488
+ el = <ItemComponent {...itemProps}/>;
489
+ }
484
490
  }
485
491
  return parent
486
492
  ? (<CellMeasurer cache={this._cache} key={itemKey} parent={parent} rowIndex={index} columnIndex={0}>
@@ -576,7 +582,9 @@ export default class List extends Component {
576
582
  <ActiveItemContext.Updater value={this.getId(this.state.activeItem)} skipUpdate={this.props.hidden || !isActivatable(this.state.activeItem)}/>
577
583
  <div id={this.props.id} ref={this.containerRef} className={classes} onMouseOut={this.props.onMouseOut} onBlur={this.props.onMouseOut} onMouseLeave={this.clearSelected} data-test="ring-list">
578
584
  {this.props.shortcuts &&
579
- (<Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>)}
585
+ (<Shortcuts map={this.props.shortcutsMap
586
+ ? { ...this.shortcutsMap, ...this.props.shortcutsMap }
587
+ : this.shortcutsMap} scope={this.shortcutsScope}/>)}
580
588
  {this.props.renderOptimization
581
589
  ? this.renderVirtualized(maxHeight, rowCount)
582
590
  : this.renderSimple(maxHeight, rowCount)}
@@ -297,6 +297,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
297
297
  clearRef: (node: ComponentRef<typeof Button> | null) => void;
298
298
  shortcutsScope: string;
299
299
  shortcutsMap: ShortcutsMap;
300
+ listShortcutsMap: ShortcutsMap;
300
301
  renderActions(): React.ReactNode[];
301
302
  render(): React.JSX.Element;
302
303
  }
@@ -771,6 +771,10 @@ export default class QueryAssist extends Component {
771
771
  home: noop,
772
772
  end: noop
773
773
  };
774
+ listShortcutsMap = {
775
+ home: noop,
776
+ end: noop
777
+ };
774
778
  renderActions() {
775
779
  const actions = [...(this.props.actions || [])];
776
780
  const renderClear = this.props.clear && !!this.state.query;
@@ -830,7 +834,7 @@ export default class QueryAssist extends Component {
830
834
  ? (<div data-test="ring-query-assist-actions" className={styles.actions}>{actions}</div>)
831
835
  : null}
832
836
 
833
- <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)}/>
837
+ <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} shortcutsMap={this.listShortcutsMap} 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)}/>
834
838
 
835
839
  {glass && huge && (<div className={styles.rightSearchButton} data-test="query-assist-search-button">
836
840
  <Icon glyph={searchIcon} className={styles.rightSearchIcon} title={translations?.searchTitle ?? translate('searchTitle')} onClick={this.handleApply} ref={this.glassRef} data-test="query-assist-search-icon"/>
@@ -1,4 +1,5 @@
1
1
  import React, { ComponentType, ReactNode, SyntheticEvent } from 'react';
2
+ import { ReactElement } from 'react-markdown/lib/react-markdown';
2
3
  import { LinkProps } from '../link/link';
3
4
  import { IconType, Size } from '../icon/icon';
4
5
  import { ClickableLinkProps } from '../link/clickableLink';
@@ -55,6 +56,7 @@ export type ListDataItem<T = unknown> = T & Partial<Omit<LinkProps, 'onClick' |
55
56
  originalModel?: never;
56
57
  LinkComponent?: ComponentType<ClickableLinkProps> | string | null | undefined;
57
58
  template?: ReactNode | ((props: ListDataItemProps<T>) => ReactNode);
59
+ wrapper?: (children: ReactNode) => ReactElement;
58
60
  custom?: boolean | null | undefined;
59
61
  onClick?: ((item: ListDataItem<T>, event: Event | SyntheticEvent) => void) | null | undefined;
60
62
  onMouseUp?: ((item: ListDataItem<T>, event: Event | SyntheticEvent) => void) | null | undefined;
@@ -29,6 +29,7 @@ export interface ListProps<T = unknown> {
29
29
  onScrollToBottom: () => void;
30
30
  onResize: (info: Size) => void;
31
31
  shortcuts: boolean;
32
+ shortcutsMap?: ShortcutsMap;
32
33
  renderOptimization: boolean;
33
34
  disableMoveDownOverflow: boolean;
34
35
  ariaLabel: string;
@@ -99,6 +100,7 @@ export default class List<T = unknown> extends Component<ListProps<T>, ListState
99
100
  activateSingleItem: PropTypes.Requireable<boolean>;
100
101
  activateFirstItem: PropTypes.Requireable<boolean>;
101
102
  shortcuts: PropTypes.Requireable<boolean>;
103
+ shortcutsMap: PropTypes.Requireable<object>;
102
104
  onMouseOut: PropTypes.Requireable<(...args: any[]) => any>;
103
105
  onSelect: PropTypes.Requireable<(...args: any[]) => any>;
104
106
  onScrollToBottom: PropTypes.Requireable<(...args: any[]) => any>;
package/dist/list/list.js CHANGED
@@ -419,7 +419,11 @@ var List = /*#__PURE__*/function (_Component) {
419
419
  default:
420
420
  throw new Error("Unknown menu element type: ".concat(itemProps.rgItemType));
421
421
  }
422
- el = /*#__PURE__*/React.createElement(ItemComponent, itemProps);
422
+ if (itemProps.wrapper) {
423
+ el = itemProps.wrapper( /*#__PURE__*/React.createElement(ItemComponent, itemProps));
424
+ } else {
425
+ el = /*#__PURE__*/React.createElement(ItemComponent, itemProps);
426
+ }
423
427
  }
424
428
  return parent ? /*#__PURE__*/React.createElement(CellMeasurer, {
425
429
  cache: _this._cache,
@@ -703,7 +707,7 @@ var List = /*#__PURE__*/function (_Component) {
703
707
  onMouseLeave: this.clearSelected,
704
708
  "data-test": "ring-list"
705
709
  }, this.props.shortcuts && /*#__PURE__*/React.createElement(Shortcuts, {
706
- map: this.shortcutsMap,
710
+ map: this.props.shortcutsMap ? _objectSpread2(_objectSpread2({}, this.shortcutsMap), this.props.shortcutsMap) : this.shortcutsMap,
707
711
  scope: this.shortcutsScope
708
712
  }), this.props.renderOptimization ? this.renderVirtualized(maxHeight, rowCount) : this.renderSimple(maxHeight, rowCount), this.state.hasOverflow && !this.state.scrolledToBottom && /*#__PURE__*/React.createElement("div", {
709
713
  className: modules_3b67a421.fade,
@@ -766,6 +770,7 @@ _defineProperty(List, "propTypes", {
766
770
  activateSingleItem: PropTypes.bool,
767
771
  activateFirstItem: PropTypes.bool,
768
772
  shortcuts: PropTypes.bool,
773
+ shortcutsMap: PropTypes.object,
769
774
  onMouseOut: PropTypes.func,
770
775
  onSelect: PropTypes.func,
771
776
  onScrollToBottom: PropTypes.func,
@@ -12,11 +12,11 @@ var MAJOR_VERSION_INDEX = 0;
12
12
  /**
13
13
  * SUPPORTED_BROWSERS are defined by Babel plugin, see babel config
14
14
  */
15
- if (!["and_chr 117", "chrome 117", "chrome 116", "chrome 115", "chrome 109", "edge 117", "edge 116", "firefox 117", "ios_saf 16.6", "ios_saf 15.6-15.7", "op_mini all", "safari 16.6", "samsung 22"]) {
15
+ if (!["and_chr 118", "chrome 117", "chrome 116", "chrome 115", "chrome 109", "edge 117", "edge 116", "firefox 117", "ios_saf 16.6", "ios_saf 15.6-15.7", "op_mini all", "safari 16.6", "samsung 22"]) {
16
16
  // eslint-disable-next-line no-console
17
17
  console.warn('Ring UI: no SUPPORTED_BROWSERS passed. Please check babel config.');
18
18
  }
19
- var SUPPORTED = ["and_chr 117", "chrome 117", "chrome 116", "chrome 115", "chrome 109", "edge 117", "edge 116", "firefox 117", "ios_saf 16.6", "ios_saf 15.6-15.7", "op_mini all", "safari 16.6", "samsung 22"] || [];
19
+ var SUPPORTED = ["and_chr 118", "chrome 117", "chrome 116", "chrome 115", "chrome 109", "edge 117", "edge 116", "firefox 117", "ios_saf 16.6", "ios_saf 15.6-15.7", "op_mini all", "safari 16.6", "samsung 22"] || [];
20
20
  var WHITE_LISTED_BROWSERS = ['chrome', 'firefox', 'safari', 'edge'];
21
21
  var WHITE_LIST = SUPPORTED.reduce(function (acc, item) {
22
22
  var _item$match;
@@ -297,6 +297,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
297
297
  clearRef: (node: ComponentRef<typeof Button> | null) => void;
298
298
  shortcutsScope: string;
299
299
  shortcutsMap: ShortcutsMap;
300
+ listShortcutsMap: ShortcutsMap;
300
301
  renderActions(): React.ReactNode[];
301
302
  render(): React.JSX.Element;
302
303
  }
@@ -567,6 +567,10 @@ var QueryAssist = /*#__PURE__*/function (_Component) {
567
567
  home: noop,
568
568
  end: noop
569
569
  });
570
+ _defineProperty(_assertThisInitialized(_this), "listShortcutsMap", {
571
+ home: noop,
572
+ end: noop
573
+ });
570
574
  var _query = _props.query || '';
571
575
  _this.immediateState = {
572
576
  query: _query,
@@ -945,6 +949,7 @@ var QueryAssist = /*#__PURE__*/function (_Component) {
945
949
  data: useCustomItemRender ? _this8.state.suggestions : _this8.renderSuggestions(),
946
950
  "data-test": "ring-query-assist-popup",
947
951
  hint: _this8.props.hint,
952
+ shortcutsMap: _this8.listShortcutsMap,
948
953
  hintOnSelection: _this8.props.hintOnSelection,
949
954
  left: _this8.getPopupOffset(_this8.state.suggestions),
950
955
  maxHeight: PopupMenu.PopupProps.MaxHeight.SCREEN,