superdesk-ui-framework 2.4.17 → 2.4.20
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 +8 -3
- package/app/styles/_buttons.scss +52 -1
- package/app/styles/_spinner.scss +46 -0
- package/app-typescript/components/Button.tsx +7 -1
- package/app-typescript/components/Input.tsx +22 -7
- package/app-typescript/components/Select.tsx +13 -3
- package/app-typescript/components/Spinner.tsx +33 -0
- package/app-typescript/components/TabCustom.tsx +89 -40
- package/app-typescript/components/TabList.tsx +43 -18
- package/app-typescript/components/Tag.tsx +2 -2
- package/app-typescript/index.ts +1 -1
- package/dist/examples.bundle.css +36 -1
- package/dist/examples.bundle.js +901 -632
- package/dist/react/Buttons.tsx +25 -0
- package/dist/react/Inputs.tsx +24 -3
- package/dist/react/Selects.tsx +23 -1
- package/dist/react/Tabs.tsx +225 -72
- package/dist/superdesk-ui.bundle.css +75 -13
- package/dist/superdesk-ui.bundle.js +560 -400
- package/dist/vendor.bundle.js +13 -13
- package/examples/pages/react/Buttons.tsx +25 -0
- package/examples/pages/react/Inputs.tsx +24 -3
- package/examples/pages/react/Selects.tsx +23 -1
- package/examples/pages/react/Tabs.tsx +225 -72
- package/package.json +2 -2
- package/react/components/Button.d.ts +2 -0
- package/react/components/Button.js +4 -2
- package/react/components/Input.d.ts +4 -1
- package/react/components/Input.js +17 -5
- package/react/components/Select.d.ts +3 -1
- package/react/components/Select.js +11 -2
- package/react/components/Spinner.d.ts +12 -0
- package/react/components/Spinner.js +70 -0
- package/react/components/TabCustom.d.ts +22 -12
- package/react/components/TabCustom.js +52 -23
- package/react/components/TabList.d.ts +11 -2
- package/react/components/TabList.js +32 -11
- package/react/components/Tag.js +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +2 -2
package/dist/vendor.bundle.js
CHANGED
@@ -70,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
70
70
|
/******/ __webpack_require__.p = "";
|
71
71
|
/******/
|
72
72
|
/******/ // Load entry module and return exports
|
73
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
73
|
+
/******/ return __webpack_require__(__webpack_require__.s = 385);
|
74
74
|
/******/ })
|
75
75
|
/************************************************************************/
|
76
76
|
/******/ ({
|
@@ -28217,7 +28217,7 @@ return jQuery;
|
|
28217
28217
|
|
28218
28218
|
/***/ }),
|
28219
28219
|
|
28220
|
-
/***/
|
28220
|
+
/***/ 385:
|
28221
28221
|
/***/ (function(module, exports, __webpack_require__) {
|
28222
28222
|
|
28223
28223
|
"use strict";
|
@@ -28227,19 +28227,19 @@ __webpack_require__(38);
|
|
28227
28227
|
|
28228
28228
|
__webpack_require__(35);
|
28229
28229
|
|
28230
|
-
__webpack_require__(384);
|
28231
|
-
|
28232
28230
|
__webpack_require__(386);
|
28233
28231
|
|
28234
28232
|
__webpack_require__(388);
|
28235
28233
|
|
28234
|
+
__webpack_require__(390);
|
28235
|
+
|
28236
28236
|
__webpack_require__(1);
|
28237
28237
|
|
28238
28238
|
__webpack_require__(7);
|
28239
28239
|
|
28240
28240
|
/***/ }),
|
28241
28241
|
|
28242
|
-
/***/
|
28242
|
+
/***/ 386:
|
28243
28243
|
/***/ (function(module, exports, __webpack_require__) {
|
28244
28244
|
|
28245
28245
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
@@ -28263,7 +28263,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
28263
28263
|
if ( true ) {
|
28264
28264
|
|
28265
28265
|
// AMD. Register as an anonymous module.
|
28266
|
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(35), __webpack_require__(
|
28266
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(35), __webpack_require__(387) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
28267
28267
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
28268
28268
|
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
28269
28269
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
@@ -29005,7 +29005,7 @@ return $.widget;
|
|
29005
29005
|
|
29006
29006
|
/***/ }),
|
29007
29007
|
|
29008
|
-
/***/
|
29008
|
+
/***/ 387:
|
29009
29009
|
/***/ (function(module, exports, __webpack_require__) {
|
29010
29010
|
|
29011
29011
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
|
@@ -29035,16 +29035,16 @@ return $.ui.version = "1.13.1";
|
|
29035
29035
|
|
29036
29036
|
/***/ }),
|
29037
29037
|
|
29038
|
-
/***/
|
29038
|
+
/***/ 388:
|
29039
29039
|
/***/ (function(module, exports, __webpack_require__) {
|
29040
29040
|
|
29041
|
-
__webpack_require__(
|
29041
|
+
__webpack_require__(389);
|
29042
29042
|
module.exports = angular;
|
29043
29043
|
|
29044
29044
|
|
29045
29045
|
/***/ }),
|
29046
29046
|
|
29047
|
-
/***/
|
29047
|
+
/***/ 389:
|
29048
29048
|
/***/ (function(module, exports, __webpack_require__) {
|
29049
29049
|
|
29050
29050
|
/* WEBPACK VAR INJECTION */(function(__webpack_provided_window_dot_jQuery) {/**
|
@@ -65651,16 +65651,16 @@ $provide.value("$locale", {
|
|
65651
65651
|
|
65652
65652
|
/***/ }),
|
65653
65653
|
|
65654
|
-
/***/
|
65654
|
+
/***/ 390:
|
65655
65655
|
/***/ (function(module, exports, __webpack_require__) {
|
65656
65656
|
|
65657
|
-
__webpack_require__(
|
65657
|
+
__webpack_require__(391);
|
65658
65658
|
module.exports = 'ngAnimate';
|
65659
65659
|
|
65660
65660
|
|
65661
65661
|
/***/ }),
|
65662
65662
|
|
65663
|
-
/***/
|
65663
|
+
/***/ 391:
|
65664
65664
|
/***/ (function(module, exports) {
|
65665
65665
|
|
65666
65666
|
/**
|
@@ -187,6 +187,30 @@ export default class ButtonsDoc extends React.Component {
|
|
187
187
|
`}</Markup.ReactMarkupCode>
|
188
188
|
</Markup.ReactMarkup>
|
189
189
|
|
190
|
+
|
191
|
+
<h3 className="docs-page__h3">Loading</h3>
|
192
|
+
<p className="docs-page__paragraph"><code>isLoading={'{true}'}</code></p>
|
193
|
+
<Markup.ReactMarkup>
|
194
|
+
<Markup.ReactMarkupPreview>
|
195
|
+
<div className="docs-page__content-row">
|
196
|
+
<Button text="default" isLoading={true} onClick={()=> false} />
|
197
|
+
<Button text="primary" type="primary" isLoading={true} onClick={()=> false} />
|
198
|
+
<Button text="success" type="success" isLoading={true} onClick={()=> false} />
|
199
|
+
<Button text="warning" type="warning" isLoading={true} onClick={()=> false} />
|
200
|
+
<Button text="alert" type="alert" isLoading={true} onClick={()=> false} />
|
201
|
+
<Button text="highlight" type="highlight" isLoading={true} onClick={()=> false} />
|
202
|
+
</div>
|
203
|
+
</Markup.ReactMarkupPreview>
|
204
|
+
<Markup.ReactMarkupCode>{`
|
205
|
+
<Button text="default" isLoading={true} onClick={()=> false} />
|
206
|
+
<Button text="primary" type="primary" isLoading={true} onClick={()=> false} />
|
207
|
+
<Button text="success" type="success" isLoading={true} onClick={()=> false} />
|
208
|
+
<Button text="warning" type="warning" isLoading={true} onClick={()=> false} />
|
209
|
+
<Button text="alert" type="alert" isLoading={true} onClick={()=> false} />
|
210
|
+
<Button text="highlight" type="highlight" isLoading={true} onClick={()=> false} />
|
211
|
+
`}</Markup.ReactMarkupCode>
|
212
|
+
</Markup.ReactMarkup>
|
213
|
+
|
190
214
|
<h3 className="docs-page__h3">Buttons with icon and text</h3>
|
191
215
|
<p className="docs-page__paragraph">Buttons can be combined with icons from the icon font. Just add any of the available classes from the Icon font as a value of the <code>icon</code> prop.</p>
|
192
216
|
<Markup.ReactMarkup>
|
@@ -443,6 +467,7 @@ export default class ButtonsDoc extends React.Component {
|
|
443
467
|
<Prop name='size' isRequired={false} type='small | normal | large' default='normal' description='Specifies a small, normal or large button.'/>
|
444
468
|
<Prop name='icon' isRequired={false} type='string' default='/' description='Icon class name without the icon- part.'/>
|
445
469
|
<Prop name='disabled' isRequired={false} type='boolean' default='false' description='Disables the Button, preventing mouse events.'/>
|
470
|
+
<Prop name='isLoading' isRequired={false} type='boolean' default='false' description='Adds a loading indicator and disables the button if set to true.'/>
|
446
471
|
<Prop name='onClick' isRequired={true} type='function' default='false' description='Callback fired when a button is pressed.'/>
|
447
472
|
</PropsList>
|
448
473
|
</section>
|
@@ -9,6 +9,7 @@ interface IState {
|
|
9
9
|
required: boolean;
|
10
10
|
disabled: boolean;
|
11
11
|
invalid: boolean;
|
12
|
+
val: string
|
12
13
|
}
|
13
14
|
|
14
15
|
export default class InputsDoc extends React.Component<{}, IState> {
|
@@ -18,7 +19,8 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
18
19
|
inlineLabel: false,
|
19
20
|
required: true,
|
20
21
|
disabled: false,
|
21
|
-
invalid: false
|
22
|
+
invalid: false,
|
23
|
+
val: 'This is some text'
|
22
24
|
}
|
23
25
|
}
|
24
26
|
|
@@ -33,7 +35,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
33
35
|
<p className='docs-page__paragraph'></p>
|
34
36
|
<Markup.ReactMarkup>
|
35
37
|
<Markup.ReactMarkupPreview>
|
36
|
-
<div className='docs-page__content-row
|
38
|
+
<div className='docs-page__content-row'>
|
37
39
|
<div className='form__row'>
|
38
40
|
<CheckGroup>
|
39
41
|
<Checkbox checked={this.state.required} label={{text:'Required input'}} onChange={(value) => {this.setState({required: value})}} />
|
@@ -45,7 +47,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
45
47
|
|
46
48
|
<div className='form__row'>
|
47
49
|
<Input label='Input label'
|
48
|
-
value=
|
50
|
+
value={this.state.val}
|
49
51
|
maxLength={30}
|
50
52
|
error='This is error message'
|
51
53
|
info='This is some hint message'
|
@@ -53,6 +55,24 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
53
55
|
required={this.state.required}
|
54
56
|
disabled={this.state.disabled}
|
55
57
|
invalid={this.state.invalid}
|
58
|
+
onChange={(value) => {this.setState({val: value})}} />
|
59
|
+
</div>
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
64
|
+
<p className="docs-page__paragraph">// Hidden label</p>
|
65
|
+
<div className='form__row'>
|
66
|
+
<Input label='Hidden input label'
|
67
|
+
value='Lorem ipsum input'
|
68
|
+
maxLength={30}
|
69
|
+
error='This is an error message'
|
70
|
+
info='This is a hint message'
|
71
|
+
inlineLabel={true}
|
72
|
+
labelHidden={true}
|
73
|
+
required={false}
|
74
|
+
disabled={false}
|
75
|
+
invalid={false}
|
56
76
|
onChange={(value) => {}} />
|
57
77
|
</div>
|
58
78
|
</div>
|
@@ -80,6 +100,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
80
100
|
<Prop name='info' isRequired={false} type='string' default='/' description='Hint text'/>
|
81
101
|
<Prop name='error' isRequired={false} type='string' default='/' description='Error text'/>
|
82
102
|
<Prop name='inlineLabel' isRequired={false} type='boolean' default='false' description='Position labels as inline'/>
|
103
|
+
<Prop name='labelHidden' isRequired={false} type='boolean' default='false' description='Hide the label. The label will still be accessible to screen-readers.'/>
|
83
104
|
<Prop name='required' isRequired={false} type='boolean' default='false' description='Mark field as required'/>
|
84
105
|
<Prop name='disabled' isRequired={false} type='boolean' default='false' description='Mark field as disabled'/>
|
85
106
|
<Prop name='invalid' isRequired={false} type='boolean' default='false' description='Mark field as invalid'/>
|
@@ -37,7 +37,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
37
37
|
<p className='docs-page__paragraph'></p>
|
38
38
|
<Markup.ReactMarkup>
|
39
39
|
<Markup.ReactMarkupPreview>
|
40
|
-
<div className='docs-page__content-row
|
40
|
+
<div className='docs-page__content-row'>
|
41
41
|
<div className='form__row'>
|
42
42
|
<CheckGroup>
|
43
43
|
<Checkbox checked={this.state.required} label={{ text: 'Required input' }} onChange={(value) => { this.setState({ required: value }) }} />
|
@@ -63,6 +63,27 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
63
63
|
</div>
|
64
64
|
</div>
|
65
65
|
|
66
|
+
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
67
|
+
<p className="docs-page__paragraph">// Hidden label</p>
|
68
|
+
<div className='form__row'>
|
69
|
+
<Select label='Hidden select label'
|
70
|
+
value='Option 1'
|
71
|
+
error='Error message'
|
72
|
+
info='This is a hint message'
|
73
|
+
inlineLabel={true}
|
74
|
+
labelHidden={true}
|
75
|
+
required={false}
|
76
|
+
disabled={false}
|
77
|
+
invalid={this.state.invalid}
|
78
|
+
onChange={(value) => { console.log(value) }}>
|
79
|
+
<Option>Option 1</Option>
|
80
|
+
<Option>Option 2</Option>
|
81
|
+
<Option>Option 3</Option>
|
82
|
+
<Option>Option 4</Option>
|
83
|
+
</Select>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
66
87
|
</Markup.ReactMarkupPreview>
|
67
88
|
<Markup.ReactMarkupCode>{`
|
68
89
|
<Select label='Select label'
|
@@ -87,6 +108,7 @@ export default class InputsDoc extends React.Component<{}, IState> {
|
|
87
108
|
<Prop name='info' isRequired={false} type='string' default='/' description='Hint text' />
|
88
109
|
<Prop name='error' isRequired={false} type='string' default='/' description='Error text' />
|
89
110
|
<Prop name='inlineLabel' isRequired={false} type='boolean' default='false' description='Position labels as inline' />
|
111
|
+
<Prop name='labelHidden' isRequired={false} type='boolean' default='false' description='Hide the label. The label will still be accessible to screen-readers.'/>
|
90
112
|
<Prop name='required' isRequired={false} type='boolean' default='false' description='Mark field as required' />
|
91
113
|
<Prop name='disabled' isRequired={false} type='boolean' default='false' description='Mark field as disabled' />
|
92
114
|
<Prop name='invalid' isRequired={false} type='boolean' default='false' description='Mark field as invalid' />
|
@@ -2,30 +2,45 @@ import * as React from 'react';
|
|
2
2
|
|
3
3
|
import * as Markup from '../../js/react';
|
4
4
|
|
5
|
-
import { Tab, TabList, Prop, PropsList } from '../../../app-typescript';
|
6
|
-
import {
|
5
|
+
import { Tab, TabList, Prop, PropsList, TabNav, TabItem } from '../../../app-typescript';
|
6
|
+
import {TabPanel, TabContent} from '../../../app-typescript';
|
7
|
+
import { stringify } from 'querystring';
|
7
8
|
|
8
9
|
interface IState {
|
9
|
-
|
10
|
+
selected: string;
|
11
|
+
customSelected: string;
|
12
|
+
alternativeWaySelected: string;
|
10
13
|
}
|
11
14
|
|
12
15
|
export default class TabsDoc extends React.Component<{}, IState> {
|
13
16
|
constructor(props){
|
14
17
|
super(props);
|
15
18
|
this.state = {
|
16
|
-
|
19
|
+
selected: null,
|
20
|
+
customSelected: 'metadata',
|
21
|
+
alternativeWaySelected: null,
|
17
22
|
}
|
18
23
|
this.handleClick=this.handleClick.bind(this);
|
24
|
+
this.handleClick_customTab=this.handleClick_customTab.bind(this);
|
25
|
+
this.handleClick_alternativeWay=this.handleClick_alternativeWay.bind(this);
|
19
26
|
}
|
20
27
|
tabs: TabList;
|
21
28
|
|
22
|
-
|
23
|
-
this.
|
29
|
+
handleClick = (id: string) => {
|
30
|
+
this.setState({
|
31
|
+
selected: id,
|
32
|
+
})
|
33
|
+
}
|
34
|
+
|
35
|
+
handleClick_customTab = (id: string) => {
|
36
|
+
this.setState({
|
37
|
+
customSelected: id,
|
38
|
+
})
|
24
39
|
}
|
25
40
|
|
26
|
-
|
41
|
+
handleClick_alternativeWay = (id: string) => {
|
27
42
|
this.setState({
|
28
|
-
|
43
|
+
alternativeWaySelected: id,
|
29
44
|
})
|
30
45
|
}
|
31
46
|
|
@@ -34,32 +49,78 @@ export default class TabsDoc extends React.Component<{}, IState> {
|
|
34
49
|
<section className="docs-page__container">
|
35
50
|
<h2 className="docs-page__h2">Tabs</h2>
|
36
51
|
<Markup.ReactMarkupCodePreview>{`
|
37
|
-
<TabList
|
38
|
-
|
39
|
-
|
40
|
-
|
52
|
+
<TabList ref={(tabs) => {
|
53
|
+
this.tabs = tabs;
|
54
|
+
}}
|
55
|
+
tabs={[
|
56
|
+
{label: 'Content', content: 'Content here.', id: 'content'},
|
57
|
+
{label: 'Metadata', content: 'Metadata here', id: 'metadata'},
|
58
|
+
{label: 'Duplicate', content: 'Duplicate here.', id: 'duplicate'}
|
59
|
+
]}
|
60
|
+
>
|
41
61
|
</TabList>
|
42
62
|
`}
|
43
63
|
</Markup.ReactMarkupCodePreview>
|
44
64
|
<h3 className="docs-page__h3">Default tabs</h3>
|
45
|
-
<p className="docs-page__paragraph">To have a tab-like navigation add the <code>TabList</code> component and multiple <code>Tab</code> components inside of it.</p>
|
65
|
+
<p className="docs-page__paragraph">To have a tab-like navigation add the <code>TabList</code> component and multiple <code>Tab</code> components inside of it, or add the appropriate attributes on <code>TabList.</code></p>
|
46
66
|
<Markup.ReactMarkup>
|
47
67
|
<Markup.ReactMarkupPreview>
|
48
68
|
<div className='docs-page__content-row'>
|
49
|
-
<TabList
|
69
|
+
<TabList ref={(tabs) => {
|
50
70
|
this.tabs = tabs;
|
51
|
-
}}
|
52
|
-
|
53
|
-
|
54
|
-
|
71
|
+
}}
|
72
|
+
tabs={[
|
73
|
+
{label: 'Content', content: 'Content here.', id: 'content'},
|
74
|
+
{label: 'Metadata', content: 'Metadata here', id: 'metadata'},
|
75
|
+
{label: 'Duplicate', content: 'Duplicate here.', id: 'duplicate'}
|
76
|
+
]}
|
77
|
+
>
|
78
|
+
{/* <Tab label='Content' id='content' >Content here.</Tab>
|
79
|
+
<Tab label='Metadata' id='metadata' >Metadata here.</Tab>
|
80
|
+
<Tab label='Duplicates' id='duplicate' >Duplicates here.</Tab> */}
|
81
|
+
</TabList>
|
82
|
+
</div>
|
83
|
+
<p className="docs-page__paragraph">// Start width custom tab.</p>
|
84
|
+
<div className='docs-page__content-row'>
|
85
|
+
<TabList ref={(tabs) => {
|
86
|
+
this.tabs = tabs;
|
87
|
+
}}
|
88
|
+
selected='metadata'
|
89
|
+
tabs={[
|
90
|
+
{label: 'Content', content: 'Content here.', id: 'content'},
|
91
|
+
{label: 'Metadata', content: 'Metadata here', id: 'metadata'},
|
92
|
+
{label: 'Duplicate', content: 'Duplicate here.', id: 'duplicate'}
|
93
|
+
]}
|
94
|
+
>
|
95
|
+
{/* <Tab label='Content' id='content' >Content here.</Tab>
|
96
|
+
<Tab label='Metadata' id='metadata' >Metadata here.</Tab>
|
97
|
+
<Tab label='Duplicates' id='duplicate' >Duplicates here.</Tab> */}
|
55
98
|
</TabList>
|
56
99
|
</div>
|
57
100
|
</Markup.ReactMarkupPreview>
|
58
101
|
<Markup.ReactMarkupCode>{`
|
59
|
-
<TabList
|
60
|
-
|
61
|
-
|
62
|
-
|
102
|
+
<TabList ref={(tabs) => {
|
103
|
+
this.tabs = tabs;
|
104
|
+
}}
|
105
|
+
tabs={[
|
106
|
+
{label: 'Content', content: 'Content here.', id: 'content'},
|
107
|
+
{label: 'Metadata', content: 'Metadata here', id: 'metadata'},
|
108
|
+
{label: 'Duplicate', content: 'Duplicate here.', id: 'duplicate'}
|
109
|
+
]}
|
110
|
+
>
|
111
|
+
</TabList>
|
112
|
+
|
113
|
+
// start with custom tab (add atributte selected)
|
114
|
+
<TabList ref={(tabs) => {
|
115
|
+
this.tabs = tabs;
|
116
|
+
}}
|
117
|
+
selected='metadata' //tabs.id
|
118
|
+
tabs={[
|
119
|
+
{label: 'Content', content: 'Content here.', id: 'content'},
|
120
|
+
{label: 'Metadata', content: 'Metadata here', id: 'metadata'},
|
121
|
+
{label: 'Duplicate', content: 'Duplicate here.', id: 'duplicate'}
|
122
|
+
]}
|
123
|
+
>
|
63
124
|
</TabList>
|
64
125
|
`}
|
65
126
|
</Markup.ReactMarkupCode>
|
@@ -139,74 +200,166 @@ export default class TabsDoc extends React.Component<{}, IState> {
|
|
139
200
|
</Markup.ReactMarkupCode>
|
140
201
|
</Markup.ReactMarkup>
|
141
202
|
|
142
|
-
<h3 className="docs-page__h3">Tabs with two components ( <code>
|
143
|
-
<p className="docs-page__paragraph">If you want to use on one place list of tabs and on another place content of tabs, wrap all <code>
|
203
|
+
<h3 className="docs-page__h3">Tabs with two components ( <code>TabNav</code> and <code> TabContent</code> ) </h3>
|
204
|
+
<p className="docs-page__paragraph">If you want to use on one place list of tabs and on another place content of tabs, wrap all <code>TabItem</code> with <code>TabNav</code> component and all <code>TabPanel</code> components with <code>TabContent</code>, or add the appropriate attributes on <code>TabNav</code> and <code>TabContent</code></p>
|
205
|
+
<Markup.ReactMarkup>
|
206
|
+
<Markup.ReactMarkupPreview>
|
207
|
+
<div className='docs-page__content-row'>
|
208
|
+
<TabNav onClick={this.handleClick} activePanel={this.state.selected}
|
209
|
+
tabs={[
|
210
|
+
{label: 'Content', id: 'content'},
|
211
|
+
{label: 'Metadata', id: 'metadata'},
|
212
|
+
{label: 'Duplicate', id: 'duplicate'}
|
213
|
+
]}
|
214
|
+
>
|
215
|
+
</TabNav>
|
216
|
+
<TabContent activePanel={this.state.selected}
|
217
|
+
tabs={[
|
218
|
+
{content: 'Content here.', id: 'content'},
|
219
|
+
{content: 'Metadata here.', id: 'metadata'},
|
220
|
+
{content: 'Duplicates here.', id: 'duplicate'}
|
221
|
+
]}
|
222
|
+
>
|
223
|
+
</TabContent>
|
224
|
+
</div>
|
225
|
+
<p className="docs-page__paragraph">// Start width custom tab.</p>
|
226
|
+
<div className='docs-page__content-row'>
|
227
|
+
<TabNav onClick={this.handleClick_customTab} activePanel={this.state.customSelected}
|
228
|
+
tabs={[
|
229
|
+
{label: 'Content', id: 'content'},
|
230
|
+
{label: 'Metadata', id: 'metadata'},
|
231
|
+
{label: 'Duplicate', id: 'duplicate'}
|
232
|
+
]}
|
233
|
+
>
|
234
|
+
</TabNav>
|
235
|
+
<TabContent activePanel={this.state.customSelected}
|
236
|
+
tabs={[
|
237
|
+
{content: 'Content here.', id: 'content'},
|
238
|
+
{content: 'Metadata here.', id: 'metadata'},
|
239
|
+
{content: 'Duplicates here.', id: 'duplicate'}
|
240
|
+
]}
|
241
|
+
>
|
242
|
+
</TabContent>
|
243
|
+
</div>
|
244
|
+
</Markup.ReactMarkupPreview>
|
245
|
+
<Markup.ReactMarkupCode>{`
|
246
|
+
this.state = {
|
247
|
+
selected: null,
|
248
|
+
}
|
249
|
+
handleClick = (id: string) => {
|
250
|
+
this.setState({
|
251
|
+
selected: id,
|
252
|
+
})
|
253
|
+
}
|
254
|
+
|
255
|
+
<TabNav onClick={this.handleClick} activePanel={this.state.selected}
|
256
|
+
tabs={[
|
257
|
+
{label: 'Content', id: 'content'},
|
258
|
+
{label: 'Metadata', id: 'metadata'},
|
259
|
+
{label: 'Duplicate', id: 'duplicate'}
|
260
|
+
]}
|
261
|
+
>
|
262
|
+
</TabNav>
|
263
|
+
<TabContent activePanel={this.state.selected}
|
264
|
+
tabs={[
|
265
|
+
{content: 'Content here.', id: 'content'},
|
266
|
+
{content: 'Metadata here.', id: 'metadata'},
|
267
|
+
{content: 'Duplicates here.', id: 'duplicate'}
|
268
|
+
]}
|
269
|
+
>
|
270
|
+
</TabContent>
|
271
|
+
|
272
|
+
// start with custom tab
|
273
|
+
this.state = {
|
274
|
+
selected: 'metadata' //tabs.id,
|
275
|
+
}
|
276
|
+
`}
|
277
|
+
</Markup.ReactMarkupCode>
|
278
|
+
</Markup.ReactMarkup>
|
279
|
+
|
280
|
+
<p className="docs-page__paragraph">Alternative way with children:</p>
|
144
281
|
<Markup.ReactMarkup>
|
145
282
|
<Markup.ReactMarkupPreview>
|
146
283
|
<div className='docs-page__content-row'>
|
147
|
-
<
|
148
|
-
<
|
149
|
-
<
|
150
|
-
<
|
151
|
-
</
|
152
|
-
<TabContent activePanel={this.state.
|
153
|
-
<TabPanel
|
154
|
-
|
155
|
-
|
156
|
-
<TabPanel indexValue={1}>
|
157
|
-
Metadata here.
|
158
|
-
</TabPanel>
|
159
|
-
<TabPanel indexValue={2}>
|
160
|
-
Duplicates here.
|
161
|
-
</TabPanel>
|
284
|
+
<TabNav onClick={this.handleClick_alternativeWay} activePanel={this.state.alternativeWaySelected}>
|
285
|
+
<TabItem id='content'>Content</TabItem>
|
286
|
+
<TabItem id='metadata'>Metadata</TabItem>
|
287
|
+
<TabItem id='duplicate'>Duplicate</TabItem>
|
288
|
+
</TabNav>
|
289
|
+
<TabContent activePanel={this.state.alternativeWaySelected}>
|
290
|
+
<TabPanel id='content'>Content here.</TabPanel>
|
291
|
+
<TabPanel id='metadata'>Metadata here.</TabPanel>
|
292
|
+
<TabPanel id='duplicate'>Duplicates here.</TabPanel>
|
162
293
|
</TabContent>
|
163
294
|
</div>
|
164
295
|
</Markup.ReactMarkupPreview>
|
165
296
|
<Markup.ReactMarkupCode>{`
|
166
|
-
|
167
|
-
|
168
|
-
|
297
|
+
this.state = {
|
298
|
+
selected: null,
|
299
|
+
}
|
300
|
+
handleClick = (id: string) => {
|
301
|
+
this.setState({
|
302
|
+
selected: id,
|
303
|
+
})
|
169
304
|
}
|
170
305
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
Metadata here.
|
182
|
-
</TabPanel>
|
183
|
-
<TabPanel indexValue={2}>
|
184
|
-
Duplicates here.
|
185
|
-
</TabPanel>
|
186
|
-
</TabContent>
|
306
|
+
<TabNav onClick={this.handleClick} activePanel={this.state.selected}>
|
307
|
+
<TabItem id='content'>Content</TabItem>
|
308
|
+
<TabItem id='metadata'>Metadata</TabItem>
|
309
|
+
<TabItem id='duplicate'>Duplicate</TabItem>
|
310
|
+
</TabNav>
|
311
|
+
<TabContent activePanel={this.state.selected}>
|
312
|
+
<TabPanel id='content'>Content here.</TabPanel>
|
313
|
+
<TabPanel id='metadata'>Metadata here.</TabPanel>
|
314
|
+
<TabPanel id='duplicate'>Duplicates here.</TabPanel>
|
315
|
+
</TabContent>
|
187
316
|
`}
|
188
317
|
</Markup.ReactMarkupCode>
|
189
318
|
</Markup.ReactMarkup>
|
190
319
|
|
191
320
|
<h3 className="docs-page__h3">Props</h3>
|
321
|
+
<br/>
|
322
|
+
<h4 className="docs-page__h4">TabList</h4>
|
192
323
|
<PropsList>
|
193
|
-
<Prop name='
|
194
|
-
<Prop name='
|
195
|
-
<Prop name='
|
324
|
+
<Prop name='TabList size' isRequired={false} type='small | normal | large' default='normal' description='Specifies a small, normal or large button.'/>
|
325
|
+
<Prop name='TabList theme' isRequired={false} type='light | dark' default='light' description='Styles tablist for diffrent background'/>
|
326
|
+
<Prop name='TabList selected' isRequired={false} type='string' default='/' description='Specify which tab should be pre-selected'/>
|
327
|
+
<Prop name='TabList tabs' isRequired={false} type='Array<label: string, content: React.ReactNode, id: string>' default='/' description='Array of objects'/>
|
328
|
+
<Prop name='Tab label' isRequired={false} type='string' default='/' description='Text value of label'/>
|
329
|
+
<Prop name='Tab id' isRequired={false} type='string' default='/' description='Id value of Tab component'/>
|
330
|
+
<Prop name='Tab children' isRequired={false} type='React.ReactNode' default='/' description='Children of component'/>
|
331
|
+
</PropsList>
|
332
|
+
<p className='docs-page__paragraph'>tabs: TabList</p>
|
333
|
+
<PropsList>
|
334
|
+
<Prop name='label' isRequired={true} type='string' default='/' description='Text value of label'/>
|
335
|
+
<Prop name='content' isRequired={true} type='React.ReactNode' default='/' description='React.ReactNode'/>
|
336
|
+
<Prop name='id' isRequired={true} type='string' default='/' description='Id value'/>
|
196
337
|
</PropsList>
|
197
338
|
<br/>
|
198
|
-
<h4 className="docs-page__h4">
|
339
|
+
<h4 className="docs-page__h4">TabNav and TabContent</h4>
|
340
|
+
<PropsList>
|
341
|
+
<Prop name='TabNav size' isRequired={false} type='small | normal | large' default='normal' description='Specifies a small, normal or large button'/>
|
342
|
+
<Prop name='TabNav theme' isRequired={false} type='light | dark' default='light' description='Styles tablist for diffrent background'/>
|
343
|
+
<Prop name='TabNav ariaLabel' isRequired={false} type='string' default='/' description='Text value of aria-label'/>
|
344
|
+
<Prop name='TabNav onClick' isRequired={true} type='function' default='/' description='Use to return value of clicked label'/>
|
345
|
+
<Prop name='TabNav activePanel' isRequired={true} type='string' default='/' description='Specify which tab should be pre-selected'/>
|
346
|
+
<Prop name='TabNav tabs' isRequired={false} type='Array<label: string, id: string>' default='/' description='Array of objects'/>
|
347
|
+
<Prop name='TabItem id' isRequired={true} type='string' default='/' description='Id value of Tab Item'/>
|
348
|
+
<Prop name='TabItem label' isRequired={true} type='string' default='/' description='Text value of Tab label'/>
|
349
|
+
<Prop name='TabContent theme' isRequired={false} type='light | dark' default='light' description='Styles tablist for diffrent background'/>
|
350
|
+
<Prop name='TabContent activePanel' isRequired={true} type='string' default='/' description='Specify which tab should be pre-selected'/>
|
351
|
+
<Prop name='TabContent tabs' isRequired={false} type='Array<content: React.ReactNode, id: string>' default='/' description='Array of objects'/>
|
352
|
+
<Prop name='TabPanel id' isRequired={true} type='string' default='/' description='Id value of Tab Panel'/>
|
353
|
+
</PropsList>
|
354
|
+
<p className='docs-page__paragraph'>tabs: TabNav</p>
|
355
|
+
<PropsList>
|
356
|
+
<Prop name='label' isRequired={true} type='string' default='/' description='Text value of label'/>
|
357
|
+
<Prop name='id' isRequired={true} type='string' default='/' description='Unique identifier to connect tab nav and tab content'/>
|
358
|
+
</PropsList>
|
359
|
+
<p className='docs-page__paragraph'>tabs: TabContent</p>
|
199
360
|
<PropsList>
|
200
|
-
<Prop name='
|
201
|
-
<Prop name='
|
202
|
-
<Prop name='tabs ariaLabel' isRequired={false} type='string' default='/' description='Text value of aria-label'/>
|
203
|
-
<Prop name='tabs onClick' isRequired={true} type='function' default='/' description='Use to return value of clicked label'/>
|
204
|
-
<Prop name='tablabel indexValue' isRequired={true} type='number' default='/' description='Index value of label'/>
|
205
|
-
<Prop name='tablabel label' isRequired={true} type='string' default='/' description='Text value of Tab label'/>
|
206
|
-
|
207
|
-
<Prop name='tabcontent theme' isRequired={false} type='light | dark' default='light' description='Styles tablist for diffrent background.'/>
|
208
|
-
<Prop name='tabcontent activePanel' isRequired={true} type='number' default='/' description='Index value of active Tab'/>
|
209
|
-
<Prop name='tabpanel indexValue' isRequired={true} type='number' default='/' description='Index value of Tab Panel'/>
|
361
|
+
<Prop name='content' isRequired={true} type='React.ReactNode' default='/' description='React.ReactNode'/>
|
362
|
+
<Prop name='id' isRequired={true} type='string' default='/' description='Unique identifier to connect tab nav and tab content'/>
|
210
363
|
</PropsList>
|
211
364
|
</section>
|
212
365
|
)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "superdesk-ui-framework",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.20",
|
4
4
|
"license": "AGPL-3.0",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -88,7 +88,7 @@
|
|
88
88
|
"date-fns": "2.7.0",
|
89
89
|
"popper.js": "1.14.4",
|
90
90
|
"primeicons": "2.0.0",
|
91
|
-
"react-id-generator": "^3.0.
|
91
|
+
"react-id-generator": "^3.0.2",
|
92
92
|
"react-popper": "^2.2.3"
|
93
93
|
}
|
94
94
|
}
|