superdesk-ui-framework 3.0.32 → 3.0.36

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.
@@ -96,7 +96,7 @@
96
96
  box-shadow: var(--sd-shadow--z1);
97
97
  border-color: var(--sd-colour-line--strong);
98
98
  }
99
-
99
+
100
100
  }
101
101
  }
102
102
  input:checked {
@@ -145,6 +145,10 @@
145
145
  }
146
146
 
147
147
  [data-theme="dark-ui"] {
148
+ input[type="time"]::-webkit-calendar-picker-indicator {
149
+ filter: invert(1);
150
+ }
151
+
148
152
  figure[data-theme="dark-ui"] {
149
153
  --color-text: hsla(0, 0%, 96%, 1);
150
154
  --color-text-light: hsla(214, 13%, 96%, 0.75);
@@ -173,7 +177,7 @@
173
177
  --sd-colour--shadow-line: hsla(214, 13%, 70%, 0);
174
178
  --sd-colour-line--medium: hsla(214, 13%, 20%, 0.2);
175
179
 
176
-
180
+
177
181
  }
178
182
  figure[data-theme="contrast-light-ui"] {
179
183
  --color-text: hsla(0, 0%, 0%, 1);
@@ -186,4 +190,4 @@
186
190
  --sd-colour--shadow-line: hsla(214, 13%, 60%, 0);
187
191
  --sd-colour-line--medium: hsla(214, 13%, 20%, 0.4);
188
192
  }
189
- }
193
+ }
@@ -653,11 +653,16 @@
653
653
  grid-row: 2/3;
654
654
  grid-column: 2/4;
655
655
  }
656
+
656
657
  .sd-input__input-container {
657
658
  grid-row: 2/3;
658
659
  grid-column: 2/4;
659
660
  }
660
661
 
662
+ .sd-input__input-container:has(input[type="time"]) {
663
+ min-width: 110px;
664
+ }
665
+
661
666
  textarea {
662
667
  &.sd-input__input {
663
668
  height: auto;
@@ -29,7 +29,6 @@
29
29
  transition: all 0.2s ease-out, color 0.1s ease-out;
30
30
  &:hover {
31
31
  background-color: hsla(214, 13%, 55%, 0.2);
32
-
33
32
  }
34
33
  &:active {
35
34
  background-color: hsla(214, 13%, 55%, 0.3);
@@ -154,7 +153,7 @@
154
153
  .p-calendar {
155
154
  @include pr-input-item-base;
156
155
  .p-inputtext {
157
- color: inherit;
156
+ color: var(--color-text);
158
157
  height: $height-input--default;
159
158
  background-color: transparent;
160
159
  border: none;
@@ -178,7 +177,7 @@
178
177
  margin: 0 4px 0 0;
179
178
  [class^="icon-"],
180
179
  [class*=" icon-"] {
181
- color: inherit;
180
+ color: var(--color-text);
182
181
  margin-top: -2px;
183
182
  opacity: 0.75;
184
183
  }
@@ -193,4 +192,4 @@
193
192
  }
194
193
  .p-datepicker-calendar {
195
194
  margin-bottom: 8px;
196
- }
195
+ }
@@ -24,29 +24,31 @@ export class TimePicker extends React.PureComponent<IProps> {
24
24
  render() {
25
25
  return (
26
26
  <InputWrapper
27
- label={this.props.label}
28
- error={this.props.error}
29
- required={this.props.required}
30
- disabled={this.props.disabled}
31
- invalid={this.props.invalid}
32
- info={this.props.info}
33
- inlineLabel={this.props.inlineLabel}
34
- labelHidden={this.props.labelHidden}
35
- fullWidth={this.props.fullWidth}
36
- htmlId={this.htmlId}
37
- tabindex={this.props.tabindex}>
38
- <input
39
- id={this.htmlId}
40
- aria-labelledby={this.htmlId + 'label'}
41
- type="time"
42
- step={this.props.allowSeconds ? 1 : undefined}
43
- className="sd-input__input"
44
- value={this.props.value}
27
+ label={this.props.label}
28
+ error={this.props.error}
45
29
  required={this.props.required}
46
30
  disabled={this.props.disabled}
47
- onChange={(event) => {
48
- this.props.onChange(event.target.value);
49
- }}/>
31
+ invalid={this.props.invalid}
32
+ info={this.props.info}
33
+ inlineLabel={this.props.inlineLabel}
34
+ labelHidden={this.props.labelHidden}
35
+ fullWidth={this.props.fullWidth}
36
+ htmlId={this.htmlId}
37
+ tabindex={this.props.tabindex}
38
+ >
39
+ <input
40
+ id={this.htmlId}
41
+ aria-labelledby={this.htmlId + 'label'}
42
+ type="time"
43
+ step={this.props.allowSeconds ? 1 : undefined}
44
+ className="sd-input__input"
45
+ value={this.props.value}
46
+ required={this.props.required}
47
+ disabled={this.props.disabled}
48
+ onChange={(event) => {
49
+ this.props.onChange(event.target.value);
50
+ }}
51
+ />
50
52
  </InputWrapper>
51
53
  );
52
54
  }
@@ -109,6 +109,8 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
109
109
  this.branchButton = this.branchButton.bind(this);
110
110
  this.handleDebounce = this.handleDebounce.bind(this);
111
111
  this.toggleMenu = this.toggleMenu.bind(this);
112
+ this.onMouseDown = this.onMouseDown.bind(this);
113
+ this.onKeyDown = this.onKeyDown.bind(this);
112
114
  this.dropdownRef = React.createRef();
113
115
  this.ref = React.createRef();
114
116
  this.inputRef = React.createRef();
@@ -129,38 +131,47 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
129
131
  this.categoryButtonRef.current?.focus();
130
132
  }
131
133
 
132
- componentDidMount = () => {
133
- this.recursion(this.state.options);
134
- document.addEventListener("mousedown", (event) => {
135
- if (
136
- (this.dropdownRef.current?.contains(event.target as HTMLElement) !== true)
137
- && (this.openDropdownRef.current?.contains(event.target as HTMLElement) !== true)
138
- ) {
139
- this.setState({openDropdown: false});
134
+ onMouseDown = (event: MouseEvent) => {
135
+ if (
136
+ (this.dropdownRef.current?.contains(event.target as HTMLElement) !== true)
137
+ && (this.openDropdownRef.current?.contains(event.target as HTMLElement) !== true)
138
+ ) {
139
+ this.setState({openDropdown: false});
140
+ }
141
+ }
142
+
143
+ onKeyDown = (e: KeyboardEvent) => {
144
+ if (this.state.openDropdown && this.ref.current) {
145
+ keyboardNavigation(
146
+ e,
147
+ this.ref.current,
148
+ this.categoryButtonRef.current ? this.buttonFocus : this.inputFocus,
149
+ );
150
+ if (e.key === 'Backspace') {
151
+ this.backButton();
152
+ this.backButtonValue();
153
+
154
+ const {buttonTarget} = this.state;
155
+ const className = buttonTarget.pop();
156
+
157
+ if (className != null) {
158
+ const element: HTMLElement = document.getElementsByClassName(className)[0] as HTMLElement;
159
+ element.focus();
160
+ }
140
161
  }
141
- });
162
+ }
163
+ }
142
164
 
143
- document.addEventListener("keydown", (e: KeyboardEvent) => {
144
- if (this.state.openDropdown && this.ref.current) {
145
- keyboardNavigation(
146
- e,
147
- this.ref.current,
148
- this.categoryButtonRef.current ? this.buttonFocus : this.inputFocus,
149
- );
150
- if (e.key === 'Backspace') {
151
- this.backButton();
152
- this.backButtonValue();
165
+ componentDidMount = () => {
166
+ this.recursion(this.state.options);
153
167
 
154
- const {buttonTarget} = this.state;
155
- const className = buttonTarget.pop();
168
+ document.addEventListener("mousedown", this.onMouseDown);
169
+ document.addEventListener("keydown", this.onKeyDown);
170
+ }
156
171
 
157
- if (className != null) {
158
- const element: HTMLElement = document.getElementsByClassName(className)[0] as HTMLElement;
159
- element.focus();
160
- }
161
- }
162
- }
163
- });
172
+ componentWillUnmount(): void {
173
+ document.removeEventListener("mousedown", this.onMouseDown);
174
+ document.removeEventListener("keydown", this.onKeyDown);
164
175
  }
165
176
 
166
177
  componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void {
@@ -793,7 +804,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
793
804
  }}
794
805
  >
795
806
  <button
796
- className={`suggestion-item--btn ${this.props.getId(option.value)}`}
807
+ className={`suggestion-item--btn z${this.props.getId(option.value)}z`}
797
808
  onKeyDown={(event) => {
798
809
  if (event.key === 'Enter' && option.children) {
799
810
  this.setState({
@@ -64238,30 +64238,32 @@ var TreeSelect = /** @class */ (function (_super) {
64238
64238
  var _a;
64239
64239
  (_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
64240
64240
  };
64241
- _this.componentDidMount = function () {
64242
- _this.recursion(_this.state.options);
64243
- document.addEventListener("mousedown", function (event) {
64244
- var _a, _b;
64245
- if ((((_a = _this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) !== true)
64246
- && (((_b = _this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) !== true)) {
64247
- _this.setState({ openDropdown: false });
64248
- }
64249
- });
64250
- document.addEventListener("keydown", function (e) {
64251
- if (_this.state.openDropdown && _this.ref.current) {
64252
- keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
64253
- if (e.key === 'Backspace') {
64254
- _this.backButton();
64255
- _this.backButtonValue();
64256
- var buttonTarget = _this.state.buttonTarget;
64257
- var className = buttonTarget.pop();
64258
- if (className != null) {
64259
- var element = document.getElementsByClassName(className)[0];
64260
- element.focus();
64261
- }
64241
+ _this.onMouseDown = function (event) {
64242
+ var _a, _b;
64243
+ if ((((_a = _this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) !== true)
64244
+ && (((_b = _this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) !== true)) {
64245
+ _this.setState({ openDropdown: false });
64246
+ }
64247
+ };
64248
+ _this.onKeyDown = function (e) {
64249
+ if (_this.state.openDropdown && _this.ref.current) {
64250
+ keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
64251
+ if (e.key === 'Backspace') {
64252
+ _this.backButton();
64253
+ _this.backButtonValue();
64254
+ var buttonTarget = _this.state.buttonTarget;
64255
+ var className = buttonTarget.pop();
64256
+ if (className != null) {
64257
+ var element = document.getElementsByClassName(className)[0];
64258
+ element.focus();
64262
64259
  }
64263
64260
  }
64264
- });
64261
+ }
64262
+ };
64263
+ _this.componentDidMount = function () {
64264
+ _this.recursion(_this.state.options);
64265
+ document.addEventListener("mousedown", _this.onMouseDown);
64266
+ document.addEventListener("keydown", _this.onKeyDown);
64265
64267
  };
64266
64268
  _this.backButtonValue = function () {
64267
64269
  var item = _this.state.buttonTree.pop();
@@ -64296,6 +64298,8 @@ var TreeSelect = /** @class */ (function (_super) {
64296
64298
  _this.branchButton = _this.branchButton.bind(_this);
64297
64299
  _this.handleDebounce = _this.handleDebounce.bind(_this);
64298
64300
  _this.toggleMenu = _this.toggleMenu.bind(_this);
64301
+ _this.onMouseDown = _this.onMouseDown.bind(_this);
64302
+ _this.onKeyDown = _this.onKeyDown.bind(_this);
64299
64303
  _this.dropdownRef = React.createRef();
64300
64304
  _this.ref = React.createRef();
64301
64305
  _this.inputRef = React.createRef();
@@ -64304,6 +64308,10 @@ var TreeSelect = /** @class */ (function (_super) {
64304
64308
  _this.popperInstance = null;
64305
64309
  return _this;
64306
64310
  }
64311
+ TreeSelect.prototype.componentWillUnmount = function () {
64312
+ document.removeEventListener("mousedown", this.onMouseDown);
64313
+ document.removeEventListener("keydown", this.onKeyDown);
64314
+ };
64307
64315
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
64308
64316
  var _a;
64309
64317
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
@@ -64774,7 +64782,7 @@ var TreeSelect = /** @class */ (function (_super) {
64774
64782
  event.stopPropagation();
64775
64783
  _this.handleTree(event, option);
64776
64784
  } },
64777
- React.createElement("button", { className: "suggestion-item--btn ".concat(_this.props.getId(option.value)), onKeyDown: function (event) {
64785
+ React.createElement("button", { className: "suggestion-item--btn z".concat(_this.props.getId(option.value), "z"), onKeyDown: function (event) {
64778
64786
  if (event.key === 'Enter' && option.children) {
64779
64787
  _this.setState({
64780
64788
  buttonTarget: __spreadArray(__spreadArray([], _this.state.buttonTarget, true), [
@@ -142949,7 +142957,7 @@ exports.ResizablePanelsDoc = ResizablePanelsDoc;
142949
142957
  /* 681 */
142950
142958
  /***/ (function(module, exports) {
142951
142959
 
142952
- module.exports = {"name":"superdesk-ui-framework","version":"3.0.32","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build","unit-test":"mocha","debug-unit-tests":"mocha --inspect-brk"},"devDependencies":{"@types/assert":"^1.5.6","@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.12","@types/lodash":"^4.14.161","@types/mocha":"^9.1.1","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"^5.58.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","jsdom":"20.0.3","jsdom-global":"3.0.2","lodash":"4.17.21","mocha":"^8.4.0","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-bootstrap":"^0.31.2","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","ts-node":"^10.9.1","tslint":"^5.18.0","typescript":"4.9.5","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@material-ui/lab":"^4.0.0-alpha.56","@popperjs/core":"^2.4.0","@superdesk/primereact":"^5.0.2-10","@superdesk/react-resizable-panels":"0.0.39","@types/enzyme-adapter-react-16":"^1.0.6","@types/node":"^14.10.2","chart.js":"^2.9.3","date-fns":"2.7.0","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","moment":"^2.29.3","popper-max-size-modifier":"^0.2.0","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-popper":"^2.2.3","react-scrollspy":"^3.4.3"}}
142960
+ module.exports = {"name":"superdesk-ui-framework","version":"3.0.36","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build","unit-test":"mocha","debug-unit-tests":"mocha --inspect-brk"},"devDependencies":{"@types/assert":"^1.5.6","@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.12","@types/lodash":"^4.14.161","@types/mocha":"^9.1.1","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"^5.58.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","jsdom":"20.0.3","jsdom-global":"3.0.2","lodash":"4.17.21","mocha":"^8.4.0","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-bootstrap":"^0.31.2","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","ts-node":"^10.9.1","tslint":"^5.18.0","typescript":"4.9.5","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@material-ui/lab":"^4.0.0-alpha.56","@popperjs/core":"^2.4.0","@superdesk/primereact":"^5.0.2-10","@superdesk/react-resizable-panels":"0.0.39","@types/enzyme-adapter-react-16":"^1.0.6","@types/node":"^14.10.2","chart.js":"^2.9.3","date-fns":"2.7.0","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","moment":"^2.29.3","popper-max-size-modifier":"^0.2.0","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-popper":"^2.2.3","react-scrollspy":"^3.4.3"}}
142953
142961
 
142954
142962
  /***/ }),
142955
142963
  /* 682 */
@@ -47269,6 +47269,9 @@ textarea.sd-media-carousel__media-title {
47269
47269
  opacity: 0.4;
47270
47270
  border-color: var(--color-checkbox-border) !important; }
47271
47271
 
47272
+ [data-theme="dark-ui"] input[type="time"]::-webkit-calendar-picker-indicator {
47273
+ filter: invert(1); }
47274
+
47272
47275
  [data-theme="dark-ui"] figure[data-theme="dark-ui"] {
47273
47276
  --color-text: hsla(0, 0%, 96%, 1);
47274
47277
  --color-text-light: hsla(214, 13%, 96%, 0.75);
@@ -48982,6 +48985,8 @@ textarea.sd-media-carousel__media-title {
48982
48985
  .sd-input .sd-input__input-container {
48983
48986
  grid-row: 2/3;
48984
48987
  grid-column: 2/4; }
48988
+ .sd-input .sd-input__input-container:has(input[type="time"]) {
48989
+ min-width: 110px; }
48985
48990
  .sd-input textarea.sd-input__input {
48986
48991
  height: auto;
48987
48992
  min-height: 3.2rem; }
@@ -63083,7 +63088,7 @@ i.sd-sidetab-menu__helper-icon {
63083
63088
  box-shadow: 0 1px 0 0 var(--sd-colour-interactive);
63084
63089
  border-color: var(--sd-colour-interactive); }
63085
63090
  .p-calendar .p-inputtext, .p-calendar .p-datepicker-trigger {
63086
- color: inherit;
63091
+ color: var(--color-text);
63087
63092
  height: 3.2rem;
63088
63093
  background-color: transparent;
63089
63094
  border: none;
@@ -63102,7 +63107,7 @@ i.sd-sidetab-menu__helper-icon {
63102
63107
  margin: 0 4px 0 0; }
63103
63108
  .p-calendar-w-btn .p-datepicker-trigger [class^="icon-"],
63104
63109
  .p-calendar-w-btn .p-datepicker-trigger [class*=" icon-"] {
63105
- color: inherit;
63110
+ color: var(--color-text);
63106
63111
  margin-top: -2px;
63107
63112
  opacity: 0.75; }
63108
63113
  .p-calendar-w-btn .p-datepicker-trigger:hover [class^="icon-"],
@@ -63855,30 +63855,32 @@ var TreeSelect = /** @class */ (function (_super) {
63855
63855
  var _a;
63856
63856
  (_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63857
63857
  };
63858
- _this.componentDidMount = function () {
63859
- _this.recursion(_this.state.options);
63860
- document.addEventListener("mousedown", function (event) {
63861
- var _a, _b;
63862
- if ((((_a = _this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) !== true)
63863
- && (((_b = _this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) !== true)) {
63864
- _this.setState({ openDropdown: false });
63865
- }
63866
- });
63867
- document.addEventListener("keydown", function (e) {
63868
- if (_this.state.openDropdown && _this.ref.current) {
63869
- keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
63870
- if (e.key === 'Backspace') {
63871
- _this.backButton();
63872
- _this.backButtonValue();
63873
- var buttonTarget = _this.state.buttonTarget;
63874
- var className = buttonTarget.pop();
63875
- if (className != null) {
63876
- var element = document.getElementsByClassName(className)[0];
63877
- element.focus();
63878
- }
63858
+ _this.onMouseDown = function (event) {
63859
+ var _a, _b;
63860
+ if ((((_a = _this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) !== true)
63861
+ && (((_b = _this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) !== true)) {
63862
+ _this.setState({ openDropdown: false });
63863
+ }
63864
+ };
63865
+ _this.onKeyDown = function (e) {
63866
+ if (_this.state.openDropdown && _this.ref.current) {
63867
+ keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
63868
+ if (e.key === 'Backspace') {
63869
+ _this.backButton();
63870
+ _this.backButtonValue();
63871
+ var buttonTarget = _this.state.buttonTarget;
63872
+ var className = buttonTarget.pop();
63873
+ if (className != null) {
63874
+ var element = document.getElementsByClassName(className)[0];
63875
+ element.focus();
63879
63876
  }
63880
63877
  }
63881
- });
63878
+ }
63879
+ };
63880
+ _this.componentDidMount = function () {
63881
+ _this.recursion(_this.state.options);
63882
+ document.addEventListener("mousedown", _this.onMouseDown);
63883
+ document.addEventListener("keydown", _this.onKeyDown);
63882
63884
  };
63883
63885
  _this.backButtonValue = function () {
63884
63886
  var item = _this.state.buttonTree.pop();
@@ -63913,6 +63915,8 @@ var TreeSelect = /** @class */ (function (_super) {
63913
63915
  _this.branchButton = _this.branchButton.bind(_this);
63914
63916
  _this.handleDebounce = _this.handleDebounce.bind(_this);
63915
63917
  _this.toggleMenu = _this.toggleMenu.bind(_this);
63918
+ _this.onMouseDown = _this.onMouseDown.bind(_this);
63919
+ _this.onKeyDown = _this.onKeyDown.bind(_this);
63916
63920
  _this.dropdownRef = React.createRef();
63917
63921
  _this.ref = React.createRef();
63918
63922
  _this.inputRef = React.createRef();
@@ -63921,6 +63925,10 @@ var TreeSelect = /** @class */ (function (_super) {
63921
63925
  _this.popperInstance = null;
63922
63926
  return _this;
63923
63927
  }
63928
+ TreeSelect.prototype.componentWillUnmount = function () {
63929
+ document.removeEventListener("mousedown", this.onMouseDown);
63930
+ document.removeEventListener("keydown", this.onKeyDown);
63931
+ };
63924
63932
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
63925
63933
  var _a;
63926
63934
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
@@ -64391,7 +64399,7 @@ var TreeSelect = /** @class */ (function (_super) {
64391
64399
  event.stopPropagation();
64392
64400
  _this.handleTree(event, option);
64393
64401
  } },
64394
- React.createElement("button", { className: "suggestion-item--btn ".concat(_this.props.getId(option.value)), onKeyDown: function (event) {
64402
+ React.createElement("button", { className: "suggestion-item--btn z".concat(_this.props.getId(option.value), "z"), onKeyDown: function (event) {
64395
64403
  if (event.key === 'Enter' && option.children) {
64396
64404
  _this.setState({
64397
64405
  buttonTarget: __spreadArray(__spreadArray([], _this.state.buttonTarget, true), [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "3.0.32",
3
+ "version": "3.0.36",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -69,7 +69,10 @@ export declare class TreeSelect<T> extends React.Component<IProps<T>, IState<T>>
69
69
  inputFocus: () => void;
70
70
  listNavigation: () => void;
71
71
  buttonFocus: () => void;
72
+ onMouseDown: (event: MouseEvent) => void;
73
+ onKeyDown: (e: KeyboardEvent) => void;
72
74
  componentDidMount: () => void;
75
+ componentWillUnmount(): void;
73
76
  componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
74
77
  toggleMenu(): void;
75
78
  removeClick(i: number): void;
@@ -77,30 +77,32 @@ var TreeSelect = /** @class */ (function (_super) {
77
77
  var _a;
78
78
  (_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
79
79
  };
80
- _this.componentDidMount = function () {
81
- _this.recursion(_this.state.options);
82
- document.addEventListener("mousedown", function (event) {
83
- var _a, _b;
84
- if ((((_a = _this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) !== true)
85
- && (((_b = _this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) !== true)) {
86
- _this.setState({ openDropdown: false });
87
- }
88
- });
89
- document.addEventListener("keydown", function (e) {
90
- if (_this.state.openDropdown && _this.ref.current) {
91
- keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
92
- if (e.key === 'Backspace') {
93
- _this.backButton();
94
- _this.backButtonValue();
95
- var buttonTarget = _this.state.buttonTarget;
96
- var className = buttonTarget.pop();
97
- if (className != null) {
98
- var element = document.getElementsByClassName(className)[0];
99
- element.focus();
100
- }
80
+ _this.onMouseDown = function (event) {
81
+ var _a, _b;
82
+ if ((((_a = _this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) !== true)
83
+ && (((_b = _this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) !== true)) {
84
+ _this.setState({ openDropdown: false });
85
+ }
86
+ };
87
+ _this.onKeyDown = function (e) {
88
+ if (_this.state.openDropdown && _this.ref.current) {
89
+ keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
90
+ if (e.key === 'Backspace') {
91
+ _this.backButton();
92
+ _this.backButtonValue();
93
+ var buttonTarget = _this.state.buttonTarget;
94
+ var className = buttonTarget.pop();
95
+ if (className != null) {
96
+ var element = document.getElementsByClassName(className)[0];
97
+ element.focus();
101
98
  }
102
99
  }
103
- });
100
+ }
101
+ };
102
+ _this.componentDidMount = function () {
103
+ _this.recursion(_this.state.options);
104
+ document.addEventListener("mousedown", _this.onMouseDown);
105
+ document.addEventListener("keydown", _this.onKeyDown);
104
106
  };
105
107
  _this.backButtonValue = function () {
106
108
  var item = _this.state.buttonTree.pop();
@@ -135,6 +137,8 @@ var TreeSelect = /** @class */ (function (_super) {
135
137
  _this.branchButton = _this.branchButton.bind(_this);
136
138
  _this.handleDebounce = _this.handleDebounce.bind(_this);
137
139
  _this.toggleMenu = _this.toggleMenu.bind(_this);
140
+ _this.onMouseDown = _this.onMouseDown.bind(_this);
141
+ _this.onKeyDown = _this.onKeyDown.bind(_this);
138
142
  _this.dropdownRef = React.createRef();
139
143
  _this.ref = React.createRef();
140
144
  _this.inputRef = React.createRef();
@@ -143,6 +147,10 @@ var TreeSelect = /** @class */ (function (_super) {
143
147
  _this.popperInstance = null;
144
148
  return _this;
145
149
  }
150
+ TreeSelect.prototype.componentWillUnmount = function () {
151
+ document.removeEventListener("mousedown", this.onMouseDown);
152
+ document.removeEventListener("keydown", this.onKeyDown);
153
+ };
146
154
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
147
155
  var _a;
148
156
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
@@ -613,7 +621,7 @@ var TreeSelect = /** @class */ (function (_super) {
613
621
  event.stopPropagation();
614
622
  _this.handleTree(event, option);
615
623
  } },
616
- React.createElement("button", { className: "suggestion-item--btn ".concat(_this.props.getId(option.value)), onKeyDown: function (event) {
624
+ React.createElement("button", { className: "suggestion-item--btn z".concat(_this.props.getId(option.value), "z"), onKeyDown: function (event) {
617
625
  if (event.key === 'Enter' && option.children) {
618
626
  _this.setState({
619
627
  buttonTarget: __spreadArray(__spreadArray([], _this.state.buttonTarget, true), [