superdesk-ui-framework 2.4.16 → 2.4.19

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.
@@ -1,9 +1,10 @@
1
1
  .a11y-only {
2
- position: absolute;
2
+ position: absolute !important;
3
3
  top: 0;
4
4
  z-index: -1;
5
5
  pointer-events: none;
6
6
  opacity: 0;
7
- height: 1px;
7
+ height: 1px !important;
8
+ width: 1px !important;
8
9
  overflow: hidden;
9
10
  }
@@ -158,7 +158,6 @@ export const Dropdown = ({
158
158
  if (toggleRef && menuRef) {
159
159
  createPopper(toggleRef, menuRef, {
160
160
  placement: checkAlign() ? 'bottom-end' : 'bottom-start',
161
- strategy: 'fixed',
162
161
  });
163
162
  menuRef.style.display = 'block';
164
163
  }
@@ -4,7 +4,7 @@ import nextId from "react-id-generator";
4
4
 
5
5
  interface IProps {
6
6
  value?: string;
7
- label?: string;
7
+ label: string;
8
8
  maxLength?: number;
9
9
  info?: string;
10
10
  error?: string;
@@ -12,6 +12,7 @@ interface IProps {
12
12
  disabled?: boolean;
13
13
  invalid?: boolean;
14
14
  inlineLabel?: boolean;
15
+ labelHidden?: boolean;
15
16
  onChange(newValue: string): void;
16
17
  }
17
18
 
@@ -50,11 +51,15 @@ export class Input extends React.Component<IProps, IState> {
50
51
  'sd-input--disabled': this.props.disabled,
51
52
  'sd-input--invalid': this.props.invalid || this.state.invalid,
52
53
  });
54
+ const labelClasses = classNames('sd-input__label', {
55
+ 'a11y-only': this.props.labelHidden,
56
+ });
53
57
 
54
58
  return (
55
59
  <div className={classes}>
56
- {this.props.label ? <label className='sd-input__label'
57
- htmlFor={this.htmlId} id={this.htmlId + 'label'}>{this.props.label}</label> : null}
60
+ <label className={labelClasses} htmlFor={this.htmlId} id={this.htmlId + 'label'}>
61
+ {this.props.label}
62
+ </label>
58
63
 
59
64
  <input className='sd-input__input'
60
65
  type='text'
@@ -4,13 +4,14 @@ import nextId from "react-id-generator";
4
4
 
5
5
  interface ISelect {
6
6
  value?: string;
7
- label?: string;
7
+ label: string;
8
8
  info?: string;
9
9
  error?: string;
10
10
  required?: boolean;
11
11
  disabled?: boolean;
12
12
  invalid?: boolean;
13
13
  inlineLabel?: boolean;
14
+ labelHidden?: boolean;
14
15
  onChange(newValue: string): void;
15
16
  }
16
17
 
@@ -38,6 +39,13 @@ class Select extends React.Component<ISelect, IState> {
38
39
  this.props.onChange(event.target.value);
39
40
  }
40
41
 
42
+ componentDidUpdate(prevProps: any) {
43
+ if (this.props.value !== prevProps.value) {
44
+ this.setState({ value: this.props.value ?? '' });
45
+ this.props.onChange(this.props.value ?? '');
46
+ }
47
+ }
48
+
41
49
  render() {
42
50
  const classes = classNames('sd-input sd-input--is-select', {
43
51
  'sd-input--inline-label': this.props.inlineLabel,
@@ -45,11 +53,13 @@ class Select extends React.Component<ISelect, IState> {
45
53
  'sd-input--disabled': this.props.disabled,
46
54
  'sd-input--invalid': this.props.invalid || this.state.invalid,
47
55
  });
56
+ const labelClasses = classNames('sd-input__label', {
57
+ 'a11y-only': this.props.labelHidden,
58
+ });
48
59
 
49
60
  return (
50
61
  <div className={classes}>
51
- {this.props.label ?
52
- <label className='sd-input__label' htmlFor={this.htmlId}>{this.props.label}</label> : null}
62
+ <label className={labelClasses} htmlFor={this.htmlId}>{this.props.label}</label>
53
63
 
54
64
  <select className='sd-input__select'
55
65
  id={this.htmlId}
@@ -16,11 +16,11 @@ export const Tag = ({ text, keyValue, shade, shape, readOnly, onClick }: IProps)
16
16
  'tag-label--square': shape === 'square',
17
17
  });
18
18
  return (
19
- <div className={classes} key={keyValue}>
19
+ <span className={classes} key={keyValue}>
20
20
  {text}
21
21
  {!readOnly ? <button className='tag-label__remove' onClick={onClick}>
22
22
  <i className='icon-close-small'></i>
23
23
  </button> : null}
24
- </div>
24
+ </span>
25
25
  );
26
26
  };