@jetbrains/ring-ui 5.0.31 → 5.0.33

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.
@@ -1,8 +1,10 @@
1
- import React, { Component, PureComponent, SyntheticEvent } from 'react';
1
+ import React, { Component, PureComponent, SyntheticEvent, ReactNode } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Select, { SelectItem } from '../select/select';
4
4
  import { TagType } from '../tags-list/tags-list';
5
5
  import Caret from '../caret/caret';
6
+ import { Size } from '../input/input';
7
+ import { ControlsHeight } from '../global/controls-height';
6
8
  import { Filter } from '../select/select__popup';
7
9
  declare function noop(): void;
8
10
  export interface ToggleTagParams {
@@ -22,7 +24,6 @@ export interface TagsInputProps {
22
24
  disabled: boolean;
23
25
  autoOpen: boolean;
24
26
  renderOptimization: boolean;
25
- legacyMode: boolean;
26
27
  allowAddNewTags: boolean;
27
28
  filter: boolean | Filter;
28
29
  placeholder: string;
@@ -30,6 +31,9 @@ export interface TagsInputProps {
30
31
  tags?: readonly TagType[] | null | undefined;
31
32
  loadingMessage?: string | undefined;
32
33
  notFoundMessage?: string | undefined;
34
+ size: Size;
35
+ height?: ControlsHeight | undefined;
36
+ label?: ReactNode;
33
37
  }
34
38
  interface TagsInputState {
35
39
  tags: TagType[];
@@ -61,7 +65,6 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
61
65
  disabled: PropTypes.Requireable<boolean>;
62
66
  autoOpen: PropTypes.Requireable<boolean>;
63
67
  renderOptimization: PropTypes.Requireable<boolean>;
64
- legacyMode: PropTypes.Requireable<boolean>;
65
68
  filter: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
66
69
  fn: PropTypes.Requireable<(...args: any[]) => any>;
67
70
  }> | null | undefined>>;
@@ -80,12 +83,12 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
80
83
  disabled: boolean;
81
84
  autoOpen: boolean;
82
85
  renderOptimization: boolean;
83
- legacyMode: boolean;
84
86
  allowAddNewTags: boolean;
85
87
  filter: {
86
88
  fn: () => boolean;
87
89
  };
88
90
  placeholder: string;
91
+ size: Size;
89
92
  };
90
93
  constructor(props: TagsInputProps);
91
94
  state: TagsInputState;
@@ -95,6 +98,8 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
95
98
  componentDidMount(): void;
96
99
  static ngModelStateField: string;
97
100
  ngModelStateField: string;
101
+ static contextType: React.Context<ControlsHeight>;
102
+ id: string;
98
103
  node?: HTMLElement | null;
99
104
  nodeRef: (node: HTMLElement | null) => void;
100
105
  input?: HTMLInputElement | null;
@@ -8,6 +8,10 @@ import TagsList from '../tags-list/tags-list.js';
8
8
  import Caret from '../caret/caret.js';
9
9
  import memoize from '../global/memoize.js';
10
10
  import rerenderHOC from '../global/rerender-hoc.js';
11
+ import { Size } from '../input/input.js';
12
+ import { ControlsHeightContext } from '../global/controls-height.js';
13
+ import getUID from '../global/get-uid.js';
14
+ import { m as modules_88cfaf40 } from '../_helpers/input.js';
11
15
  import '@jetbrains/icons/chevron-down';
12
16
  import '@jetbrains/icons/close-12px';
13
17
  import 'deep-equal';
@@ -24,13 +28,11 @@ import '../icon/icon__svg.js';
24
28
  import '../button/button.js';
25
29
  import 'focus-visible';
26
30
  import '../link/clickableLink.js';
27
- import '../global/controls-height.js';
28
31
  import '../_helpers/button__classes.js';
29
32
  import '../avatar/avatar.js';
30
33
  import '../global/url.js';
31
34
  import '../global/dom.js';
32
35
  import '../avatar/fallback-avatar.js';
33
- import '../global/get-uid.js';
34
36
  import '../popup/popup.js';
35
37
  import 'react-dom';
36
38
  import '../global/schedule-raf.js';
@@ -64,10 +66,6 @@ import '../list/list__title.js';
64
66
  import '../list/list__separator.js';
65
67
  import '../list/list__hint.js';
66
68
  import '../list/consts.js';
67
- import '../input/input.js';
68
- import '../global/prop-types.js';
69
- import '../global/composeRefs.js';
70
- import '../_helpers/input.js';
71
69
  import '../global/fuzzy-highlight.js';
72
70
  import '../select/select__popup.js';
73
71
  import '@jetbrains/icons/search';
@@ -77,9 +75,11 @@ import '../shortcuts/shortcuts-hoc.js';
77
75
  import '../text/text.js';
78
76
  import '../_helpers/select__filter.js';
79
77
  import '../tag/tag.js';
78
+ import '../global/prop-types.js';
79
+ import '../global/composeRefs.js';
80
80
  import '../global/react-render-adapter.js';
81
81
 
82
- var modules_5aa8aaf3 = {"outerContainer":"outerContainer_rui_e356","container":"container_rui_e356","input":"input_rui_e356","tagsInput":"tagsInput_rui_1a67","tagsInputLegacyMode":"tagsInputLegacyMode_rui_1a67","tagsList":"tagsList_rui_1a67","tag":"tag_rui_1a67","tagsInputDisabled":"tagsInputDisabled_rui_1a67","underline":"underline_rui_1a67","tagsInputFocused":"tagsInputFocused_rui_1a67","tagsSelect":"tagsSelect_rui_1a67","focusUnderline":"focusUnderline_rui_1a67"};
82
+ var modules_5aa8aaf3 = {"unit":"8px","outerContainer":"outerContainer_rui_e356","container":"container_rui_e356","input":"input_rui_e356","tagsInput":"tagsInput_rui_1a67","tagsInputDisabled":"tagsInputDisabled_rui_1a67","tagsInputFocused":"tagsInputFocused_rui_1a67","tagsList":"tagsList_rui_1a67","tagsSelect":"tagsSelect_rui_1a67"};
83
83
 
84
84
  function noop() {}
85
85
  /**
@@ -107,6 +107,8 @@ class TagsInput extends PureComponent {
107
107
 
108
108
  _defineProperty(this, "ngModelStateField", void 0);
109
109
 
110
+ _defineProperty(this, "id", getUID('ring-tags-list-'));
111
+
110
112
  _defineProperty(this, "node", void 0);
111
113
 
112
114
  _defineProperty(this, "nodeRef", node => {
@@ -390,16 +392,17 @@ class TagsInput extends PureComponent {
390
392
  activeIndex
391
393
  } = this.state;
392
394
  const {
393
- legacyMode,
394
395
  disabled,
395
396
  canNotBeEmpty,
396
397
  allowAddNewTags,
397
- filter
398
+ filter,
399
+ size,
400
+ height = this.context,
401
+ label
398
402
  } = this.props;
399
- const classes = classNames(modules_5aa8aaf3.tagsInput, {
403
+ const classes = classNames(modules_5aa8aaf3.tagsInput, [modules_88cfaf40[`size${size}`]], [modules_88cfaf40[`height${height}`]], {
400
404
  [modules_5aa8aaf3.tagsInputDisabled]: disabled,
401
- [modules_5aa8aaf3.tagsInputFocused]: focused,
402
- [modules_5aa8aaf3.tagsInputLegacyMode]: legacyMode
405
+ [modules_5aa8aaf3.tagsInputFocused]: focused
403
406
  }, this.props.className);
404
407
  return /*#__PURE__*/React.createElement("div", {
405
408
  // it transfers focus to input
@@ -408,7 +411,12 @@ class TagsInput extends PureComponent {
408
411
  onKeyDown: this.handleKeyDown,
409
412
  onClick: this.clickHandler,
410
413
  ref: this.nodeRef
411
- }, /*#__PURE__*/React.createElement(TagsList, {
414
+ }, label && /*#__PURE__*/React.createElement("label", {
415
+ htmlFor: this.id,
416
+ className: classNames(modules_88cfaf40.label, {
417
+ [modules_88cfaf40.disabledLabel]: disabled
418
+ })
419
+ }, label), /*#__PURE__*/React.createElement(TagsList, {
412
420
  tags: tags,
413
421
  activeIndex: activeIndex,
414
422
  disabled: disabled,
@@ -418,6 +426,7 @@ class TagsInput extends PureComponent {
418
426
  tagClassName: modules_5aa8aaf3.tag,
419
427
  handleClick: this.handleClick
420
428
  }, /*#__PURE__*/React.createElement(Select, {
429
+ id: this.id,
421
430
  ref: this.selectRef,
422
431
  size: Select.Size.AUTO,
423
432
  type: Select.Type.INPUT_WITHOUT_CONTROLS,
@@ -443,11 +452,7 @@ class TagsInput extends PureComponent {
443
452
  disabled: this.props.disabled,
444
453
  loadingMessage: this.props.loadingMessage,
445
454
  notFoundMessage: this.props.notFoundMessage
446
- })), !legacyMode && /*#__PURE__*/React.createElement("div", {
447
- className: modules_5aa8aaf3.underline
448
- }), !legacyMode && /*#__PURE__*/React.createElement("div", {
449
- className: modules_5aa8aaf3.focusUnderline
450
- }));
455
+ })));
451
456
  }
452
457
 
453
458
  }
@@ -473,7 +478,6 @@ _defineProperty(TagsInput, "propTypes", {
473
478
  disabled: PropTypes.bool,
474
479
  autoOpen: PropTypes.bool,
475
480
  renderOptimization: PropTypes.bool,
476
- legacyMode: PropTypes.bool,
477
481
  filter: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
478
482
  fn: PropTypes.func
479
483
  })]),
@@ -493,16 +497,18 @@ _defineProperty(TagsInput, "defaultProps", {
493
497
  disabled: false,
494
498
  autoOpen: false,
495
499
  renderOptimization: true,
496
- legacyMode: false,
497
500
  allowAddNewTags: false,
498
501
  filter: {
499
502
  fn: () => true
500
503
  },
501
- placeholder: 'Select an option'
504
+ placeholder: 'Select an option',
505
+ size: Size.M
502
506
  });
503
507
 
504
508
  _defineProperty(TagsInput, "ngModelStateField", 'tags');
505
509
 
510
+ _defineProperty(TagsInput, "contextType", ControlsHeightContext);
511
+
506
512
  const RerenderableTagsInput = rerenderHOC(TagsInput);
507
513
 
508
514
  export { RerenderableTagsInput, TagsInput as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.31",
3
+ "version": "5.0.33",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -73,11 +73,11 @@
73
73
  },
74
74
  "readmeFilename": "README.md",
75
75
  "devDependencies": {
76
- "@babel/cli": "^7.18.10",
76
+ "@babel/cli": "^7.19.3",
77
77
  "@babel/eslint-parser": "^7.19.1",
78
78
  "@jetbrains/eslint-config": "^5.4.1",
79
79
  "@jetbrains/stylelint-config": "^3.0.2",
80
- "@primer/octicons": "^17.5.0",
80
+ "@primer/octicons": "^17.6.0",
81
81
  "@rollup/plugin-babel": "^5.3.1",
82
82
  "@rollup/plugin-node-resolve": "^14.1.0",
83
83
  "@rollup/plugin-replace": "^4.0.0",
@@ -136,8 +136,8 @@
136
136
  "husky": "^8.0.1",
137
137
  "identity-obj-proxy": "^3.0.0",
138
138
  "imports-loader": "^4.0.1",
139
- "jest": "~29.0.3",
140
- "jest-environment-jsdom": "^29.0.3",
139
+ "jest": "~29.1.2",
140
+ "jest-environment-jsdom": "^29.1.2",
141
141
  "jest-teamcity": "^1.10.0",
142
142
  "karma": "^6.4.1",
143
143
  "karma-chrome-launcher": "3.1.1",
@@ -145,7 +145,7 @@
145
145
  "karma-sourcemap-loader": "^0.3.8",
146
146
  "karma-teamcity-reporter": "^2.0.0",
147
147
  "karma-webpack": "^5.0.0",
148
- "lerna": "^5.5.2",
148
+ "lerna": "^5.5.4",
149
149
  "lint-staged": "^13.0.3",
150
150
  "merge-options": "^3.0.4",
151
151
  "mocha": "^10.0.0",
@@ -163,11 +163,11 @@
163
163
  "sinon": "^14.0.0",
164
164
  "sinon-chai": "^3.7.0",
165
165
  "storage-mock": "^2.1.0",
166
- "stylelint": "^14.12.1",
166
+ "stylelint": "^14.13.0",
167
167
  "svg-inline-loader": "^0.8.2",
168
168
  "teamcity-service-messages": "^0.1.14",
169
169
  "terser-webpack-plugin": "^5.3.6",
170
- "typescript": "~4.8.3",
170
+ "typescript": "~4.8.4",
171
171
  "wallaby-webpack": "^3.9.16",
172
172
  "webpack": "^5.74.0",
173
173
  "webpack-cli": "^4.10.0",
@@ -194,11 +194,11 @@
194
194
  }
195
195
  },
196
196
  "dependencies": {
197
- "@babel/core": "^7.19.1",
197
+ "@babel/core": "^7.19.3",
198
198
  "@babel/preset-typescript": "^7.18.6",
199
199
  "@jetbrains/babel-preset-jetbrains": "^2.3.2",
200
200
  "@jetbrains/icons": "^3.19.1",
201
- "@jetbrains/logos": "^2.2.4",
201
+ "@jetbrains/logos": "^2.2.7",
202
202
  "@jetbrains/postcss-require-hover": "^0.1.2",
203
203
  "@types/combokeys": "^2.4.6",
204
204
  "@types/deep-equal": "^1.0.1",
@@ -232,7 +232,7 @@
232
232
  "interpolate-loader": "^2.0.1",
233
233
  "just-debounce-it": "^3.1.1",
234
234
  "memoize-one": "^6.0.0",
235
- "postcss": "^8.4.16",
235
+ "postcss": "^8.4.17",
236
236
  "postcss-calc": "^8.2.4",
237
237
  "postcss-flexbugs-fixes": "^5.0.2",
238
238
  "postcss-font-family-system-ui": "^5.0.0",
@@ -259,5 +259,5 @@
259
259
  "node": ">=14.0",
260
260
  "npm": ">=6.0.0"
261
261
  },
262
- "gitHead": "e8e24573cc2391bd814538c2b8a43684df802e5d"
262
+ "gitHead": "4bff84b6bce0294e76e9cb8d8e292d84e7a1aaac"
263
263
  }