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.
- package/app/styles/_accessibility.scss +3 -2
- package/app-typescript/components/Dropdown.tsx +0 -1
- package/app-typescript/components/Input.tsx +8 -3
- package/app-typescript/components/Select.tsx +13 -3
- package/app-typescript/components/Tag.tsx +2 -2
- package/dist/examples.bundle.js +261 -73
- package/dist/playgrounds/react-playgrounds/SamsPlayground.tsx +14 -1
- package/dist/react/Inputs.tsx +20 -2
- package/dist/react/Selects.tsx +23 -1
- package/dist/superdesk-ui.bundle.css +3 -2
- package/dist/superdesk-ui.bundle.js +45 -15
- package/dist/vendor.bundle.js +10 -6
- package/examples/pages/playgrounds/react-playgrounds/SamsPlayground.tsx +14 -1
- package/examples/pages/react/Inputs.tsx +20 -2
- package/examples/pages/react/Selects.tsx +23 -1
- package/package.json +1 -1
- package/react/components/Dropdown.js +0 -1
- package/react/components/Input.d.ts +2 -1
- package/react/components/Input.js +4 -1
- package/react/components/Select.d.ts +3 -1
- package/react/components/Select.js +11 -2
- package/react/components/Tag.js +1 -1
@@ -4,7 +4,7 @@ import nextId from "react-id-generator";
|
|
4
4
|
|
5
5
|
interface IProps {
|
6
6
|
value?: string;
|
7
|
-
label
|
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.
|
57
|
-
|
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
|
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
|
-
<
|
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
|
-
</
|
24
|
+
</span>
|
25
25
|
);
|
26
26
|
};
|