superdesk-ui-framework 3.1.12 → 3.1.13
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/_helpers.scss +17 -0
- package/app/styles/_toggle-box.scss +45 -28
- package/app/styles/form-elements/_inputs.scss +14 -0
- package/app/styles/grids/_grid-layout.scss +3 -0
- package/app-typescript/components/DatePicker.tsx +6 -0
- package/app-typescript/components/Layouts/LayoutContainer.tsx +7 -1
- package/app-typescript/components/Layouts/PageLayout.tsx +2 -1
- package/app-typescript/components/TimePickerV2.tsx +222 -0
- package/app-typescript/components/ToggleBox/CustomHeaderToggleBox.tsx +6 -1
- package/app-typescript/components/ToggleBox/SimpleToggleBox.tsx +10 -20
- package/app-typescript/components/ToggleBox/index.tsx +3 -1
- package/app-typescript/components/TreeMenu.tsx +8 -5
- package/app-typescript/components/TreeSelect/TreeSelect.tsx +13 -12
- package/app-typescript/components/TreeSelect/TreeSelectItem.tsx +11 -1
- package/app-typescript/index.ts +1 -0
- package/dist/components/TimePicker.tsx +43 -1
- package/dist/components/Togglebox.tsx +19 -4
- package/dist/components/TreeMenu.tsx +2 -0
- package/dist/components/utilities/TextUtilities.tsx +39 -0
- package/dist/design-patterns/ThreePaneLayoutPattern.tsx +1 -1
- package/dist/examples.bundle.js +2184 -1924
- package/dist/superdesk-ui.bundle.css +72 -20
- package/dist/superdesk-ui.bundle.js +1815 -1604
- package/dist/vendor.bundle.js +16 -16
- package/examples/pages/components/TimePicker.tsx +43 -1
- package/examples/pages/components/Togglebox.tsx +19 -4
- package/examples/pages/components/TreeMenu.tsx +2 -0
- package/examples/pages/components/utilities/TextUtilities.tsx +39 -0
- package/examples/pages/design-patterns/ThreePaneLayoutPattern.tsx +1 -1
- package/package.json +1 -1
- package/react/components/DatePicker.d.ts +3 -0
- package/react/components/DatePicker.js +2 -2
- package/react/components/Layouts/LayoutContainer.d.ts +1 -0
- package/react/components/Layouts/LayoutContainer.js +8 -1
- package/react/components/Layouts/PageLayout.d.ts +1 -0
- package/react/components/Layouts/PageLayout.js +1 -1
- package/react/components/TimePickerV2.d.ts +28 -0
- package/react/components/TimePickerV2.js +189 -0
- package/react/components/ToggleBox/CustomHeaderToggleBox.d.ts +1 -0
- package/react/components/ToggleBox/CustomHeaderToggleBox.js +6 -3
- package/react/components/ToggleBox/SimpleToggleBox.js +8 -6
- package/react/components/ToggleBox/index.d.ts +2 -1
- package/react/components/TreeMenu.js +7 -7
- package/react/components/TreeSelect/TreeSelect.js +9 -11
- package/react/components/TreeSelect/TreeSelectItem.d.ts +1 -0
- package/react/components/TreeSelect/TreeSelectItem.js +7 -4
- package/react/index.d.ts +1 -0
- package/react/index.js +5 -3
@@ -455,11 +455,9 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
455
455
|
|
456
456
|
const item = this.state.buttonTree.pop();
|
457
457
|
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
});
|
462
|
-
}
|
458
|
+
this.setState({
|
459
|
+
buttonValue: item ?? null,
|
460
|
+
});
|
463
461
|
}
|
464
462
|
|
465
463
|
recursion(arr: Array<ITreeNode<T>>) {
|
@@ -738,6 +736,8 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
738
736
|
}
|
739
737
|
}}
|
740
738
|
data-test-id="open-popover"
|
739
|
+
aria-haspopup="tree"
|
740
|
+
aria-expanded={this.state.openDropdown}
|
741
741
|
>
|
742
742
|
<i className="icon-plus-large"></i>
|
743
743
|
</button>
|
@@ -893,12 +893,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
893
893
|
ref={this.dropdownRef}
|
894
894
|
>
|
895
895
|
<div className='autocomplete__header'>
|
896
|
-
<div
|
897
|
-
className="autocomplete__icon"
|
898
|
-
onClick={() => {
|
899
|
-
this.backButton();
|
900
|
-
}}
|
901
|
-
>
|
896
|
+
<div className="autocomplete__icon">
|
902
897
|
<Icon name="search" className="search"></Icon>
|
903
898
|
</div>
|
904
899
|
|
@@ -968,6 +963,8 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
968
963
|
className="suggestion-list suggestion-list--multi-select"
|
969
964
|
ref={this.ref}
|
970
965
|
data-test-id="options"
|
966
|
+
role='tree'
|
967
|
+
aria-multiselectable={this.props.allowMultiple}
|
971
968
|
>
|
972
969
|
{this.state.options.map((option, i: React.Key | undefined) => {
|
973
970
|
let selectedItem = this.state.value.some((obj) =>
|
@@ -981,11 +978,15 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
981
978
|
handleTree={this.handleTree}
|
982
979
|
selectedItem={selectedItem}
|
983
980
|
allowMultiple={this.props.allowMultiple}
|
981
|
+
parentCategory={this.state.buttonValue == null
|
982
|
+
? undefined
|
983
|
+
: this.props.getLabel(this.state.buttonValue.value)
|
984
|
+
}
|
984
985
|
getBorderColor={this.props.getBorderColor}
|
985
986
|
getBackgroundColor={this.props.getBackgroundColor}
|
986
987
|
getId={this.props.getId}
|
987
|
-
optionTemplate={this.props.optionTemplate}
|
988
988
|
getLabel={this.props.getLabel}
|
989
|
+
optionTemplate={this.props.optionTemplate}
|
989
990
|
onKeyDown={() => this.setState({
|
990
991
|
buttonTarget: [
|
991
992
|
...this.state.buttonTarget,
|
@@ -12,6 +12,7 @@ interface IProps<T> {
|
|
12
12
|
selectedItem?: boolean;
|
13
13
|
disabledItem?: boolean;
|
14
14
|
allowMultiple?: boolean;
|
15
|
+
parentCategory?: string | undefined;
|
15
16
|
handleTree(event: React.MouseEvent<HTMLLIElement, MouseEvent>, option: ITreeNode<T>): any;
|
16
17
|
getLabel(item: T): string;
|
17
18
|
getId(item: T): string;
|
@@ -24,9 +25,14 @@ interface IProps<T> {
|
|
24
25
|
|
25
26
|
export class TreeSelectItem<T> extends React.Component<IProps<T>> {
|
26
27
|
render() {
|
28
|
+
const ariaLabel = this.props.parentCategory !== undefined
|
29
|
+
? `${this.props.getLabel(this.props.option.value)}, parent ${this.props.parentCategory}`
|
30
|
+
: this.props.getLabel(this.props.option.value);
|
31
|
+
|
27
32
|
return (
|
28
33
|
<li
|
29
34
|
className='suggestion-item suggestion-item--multi-select'
|
35
|
+
role='none'
|
30
36
|
onClick={(event) => {
|
31
37
|
if (!this.props.disabledItem) {
|
32
38
|
this.props.onClick?.();
|
@@ -49,6 +55,9 @@ export class TreeSelectItem<T> extends React.Component<IProps<T>> {
|
|
49
55
|
}}
|
50
56
|
disabled={this.props.disabledItem}
|
51
57
|
data-test-id="option"
|
58
|
+
role='treeItem'
|
59
|
+
aria-selected={this.props.selectedItem === true}
|
60
|
+
aria-disabled={this.props.disabledItem === true}
|
52
61
|
>
|
53
62
|
{(this.props.getBorderColor && !this.props.allowMultiple)
|
54
63
|
&& <div
|
@@ -74,6 +83,7 @@ export class TreeSelectItem<T> extends React.Component<IProps<T>> {
|
|
74
83
|
}
|
75
84
|
: undefined
|
76
85
|
}
|
86
|
+
aria-label={ariaLabel}
|
77
87
|
>
|
78
88
|
{this.props.optionTemplate
|
79
89
|
? this.props.optionTemplate(this.props.option.value)
|
@@ -82,7 +92,7 @@ export class TreeSelectItem<T> extends React.Component<IProps<T>> {
|
|
82
92
|
</span>
|
83
93
|
|
84
94
|
{this.props.option.children
|
85
|
-
&& <span className="suggestion-item__icon">
|
95
|
+
&& <span className="suggestion-item__icon" aria-hidden="true">
|
86
96
|
<Icon name="chevron-right-thin"></Icon>
|
87
97
|
</span>
|
88
98
|
}
|
package/app-typescript/index.ts
CHANGED
@@ -27,6 +27,7 @@ export { DatePicker } from './components/DatePicker';
|
|
27
27
|
export { DatePickerISO } from './components/DatePicker';
|
28
28
|
export { DatePickerLocaleSettings } from './components/DatePicker';
|
29
29
|
export { TimePicker } from './components/TimePicker';
|
30
|
+
export { TimePickerV2 } from './components/TimePickerV2';
|
30
31
|
export { FormLabel } from './components/FormLabel';
|
31
32
|
export { Switch } from './components/Switch';
|
32
33
|
export { SwitchGroup } from './components/SwitchGroup';
|
@@ -2,6 +2,10 @@ import * as React from 'react';
|
|
2
2
|
import * as Markup from '../../js/react';
|
3
3
|
import {PropsList, Prop} from '../../../app-typescript';
|
4
4
|
import {TimePicker} from '../../../app-typescript/components/TimePicker';
|
5
|
+
import {TimePickerV2} from '../../../app-typescript/components/TimePickerV2';
|
6
|
+
|
7
|
+
let minutes = Array.from(Array(60).keys());
|
8
|
+
let changedMinutes = minutes.filter((num) => num % 15 !== 0)
|
5
9
|
|
6
10
|
class TimePickerExample extends React.PureComponent<{}, {time: string}> {
|
7
11
|
constructor(props) {
|
@@ -27,7 +31,15 @@ class TimePickerExample extends React.PureComponent<{}, {time: string}> {
|
|
27
31
|
}
|
28
32
|
}
|
29
33
|
|
30
|
-
export default class TimePickerDoc extends React.Component {
|
34
|
+
export default class TimePickerDoc extends React.Component<{}, {time: string}> {
|
35
|
+
constructor(props) {
|
36
|
+
super(props);
|
37
|
+
|
38
|
+
this.state = {
|
39
|
+
time: '14:00',
|
40
|
+
};
|
41
|
+
}
|
42
|
+
|
31
43
|
render() {
|
32
44
|
return (
|
33
45
|
<section className="docs-page__container">
|
@@ -59,6 +71,36 @@ export default class TimePickerDoc extends React.Component {
|
|
59
71
|
`}</Markup.ReactMarkupCode>
|
60
72
|
</Markup.ReactMarkup>
|
61
73
|
|
74
|
+
<p className='docs-page__paragraph'>TimePickerV2:</p>
|
75
|
+
<Markup.ReactMarkup>
|
76
|
+
<Markup.ReactMarkupPreview>
|
77
|
+
<div className='docs-page__content-row'>
|
78
|
+
<TimePickerV2
|
79
|
+
value={this.state.time}
|
80
|
+
label='This is Label'
|
81
|
+
disabledOptions={{
|
82
|
+
minutes: changedMinutes,
|
83
|
+
}}
|
84
|
+
onChange={(time) => {
|
85
|
+
this.setState({time});
|
86
|
+
}}
|
87
|
+
/>
|
88
|
+
</div>
|
89
|
+
</Markup.ReactMarkupPreview>
|
90
|
+
<Markup.ReactMarkupCode>{`
|
91
|
+
<TimePickerV2
|
92
|
+
value={this.state.time}
|
93
|
+
label='This is Label'
|
94
|
+
disableOptions={{
|
95
|
+
minutes: changedMinutes,
|
96
|
+
}}
|
97
|
+
onChange={(time) => {
|
98
|
+
this.setState({time})
|
99
|
+
}}
|
100
|
+
/>
|
101
|
+
`}</Markup.ReactMarkupCode>
|
102
|
+
</Markup.ReactMarkup>
|
103
|
+
|
62
104
|
<h3 className='docs-page__h3'>Props</h3>
|
63
105
|
<PropsList>
|
64
106
|
<Prop name='value' isRequired={true} type='string' default='/' description='Item value.' />
|
@@ -37,16 +37,30 @@ const ToggleboxDocs = () => {
|
|
37
37
|
<section className="docs-page__container">
|
38
38
|
<h2 className="docs-page__h2">Togglebox</h2>
|
39
39
|
<Markup.ReactMarkupCodePreview>{`
|
40
|
-
<ToggleBox title="togglebox title">togglebox content</ToggleBox>
|
40
|
+
<ToggleBox variant="simple" title="togglebox title">togglebox content</ToggleBox>
|
41
41
|
`}
|
42
42
|
</Markup.ReactMarkupCodePreview>
|
43
43
|
<p className="docs-page__paragraph">Simple ToggleBox:</p>
|
44
44
|
<Markup.ReactMarkup>
|
45
45
|
<Markup.ReactMarkupPreview>
|
46
46
|
<div style={{ marginTop: "2em" }}>
|
47
|
-
<ToggleBox variant=
|
47
|
+
<ToggleBox variant="simple" title="Simple togglebox">Togglebox content</ToggleBox>
|
48
48
|
<ToggleBox variant='simple' title="With badge" badge={<Badge text='2' type='primary' />}>Togglebox content</ToggleBox>
|
49
|
-
<ToggleBox variant='simple' title="Togglebox - circled chevron"
|
49
|
+
<ToggleBox variant='simple' title="Togglebox - circled chevron" circledChevron={true}>Togglebox content</ToggleBox>
|
50
|
+
<ToggleBox variant='simple' title="Large title" largeTitle={true} circledChevron={true}>
|
51
|
+
<div className="px-4 text-sm line-height-lg">
|
52
|
+
<p className="mb-2">Maecenas sed diam eget risus varius blandit sit amet non magna. Nulla vitae elit libero, a pharetra augue.
|
53
|
+
Donec id elit non mi porta gravida at eget metus. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
|
54
|
+
Curabitur blandit tempus porttitor.</p>
|
55
|
+
|
56
|
+
<p className="mb-2">Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nullam quis risus eget urna mollis ornare vel eu leo.
|
57
|
+
Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere
|
58
|
+
erat a ante venenatis dapibus posuere velit aliquet.</p>
|
59
|
+
|
60
|
+
<p className="">Aenean lacinia bibendum nulla sed consectetur. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Vestibulum id
|
61
|
+
ligula porta felis euismod semper. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
|
62
|
+
</div>
|
63
|
+
</ToggleBox>
|
50
64
|
</div>
|
51
65
|
</Markup.ReactMarkupPreview>
|
52
66
|
<Markup.ReactMarkupCode>{`
|
@@ -168,12 +182,13 @@ const ToggleboxDocs = () => {
|
|
168
182
|
<PropsList>
|
169
183
|
<Prop name='title' isRequired={true} type='string' default='null' description='Togglebox title' />
|
170
184
|
<Prop name='badge' isRequired={false} type='JSX.Element' default='null' description='Badge' />
|
171
|
-
<Prop name='hideUsingCSS' isRequired={false} type='boolean' default='false' description='Usefull when working with forms. Content of togglebox will be hidden but remain rendered.' />
|
172
185
|
<Prop name='initiallyOpen' isRequired={false} type='boolean' default='false' description='Opens togglebox on initial render' />
|
173
186
|
<Prop name='className' isRequired={false} type='string' default='null' description='Style class of the component' />
|
174
187
|
<Prop name='margin' isRequired={false} type='none | small | normal | large' default='normal' description='Defines the bottom margin of the toggle box.' />
|
175
188
|
<Prop name='onOpen' isRequired={false} type='function' default='null' description='Callback on open event' />
|
176
189
|
<Prop name='onClose' isRequired={false} type='function' default='null' description='Callback on close event' />
|
190
|
+
<Prop name='circledChevron' isRequired={false} type='boolean' default='false' description='Adds a light, circle-shaped background around the chevron.' />
|
191
|
+
<Prop name='largeTitle' isRequired={false} type='boolean' default='false' description='This option will increase the size of the title. Always use a circled chevron (circledChevron) in combination with this option.' />
|
177
192
|
</PropsList>
|
178
193
|
|
179
194
|
<h3 className="docs-page__h3">Props: variant: 'custom-header'</h3>
|
@@ -176,6 +176,7 @@ export class TreeMenuDocs extends React.Component<{}, {}> {
|
|
176
176
|
<Markup.ReactMarkupPreview>
|
177
177
|
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
178
178
|
<TreeMenu
|
179
|
+
searchPlaceholder='Search...'
|
179
180
|
getOptions={() => options}
|
180
181
|
getId={(item) => item.name}
|
181
182
|
getLabel={(item) => item.name}
|
@@ -208,6 +209,7 @@ export class TreeMenuDocs extends React.Component<{}, {}> {
|
|
208
209
|
<Markup.ReactMarkupPreview>
|
209
210
|
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
210
211
|
<TreeMenu
|
212
|
+
searchPlaceholder='Search...'
|
211
213
|
getOptions={() => options2}
|
212
214
|
getId={(item) => item.name}
|
213
215
|
getLabel={(item) => item.name}
|
@@ -203,6 +203,45 @@ class TextUtilitiesDoc extends React.Component {
|
|
203
203
|
</div>
|
204
204
|
</div>
|
205
205
|
|
206
|
+
<div className='docs-page__container-block--line-height'>
|
207
|
+
<h3 className="docs-page__h3">Line Height</h3>
|
208
|
+
<p className="docs-page__paragraph">
|
209
|
+
Utilities for managing the line height of an element.
|
210
|
+
</p>
|
211
|
+
<div className="utilities-table__container">
|
212
|
+
<table className="table utilities-table">
|
213
|
+
<thead>
|
214
|
+
<tr>
|
215
|
+
<th>Class</th>
|
216
|
+
<th>Properties</th>
|
217
|
+
</tr>
|
218
|
+
</thead>
|
219
|
+
<tbody>
|
220
|
+
<tr>
|
221
|
+
<td>line-height-1</td>
|
222
|
+
<td>{'line-height: 1;'}</td>
|
223
|
+
</tr>
|
224
|
+
<tr>
|
225
|
+
<td>line-height-xs</td>
|
226
|
+
<td>{'line-height: 1.1;'}</td>
|
227
|
+
</tr>
|
228
|
+
<tr>
|
229
|
+
<td>line-height-sm</td>
|
230
|
+
<td>{'line-height: 1.2;'}</td>
|
231
|
+
</tr>
|
232
|
+
<tr>
|
233
|
+
<td>line-height-md</td>
|
234
|
+
<td>{'line-height: 1.4;'}</td>
|
235
|
+
</tr>
|
236
|
+
<tr>
|
237
|
+
<td>line-height-lg</td>
|
238
|
+
<td>{'line-height: 1.5;'}</td>
|
239
|
+
</tr>
|
240
|
+
</tbody>
|
241
|
+
</table>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
206
245
|
<div className='docs-page__container-block--font-style'>
|
207
246
|
<h3 className="docs-page__h3">Text Align</h3>
|
208
247
|
<div className="utilities-table__container">
|
@@ -75,7 +75,7 @@ class ThreePaneLayoutPattern extends React.Component<IProps, IState> {
|
|
75
75
|
<Markup.ReactMarkup>
|
76
76
|
<Markup.ReactMarkupPreview>
|
77
77
|
<div style={{height: 600,}} className='sd-border--light'>
|
78
|
-
<Layout.PageLayout
|
78
|
+
<Layout.PageLayout fullHeight={true}
|
79
79
|
header={(
|
80
80
|
<SubNav zIndex={2}>
|
81
81
|
<ButtonGroup align="inline">
|