@woosmap/ui 4.36.2 → 4.36.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.36.2",
3
+ "version": "4.36.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -12,7 +12,7 @@ const Template = (args) => {
12
12
  const { placeholder, label, hideLabel, checked } = args;
13
13
  return (
14
14
  <div className="mbib--large">
15
- <Input placeholder={placeholder} hideLabel={hideLabel} icon="search" isFilter isNoBorder />
15
+ <Input placeholder={placeholder} disabled hideLabel={hideLabel} icon="search" />
16
16
  <Input placeholder={placeholder} hideLabel={hideLabel} icon="search" size="large" isFilter isNoBorder />
17
17
  <Input placeholder={placeholder} hideLabel={hideLabel} icon="search" size="small" isFilter isNoBorder />
18
18
  <Input placeholder={placeholder} label={label} hideLabel={hideLabel} size="large" />
@@ -240,20 +240,16 @@ export default class LanguageSelect extends Component {
240
240
  return languageOptions;
241
241
  };
242
242
 
243
- onChange = (newValue, actionMeta) => {
244
- const { minimumLength, isMulti } = this.props;
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;
243
+ onChange = (newLanguages, actionMeta) => {
244
+ const { minimumLength, isMulti, onChange } = this.props;
245
+ if (
246
+ (actionMeta.action === 'remove-value' || actionMeta.action === 'pop-value') &&
247
+ newLanguages.length < minimumLength &&
248
+ isMulti
249
+ ) {
250
+ return;
255
251
  }
256
-
252
+ if (onChange !== null) onChange(newLanguages);
257
253
  this.setState({ languages: newLanguages });
258
254
  };
259
255
 
@@ -265,7 +261,7 @@ export default class LanguageSelect extends Component {
265
261
  return (
266
262
  <Select
267
263
  isMulti={isMulti}
268
- className="select__item"
264
+ className="select__item select__item--language"
269
265
  classNamePrefix="select"
270
266
  options={this.getOptions()}
271
267
  components={{ MultiValueLabel, MultiValueRemove, Option }}
@@ -324,7 +320,7 @@ LanguageSelect.propTypes = {
324
320
  isMulti: PropTypes.bool,
325
321
  placeholder: PropTypes.string,
326
322
  value: PropTypes.string,
327
- defaultValue: PropTypes.array,
323
+ defaultValue: PropTypes.arrayOf(PropTypes.oneOf(languageOptions.map((x) => x.value))),
328
324
  minimumLength: PropTypes.number,
329
325
  onChange: PropTypes.func,
330
326
  className: PropTypes.string,
@@ -33,14 +33,20 @@ export default class Select extends Component {
33
33
  };
34
34
 
35
35
  render() {
36
- const { size, className, error, label, hideLabel, icon, ...rest } = this.props;
36
+ const { size, className, error, label, hideLabel, icon, disabled, ...rest } = this.props;
37
37
  const errorComponent = error ? <span className="select__error">{error}</span> : null;
38
- const classesContainer = cl('select', { 'select--iconed': icon }, `select--${size}`, className);
38
+ const classesContainer = cl(
39
+ 'select',
40
+ { 'select--iconed': icon },
41
+ `select--${size}`,
42
+ disabled && 'select--disabled',
43
+ className
44
+ );
39
45
  return (
40
46
  <div className={classesContainer}>
41
47
  <div className="select__line">
42
48
  {hideLabel ? (
43
- this.renderInput({ error, size, ...rest })
49
+ this.renderInput({ error, size, isDisabled: disabled, ...rest })
44
50
  ) : (
45
51
  <>
46
52
  {label && (
@@ -48,7 +54,7 @@ export default class Select extends Component {
48
54
  {label}
49
55
  </label>
50
56
  )}
51
- {this.renderInput({ error, size, ...rest })}
57
+ {this.renderInput({ error, size, isDisabled: disabled, ...rest })}
52
58
  </>
53
59
  )}
54
60
  {icon}
@@ -68,6 +74,7 @@ Select.defaultProps = {
68
74
  error: null,
69
75
  isCreatable: false,
70
76
  color: undefined,
77
+ disabled: false,
71
78
  };
72
79
  Select.propTypes = {
73
80
  className: PropTypes.string,
@@ -77,5 +84,6 @@ Select.propTypes = {
77
84
  hideLabel: PropTypes.bool,
78
85
  icon: PropTypes.string,
79
86
  isCreatable: PropTypes.bool,
87
+ disabled: PropTypes.bool,
80
88
  color: PropTypes.oneOf(['bleu', 'mauve', 'green', 'grey', 'orange', 'red', 'white', undefined, '']),
81
89
  };
@@ -33,7 +33,7 @@ const Template = (args) => (
33
33
  <Select {...args} error="There is an error" />
34
34
  </div>
35
35
  <div style={{ marginBottom: '3rem' }}>
36
- <Select {...args} size="small" />
36
+ <Select {...args} label="Disabled" disabled size="small" />
37
37
  </div>
38
38
  </div>
39
39
  );
@@ -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
  };
@@ -108,12 +108,6 @@ input
108
108
  position relative
109
109
  .input__label
110
110
  cursor pointer
111
- &--disabled
112
- .input
113
- &__item
114
- &__label
115
- cursor default !important
116
- opacity .4
117
111
  &__line
118
112
  .input--checkbox &
119
113
  .input--radio &
@@ -201,6 +195,22 @@ input
201
195
  line-height revert
202
196
  &[type=number]
203
197
  -moz-appearance textfield
198
+ &--disabled
199
+ &:not([type=button]):not([type=checkbox]):not([type=radio])
200
+ .icon
201
+ opacity .4
202
+ .input
203
+ &__item
204
+ &__label
205
+ cursor default !important
206
+ opacity .4
207
+ &:focus
208
+ &:hover
209
+ .icon
210
+ stroke $inputBorderColor !important
211
+ .input
212
+ &__item
213
+ border-color $inputBorderColor !important
204
214
  input::-webkit-outer-spin-button
205
215
  input::-webkit-inner-spin-button
206
216
  -webkit-appearance none
@@ -21,6 +21,10 @@ select
21
21
  border-radius .6rem !important
22
22
  &:not(.select__control--is-focused):not(.asyncselect__control--is-focused)
23
23
  border-color $inputBorderColor !important
24
+ .select--is-disabled &
25
+ border-color $inputBorderColor !important
26
+ background-color #ffffff !important
27
+ opacity .4
24
28
  .error > &
25
29
  border-color $error !important
26
30
  &--is-focused
@@ -32,6 +36,9 @@ select
32
36
  fill $secondary
33
37
  &__value-container
34
38
  padding-left 1rem !important
39
+ .select__item--language &
40
+ overflow-y auto !important
41
+ max-height 7rem
35
42
  &__single-value
36
43
  color $secondary !important
37
44
  &__indicator
@@ -82,7 +89,8 @@ select
82
89
  .select__item--red &
83
90
  background-color $labelRed !important
84
91
  &--is-disabled
85
- opacity .6
92
+ cursor default !important
93
+ opacity .4
86
94
  &__label
87
95
  &__remove
88
96
  border-radius .4rem !important
@@ -98,6 +106,11 @@ select
98
106
  cursor pointer
99
107
  svg
100
108
  fill $light !important
109
+ &--disabled
110
+ .select
111
+ &__label
112
+ cursor default !important
113
+ opacity .4
101
114
  &--small
102
115
  .select
103
116
  .asyncselect
@@ -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