@woosmap/ui 4.36.2 → 4.36.3

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.36.2",
3
+ "version": "4.36.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -241,19 +241,16 @@ export default class LanguageSelect extends Component {
241
241
  };
242
242
 
243
243
  onChange = (newValue, actionMeta) => {
244
- const { minimumLength, isMulti } = this.props;
244
+ const { minimumLength, isMulti, onChange } = this.props;
245
245
  const newLanguages = newValue;
246
- switch (actionMeta.action) {
247
- case 'remove-value':
248
- case 'pop-value':
249
- if (newValue.length < minimumLength && isMulti) {
250
- return;
251
- }
252
- break;
253
- default:
254
- break;
246
+ if (
247
+ (actionMeta.action === 'remove-value' || actionMeta.action === 'pop-value') &&
248
+ newValue.length < minimumLength &&
249
+ isMulti
250
+ ) {
251
+ return;
255
252
  }
256
-
253
+ if (onChange !== null) onChange(newValue);
257
254
  this.setState({ languages: newLanguages });
258
255
  };
259
256
 
@@ -265,7 +262,7 @@ export default class LanguageSelect extends Component {
265
262
  return (
266
263
  <Select
267
264
  isMulti={isMulti}
268
- className="select__item"
265
+ className="select__item select__item--language"
269
266
  classNamePrefix="select"
270
267
  options={this.getOptions()}
271
268
  components={{ MultiValueLabel, MultiValueRemove, Option }}
@@ -324,7 +321,7 @@ LanguageSelect.propTypes = {
324
321
  isMulti: PropTypes.bool,
325
322
  placeholder: PropTypes.string,
326
323
  value: PropTypes.string,
327
- defaultValue: PropTypes.array,
324
+ defaultValue: PropTypes.arrayOf(PropTypes.oneOf(languageOptions.map((x) => x.value))),
328
325
  minimumLength: PropTypes.number,
329
326
  onChange: PropTypes.func,
330
327
  className: PropTypes.string,
@@ -93,6 +93,6 @@ export const LanguageSelectChange = TemplateLanguageSelect.bind({});
93
93
  LanguageSelectChange.args = {
94
94
  isMulti: true,
95
95
  closeMenuOnSelect: false,
96
- defaultValue: ['en', 'ar'],
96
+ defaultValue: ['en', 'fr'],
97
97
  minimumLength: 1,
98
98
  };
@@ -32,6 +32,9 @@ select
32
32
  fill $secondary
33
33
  &__value-container
34
34
  padding-left 1rem !important
35
+ .select__item--language &
36
+ overflow-y auto !important
37
+ max-height 7rem
35
38
  &__single-value
36
39
  color $secondary !important
37
40
  &__indicator
@@ -33,6 +33,9 @@
33
33
  fill $secondary
34
34
  &__value-container
35
35
  padding-left 1rem !important
36
+ .select__item--language &
37
+ overflow-y auto !important
38
+ max-height 7rem
36
39
  &__single-value
37
40
  color $secondary !important
38
41
  &__indicator
@@ -84,6 +87,8 @@
84
87
  &__label
85
88
  padding-right .2rem !important
86
89
  color $light !important
90
+ &:only-child
91
+ margin-right .3rem !important
87
92
  &__remove
88
93
  cursor pointer
89
94
  svg