@jetbrains/ring-ui 5.0.167 → 5.0.169

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.
@@ -214,6 +214,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
214
214
  nodeRef: (el: HTMLElement | null) => void;
215
215
  _popup: SelectPopup<SelectItemData<T>> | null;
216
216
  onEmptyPopupEnter: () => void;
217
+ focus: () => void;
217
218
  private _onEnter;
218
219
  private _onEsc;
219
220
  _inputShortcutHandler: () => void;
@@ -337,6 +337,11 @@ export default class Select extends Component {
337
337
  this.addHandler();
338
338
  }
339
339
  };
340
+ focus = () => {
341
+ const focusableSelectExists = this.node?.querySelector('[data-test~=ring-select__focus]');
342
+ const restoreFocusNode = this.props.targetElement || focusableSelectExists;
343
+ restoreFocusNode?.focus();
344
+ };
340
345
  _onEnter = () => {
341
346
  if (this.state.addButton && this.state.shownData.length === 0) {
342
347
  this.addHandler();
@@ -459,12 +464,7 @@ export default class Select extends Component {
459
464
  filterValue: this.props.allowAny ? prevState.filterValue : ''
460
465
  }));
461
466
  if (tryFocusAnchor) {
462
- const focusableSelectExists = this.node &&
463
- this.node.querySelector('[data-test~=ring-select__focus]');
464
- const restoreFocusNode = this.props.targetElement || focusableSelectExists;
465
- if (restoreFocusNode) {
466
- restoreFocusNode.focus();
467
- }
467
+ this.focus();
468
468
  }
469
469
  }
470
470
  }
@@ -38,6 +38,7 @@ export interface TagsInputProps {
38
38
  height?: ControlsHeight | undefined;
39
39
  label?: ReactNode;
40
40
  labelType?: LabelType;
41
+ id?: string | undefined;
41
42
  }
42
43
  interface TagsInputState {
43
44
  tags: TagType[];
@@ -115,6 +116,7 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
115
116
  getInputNode(): HTMLInputElement | null | undefined;
116
117
  setActiveIndex(activeIndex?: number | null): void;
117
118
  focusInput: () => void;
119
+ focus: () => void;
118
120
  addTag: (tag: TagType | null) => void;
119
121
  onRemoveTag(tagToRemove: TagType): Promise<void | TagType[]>;
120
122
  clickHandler: (event: SyntheticEvent) => void;
@@ -94,7 +94,7 @@ export default class TagsInput extends PureComponent {
94
94
  static ngModelStateField = 'tags';
95
95
  ngModelStateField;
96
96
  static contextType = ControlsHeightContext;
97
- id = getUID('ring-tags-list-');
97
+ id = this.props.id || getUID('ring-tags-list-');
98
98
  node;
99
99
  nodeRef = (node) => {
100
100
  this.node = node;
@@ -116,6 +116,9 @@ export default class TagsInput extends PureComponent {
116
116
  focusInput = () => {
117
117
  this.getInputNode()?.focus();
118
118
  };
119
+ focus = () => {
120
+ this.focusInput();
121
+ };
119
122
  addTag = (tag) => {
120
123
  if (tag == null) {
121
124
  return;
@@ -214,6 +214,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
214
214
  nodeRef: (el: HTMLElement | null) => void;
215
215
  _popup: SelectPopup<SelectItemData<T>> | null;
216
216
  onEmptyPopupEnter: () => void;
217
+ focus: () => void;
217
218
  private _onEnter;
218
219
  private _onEsc;
219
220
  _inputShortcutHandler: () => void;
@@ -347,6 +347,12 @@ var Select = /*#__PURE__*/function (_Component) {
347
347
  _this.addHandler();
348
348
  }
349
349
  });
350
+ _defineProperty(_assertThisInitialized(_this), "focus", function () {
351
+ var _this$node;
352
+ var focusableSelectExists = (_this$node = _this.node) === null || _this$node === void 0 ? void 0 : _this$node.querySelector('[data-test~=ring-select__focus]');
353
+ var restoreFocusNode = _this.props.targetElement || focusableSelectExists;
354
+ restoreFocusNode === null || restoreFocusNode === void 0 ? void 0 : restoreFocusNode.focus();
355
+ });
350
356
  _defineProperty(_assertThisInitialized(_this), "_onEnter", function () {
351
357
  var _this$_popup2;
352
358
  if (_this.state.addButton && _this.state.shownData.length === 0) {
@@ -785,11 +791,7 @@ var Select = /*#__PURE__*/function (_Component) {
785
791
  };
786
792
  });
787
793
  if (tryFocusAnchor) {
788
- var focusableSelectExists = this.node && this.node.querySelector('[data-test~=ring-select__focus]');
789
- var restoreFocusNode = this.props.targetElement || focusableSelectExists;
790
- if (restoreFocusNode) {
791
- restoreFocusNode.focus();
792
- }
794
+ this.focus();
793
795
  }
794
796
  }
795
797
  }
@@ -38,6 +38,7 @@ export interface TagsInputProps {
38
38
  height?: ControlsHeight | undefined;
39
39
  label?: ReactNode;
40
40
  labelType?: LabelType;
41
+ id?: string | undefined;
41
42
  }
42
43
  interface TagsInputState {
43
44
  tags: TagType[];
@@ -115,6 +116,7 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
115
116
  getInputNode(): HTMLInputElement | null | undefined;
116
117
  setActiveIndex(activeIndex?: number | null): void;
117
118
  focusInput: () => void;
119
+ focus: () => void;
118
120
  addTag: (tag: TagType | null) => void;
119
121
  onRemoveTag(tagToRemove: TagType): Promise<void | TagType[]>;
120
122
  clickHandler: (event: SyntheticEvent) => void;
@@ -142,7 +142,7 @@ var TagsInput = /*#__PURE__*/function (_PureComponent) {
142
142
  activeIndex: 0
143
143
  });
144
144
  _defineProperty(_assertThisInitialized(_this), "ngModelStateField", void 0);
145
- _defineProperty(_assertThisInitialized(_this), "id", getUID('ring-tags-list-'));
145
+ _defineProperty(_assertThisInitialized(_this), "id", _this.props.id || getUID('ring-tags-list-'));
146
146
  _defineProperty(_assertThisInitialized(_this), "node", void 0);
147
147
  _defineProperty(_assertThisInitialized(_this), "nodeRef", function (node) {
148
148
  _this.node = node;
@@ -153,6 +153,9 @@ var TagsInput = /*#__PURE__*/function (_PureComponent) {
153
153
  var _this$getInputNode;
154
154
  (_this$getInputNode = _this.getInputNode()) === null || _this$getInputNode === void 0 ? void 0 : _this$getInputNode.focus();
155
155
  });
156
+ _defineProperty(_assertThisInitialized(_this), "focus", function () {
157
+ _this.focusInput();
158
+ });
156
159
  _defineProperty(_assertThisInitialized(_this), "addTag", function (tag) {
157
160
  var _this$select, _this$select2;
158
161
  if (tag == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.167",
3
+ "version": "5.0.169",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -45,7 +45,7 @@
45
45
  "hermione-test-ci": "npm --prefix packages/hermione run test-ci",
46
46
  "hermione-gather": "npm --prefix packages/hermione run gather",
47
47
  "build-examples": "storybook build --quiet -c .storybook -o storybook-dist",
48
- "prebuild": "rimraf components && tsc --project tsconfig-build.json && cpy '**/*' '!**/*.ts' '!**/*.tsx' ../components --parents --cwd=src/",
48
+ "prebuild": "rimraf components && tsc --project tsconfig-build.json && cpy '**/*' '!**/*.ts' '!**/*.tsx' '!**/__mocks__/**' ../components --parents --cwd=src/",
49
49
  "build": "./node_modules/.bin/rollup -c --bundleConfigAsCjs",
50
50
  "postbuild": "cpy '**/*.d.ts' ../dist --parents --cwd=components/",
51
51
  "serve": "npm --prefix packages/hermione run serve",
@@ -85,19 +85,19 @@
85
85
  "@rollup/plugin-json": "^6.0.0",
86
86
  "@rollup/plugin-node-resolve": "^15.2.1",
87
87
  "@rollup/plugin-replace": "^5.0.2",
88
- "@storybook/addon-a11y": "7.3.2",
89
- "@storybook/addon-docs": "7.3.2",
90
- "@storybook/addon-essentials": "7.3.2",
88
+ "@storybook/addon-a11y": "7.4.0",
89
+ "@storybook/addon-docs": "7.4.0",
90
+ "@storybook/addon-essentials": "7.4.0",
91
91
  "@storybook/addon-storyshots": "7.2.0",
92
- "@storybook/addon-storyshots-puppeteer": "7.3.2",
93
- "@storybook/addon-storysource": "7.3.2",
94
- "@storybook/addons": "7.3.2",
92
+ "@storybook/addon-storyshots-puppeteer": "7.4.0",
93
+ "@storybook/addon-storysource": "7.4.0",
94
+ "@storybook/addons": "7.4.0",
95
95
  "@storybook/html": "7.2.0",
96
- "@storybook/html-webpack5": "^7.3.2",
96
+ "@storybook/html-webpack5": "^7.4.0",
97
97
  "@storybook/preview-api": "7.2.0",
98
98
  "@storybook/react": "7.3.2",
99
- "@storybook/source-loader": "7.3.2",
100
- "@storybook/theming": "7.3.2",
99
+ "@storybook/source-loader": "7.4.0",
100
+ "@storybook/theming": "7.4.0",
101
101
  "@testing-library/react": "^14.0.0",
102
102
  "@testing-library/user-event": "^14.4.3",
103
103
  "@types/chai": "^4.3.5",
@@ -109,8 +109,8 @@
109
109
  "@types/react-dom": "^18.2.7",
110
110
  "@types/sinon": "^10.0.16",
111
111
  "@types/sinon-chai": "^3.2.9",
112
- "@typescript-eslint/eslint-plugin": "^6.4.1",
113
- "@typescript-eslint/parser": "^6.4.1",
112
+ "@typescript-eslint/eslint-plugin": "^6.5.0",
113
+ "@typescript-eslint/parser": "^6.5.0",
114
114
  "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
115
115
  "acorn": "^8.10.0",
116
116
  "angular": "^1.8.3",
@@ -127,7 +127,7 @@
127
127
  "core-js": "^3.32.1",
128
128
  "cpy-cli": "^3.1.1",
129
129
  "enzyme": "^3.11.0",
130
- "eslint": "^8.47.0",
130
+ "eslint": "^8.48.0",
131
131
  "eslint-import-resolver-webpack": "^0.13.7",
132
132
  "eslint-plugin-angular": "^4.1.0",
133
133
  "eslint-plugin-bdd": "^2.1.1",
@@ -154,8 +154,8 @@
154
154
  "merge-options": "^3.0.4",
155
155
  "mocha": "^10.2.0",
156
156
  "pinst": "^3.0.0",
157
- "prettier": "^3.0.2",
158
- "puppeteer": "^21.1.0",
157
+ "prettier": "^3.0.3",
158
+ "puppeteer": "^21.1.1",
159
159
  "raw-loader": "^4.0.2",
160
160
  "react": "^18.2.0",
161
161
  "react-dom": "^18.2.0",
@@ -238,13 +238,13 @@
238
238
  "interpolate-loader": "^2.0.1",
239
239
  "just-debounce-it": "^3.2.0",
240
240
  "memoize-one": "^6.0.0",
241
- "postcss": "^8.4.28",
241
+ "postcss": "^8.4.29",
242
242
  "postcss-calc": "^9.0.1",
243
243
  "postcss-flexbugs-fixes": "^5.0.2",
244
244
  "postcss-font-family-system-ui": "^5.0.0",
245
245
  "postcss-loader": "^7.3.3",
246
246
  "postcss-modules-values-replace": "^4.1.0",
247
- "postcss-preset-env": "^9.1.1",
247
+ "postcss-preset-env": "^9.1.2",
248
248
  "prop-types": "^15.8.1",
249
249
  "react-markdown": "^8.0.7",
250
250
  "react-movable": "^3.0.4",
@@ -1,5 +0,0 @@
1
- export default class LoaderCore {
2
- startAnimation() {}
3
- stopAnimation() {}
4
- destroy() {}
5
- }
@@ -1 +0,0 @@
1
- export function stop() {}