@woosmap/ui 4.100.1 → 4.100.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "4.100.1",
3
+ "version": "4.100.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -171,7 +171,7 @@ class Aside extends Component {
171
171
  <span className="card__aside__list__item__title">{product.name}</span>
172
172
  </li>
173
173
  </ul>
174
- <div className="card__aside__footer">Will be atomatically activated</div>
174
+ <div className="card__aside__footer">Will be automatically activated</div>
175
175
  </div>
176
176
  );
177
177
  }
@@ -80,7 +80,7 @@ export default class W3WDemo extends Component {
80
80
  const { input } = this.state;
81
81
  axios
82
82
  .get(`${this.baseRequestUrl}autosuggest`, {
83
- params: this.getRequestparams({ input }),
83
+ params: this.getRequestparams({ input, 'clip-to-country': 'GB,FR' }),
84
84
  })
85
85
  .then((response) => {
86
86
  if (this.mounted) {
@@ -52,8 +52,8 @@ it('add a tag by clicking the OK btn', () => {
52
52
 
53
53
  it('cant add the same value twice', () => {
54
54
  const ref = React.createRef();
55
- render(<DynamicTag ref={ref} placeholder="tags" />);
56
- const input = screen.getByPlaceholderText('tags');
55
+ render(<DynamicTag ref={ref} placeholder="tags" testId="dt" />);
56
+ const input = screen.getByTestId('dt-input');
57
57
  expect(input).toBeTruthy();
58
58
 
59
59
  fireEvent.change(input, { target: { value: 'mytag' } });
@@ -61,13 +61,16 @@ it('cant add the same value twice', () => {
61
61
  expect(input).toHaveValue('mytag');
62
62
 
63
63
  expect(ref.current.getTags()).toEqual([]);
64
- const ok = screen.getByRole('button');
64
+ const ok = screen.getByTestId('dt-button');
65
65
  act(() => {
66
66
  fireEvent.click(ok);
67
67
  });
68
68
  expect(ref.current.getTags()).toEqual(['mytag']);
69
69
 
70
- fireEvent.change(input, { target: { value: 'mytag' } });
70
+ act(() => {
71
+ fireEvent.change(input, { target: { value: 'mytag' } });
72
+ });
73
+
71
74
  expect(input).toHaveValue('mytag');
72
75
 
73
76
  act(() => {
@@ -28,10 +28,10 @@ export default class Input extends Component {
28
28
  };
29
29
 
30
30
  increment = () => {
31
- const { onChange, value: oldValue, name } = this.props;
31
+ const { onChange, value: oldValue, name, step, max } = this.props;
32
32
  const { value: stateValue } = this.state;
33
33
  const theValue = oldValue || stateValue;
34
- const newValue = theValue ? theValue + 1 : 1;
34
+ const newValue = Math.max(max, theValue ? theValue + step : step);
35
35
  if (onChange) {
36
36
  onChange({ target: { name, value: newValue } });
37
37
  } else {
@@ -40,10 +40,10 @@ export default class Input extends Component {
40
40
  };
41
41
 
42
42
  decrement = () => {
43
- const { onChange, value: oldValue, name } = this.props;
43
+ const { onChange, value: oldValue, name, step, min } = this.props;
44
44
  const { value: stateValue } = this.state;
45
45
  const theValue = oldValue || stateValue;
46
- const newValue = theValue ? theValue - 1 : 0;
46
+ const newValue = Math.min(min, theValue ? theValue - step : 0);
47
47
  if (onChange) {
48
48
  onChange({ target: { name, value: newValue } });
49
49
  } else {
@@ -69,6 +69,7 @@ export default class Input extends Component {
69
69
  icon,
70
70
  isInputIconFill,
71
71
  enableTogglePassword,
72
+ testId,
72
73
  } = this.props;
73
74
 
74
75
  const { showPassword, value: stateValue } = this.state;
@@ -97,7 +98,7 @@ export default class Input extends Component {
97
98
  }),
98
99
  id: this.inputId,
99
100
  ref: this.inputRef,
100
- 'data-testid': 'input',
101
+ 'data-testid': testId,
101
102
  name,
102
103
  checked,
103
104
  autoComplete: autocomplete ? '' : 'off',
@@ -106,17 +107,17 @@ export default class Input extends Component {
106
107
  onFocus,
107
108
  onKeyDown: this.onKeyDown,
108
109
  type: type === 'password' && showPassword ? 'text' : type,
109
- value: value || stateValue,
110
+ value: value !== undefined ? value : stateValue,
110
111
  size: length,
111
112
  disabled,
112
113
  onChange,
113
114
  })}
114
115
  {type === 'number' && (
115
116
  <div>
116
- <button onClick={this.increment} type="button">
117
+ <button onClick={this.increment} type="button" disabled={disabled}>
117
118
  +
118
119
  </button>
119
- <button onClick={this.decrement} type="button">
120
+ <button onClick={this.decrement} type="button" disabled={disabled}>
120
121
  -
121
122
  </button>
122
123
  </div>
@@ -216,6 +217,10 @@ Input.propTypes = {
216
217
  onPressEnter: PropTypes.func,
217
218
  enableTogglePassword: PropTypes.bool,
218
219
  isInputIconFill: PropTypes.bool,
220
+ step: PropTypes.number,
221
+ testId: PropTypes.string,
222
+ min: PropTypes.number,
223
+ max: PropTypes.number,
219
224
  };
220
225
 
221
226
  Input.defaultProps = {
@@ -242,4 +247,8 @@ Input.defaultProps = {
242
247
  onFocus: null,
243
248
  enableTogglePassword: false,
244
249
  isInputIconFill: false,
250
+ step: 1,
251
+ testId: 'input',
252
+ min: undefined,
253
+ max: undefined,
245
254
  };