@imposium-hub/components 1.29.0 → 1.30.0
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/.storybook/main.js +1 -1
- package/.storybook/preview-head.html +5 -0
- package/components/button-group-field/ButtonGroupField.stories.tsx +59 -0
- package/components/button-menu/ButtonMenu.stories.tsx +41 -0
- package/components/card/Card.stories.tsx +44 -0
- package/components/checkbox-field/CheckboxField.stories.tsx +34 -0
- package/components/color-field/ColorFiled.stories.tsx +39 -0
- package/components/controlled-list/ControlledList.stories.tsx +26 -0
- package/components/determinate-loader/DeterminateLoader.stories.tsx +43 -0
- package/components/dropdown/dropdown.stories.tsx +43 -0
- package/components/field-wrapper/FieldWrapper.stories.tsx +44 -0
- package/components/h-rule/HRule.stories.tsx +17 -0
- package/components/list-field/ListField.stories.tsx +40 -0
- package/components/modal/Modal.stories.tsx +51 -0
- package/components/number-field/NumberField.stories.tsx +43 -0
- package/components/section/Section.stories.tsx +82 -0
- package/components/select-field/SelectField.stories.tsx +38 -0
- package/components/shortcut-menu/ShortcutMenu.stories.tsx +24 -0
- package/components/slider-field/SliderField.stories.tsx +48 -0
- package/components/tabs/Tabs.stories.tsx +66 -0
- package/components/text-area-field/TextAreaField.stories.tsx +46 -0
- package/components/text-field/TextField.stories.tsx +52 -0
- package/dist/components.js +2 -2
- package/dist/components.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/styles.less +4 -0
- package/dist/styles.less.map +1 -1
- package/less/components/form-field.less +4 -0
- package/package.json +14 -7
- package/services/API.ts +8 -0
package/.storybook/main.js
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import ButtonGroupField from './ButtonGroupField';
|
|
4
|
+
import { IToolTipConfig, } from '../Tooltip';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'ButtonGroupField',
|
|
8
|
+
component: ButtonGroupField,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Interfaces For Reference
|
|
12
|
+
interface IButtonGroupOption {
|
|
13
|
+
value : string | boolean;
|
|
14
|
+
label : string;
|
|
15
|
+
bgColor? : string;
|
|
16
|
+
icon? : JSX.Element;
|
|
17
|
+
onDoubleClick? : (...args) => any;
|
|
18
|
+
tooltip? : IToolTipConfig | string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface IButtonGroupFieldProps {
|
|
22
|
+
label? : string;
|
|
23
|
+
width? : string | number;
|
|
24
|
+
value : string;
|
|
25
|
+
options : IButtonGroupOption[];
|
|
26
|
+
tooltip? : IToolTipConfig | string;
|
|
27
|
+
onChange(e) : void;
|
|
28
|
+
info? : string;
|
|
29
|
+
labelPosition? : string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const OVERLAY_ENGINE_TYPES = {
|
|
33
|
+
CHROMIUM: 'chromium',
|
|
34
|
+
PHANTOM: ''
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const SAMPLE_OPTIONS = [
|
|
38
|
+
{
|
|
39
|
+
value: OVERLAY_ENGINE_TYPES.CHROMIUM,
|
|
40
|
+
label: 'Chromium'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: OVERLAY_ENGINE_TYPES.PHANTOM,
|
|
44
|
+
label: 'Phantom'
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const defaultField = () => (
|
|
49
|
+
<ButtonGroupField
|
|
50
|
+
label = 'Button Group'
|
|
51
|
+
width = {'300px'}
|
|
52
|
+
value = 'Default Value'
|
|
53
|
+
options = {SAMPLE_OPTIONS}
|
|
54
|
+
tooltip = 'ButtonGroupField Tooltip'
|
|
55
|
+
onChange = {action('Field onChange')}
|
|
56
|
+
info = 'This is some additional information about the field'
|
|
57
|
+
labelPosition = 'center'
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import ButtonMenu from './ButtonMenu';
|
|
4
|
+
import Button from '../button/Button';
|
|
5
|
+
import ButtonMenuItem from './ButtonMenuItem';
|
|
6
|
+
import {ICON_COPY, ICON_BARS} from '../../constants/icons';
|
|
7
|
+
|
|
8
|
+
// Interfaces For Reference
|
|
9
|
+
interface IButtonMenuProps {
|
|
10
|
+
button : any;
|
|
11
|
+
items : any;
|
|
12
|
+
position : string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IButtonMenuState {
|
|
16
|
+
open : boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const menuItems = [
|
|
20
|
+
<ButtonMenuItem
|
|
21
|
+
key = 'duplicate'
|
|
22
|
+
label = {<span>{ICON_COPY} Duplicate</span>}
|
|
23
|
+
onClick = {action('CLICKED')}/>,
|
|
24
|
+
<ButtonMenuItem
|
|
25
|
+
key = 'delete'
|
|
26
|
+
label = {<span>{ICON_BARS} Trash</span>}
|
|
27
|
+
onClick = {action('CLICKED')}/>
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
title: 'ButtonMenu',
|
|
32
|
+
component: ButtonMenu
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const rightButtonMenuWithButtonMenuItem = () => (
|
|
36
|
+
<ButtonMenu
|
|
37
|
+
position = 'right'
|
|
38
|
+
items = {menuItems}
|
|
39
|
+
button = {<Button style = 'subtle'>{ICON_BARS}</Button>}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import TextField from '../text-field/TextField';
|
|
4
|
+
import NumberField from '../number-field/NumberField';
|
|
5
|
+
import Card from './Card';
|
|
6
|
+
|
|
7
|
+
interface ICardProps {
|
|
8
|
+
collapsable? : boolean;
|
|
9
|
+
open? : boolean;
|
|
10
|
+
style? : string;
|
|
11
|
+
title : string;
|
|
12
|
+
onToggle ? : (toggle : boolean) => any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ICardState {
|
|
16
|
+
open : boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Card',
|
|
21
|
+
component: Card
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const defaultCard = () => (
|
|
25
|
+
<Card
|
|
26
|
+
title = 'Card'
|
|
27
|
+
open = {true}
|
|
28
|
+
collapsable = {false}>
|
|
29
|
+
<TextField
|
|
30
|
+
label = {'TextField'}
|
|
31
|
+
tooltip = {'TOOLTIP'}
|
|
32
|
+
value = {'name'}
|
|
33
|
+
width = '33%'
|
|
34
|
+
onChange = {action('CLICKED')}/>
|
|
35
|
+
<NumberField
|
|
36
|
+
label = {'NumberField'}
|
|
37
|
+
tooltip = {'TOOLTIP'}
|
|
38
|
+
width = '33%'
|
|
39
|
+
readOnly = {true}
|
|
40
|
+
value = {1}
|
|
41
|
+
onChange = {action('CLICKED')}
|
|
42
|
+
/>
|
|
43
|
+
</Card>
|
|
44
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {useState} from 'react';
|
|
3
|
+
import CheckBoxField from './CheckboxField';
|
|
4
|
+
import { IToolTipConfig } from '../Tooltip';
|
|
5
|
+
|
|
6
|
+
// Interface For Reference
|
|
7
|
+
interface ICheckboxFieldProps {
|
|
8
|
+
label? : string;
|
|
9
|
+
value : boolean;
|
|
10
|
+
width? : string | number;
|
|
11
|
+
tooltip? : IToolTipConfig | string;
|
|
12
|
+
propagate ? : boolean;
|
|
13
|
+
onChange(v, e) : void;
|
|
14
|
+
info? : string;
|
|
15
|
+
labelPosition? : string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
title: 'CheckBoxField',
|
|
20
|
+
component: CheckBoxField
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const defaultCheckboxField = () => {
|
|
24
|
+
const [clicked, setClicked] = useState(true);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<CheckBoxField
|
|
28
|
+
width = {'300px'}
|
|
29
|
+
label = {'Checkbox Field'}
|
|
30
|
+
tooltip = {'TOOLTIP'}
|
|
31
|
+
value = {clicked}
|
|
32
|
+
onChange = {() => setClicked(!clicked)}/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import ColorField from './ColorField';
|
|
4
|
+
import { action } from '@storybook/addon-actions';
|
|
5
|
+
import { IToolTipConfig } from '../Tooltip';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'ColorField',
|
|
9
|
+
component: ColorField
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Interface For Reference
|
|
13
|
+
interface IColorFieldProps {
|
|
14
|
+
buttons? : any;
|
|
15
|
+
label? : string;
|
|
16
|
+
placeholder? : string;
|
|
17
|
+
readOnly? : boolean;
|
|
18
|
+
value : string;
|
|
19
|
+
tooltip? : IToolTipConfig | string;
|
|
20
|
+
enableAlpha? : boolean;
|
|
21
|
+
presetColors? : any[];
|
|
22
|
+
width? : string | number;
|
|
23
|
+
onChange(e) : void;
|
|
24
|
+
info? : string;
|
|
25
|
+
labelPosition? : string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const defaultColorField = () => {
|
|
29
|
+
const [color, setColor] = useState('red');
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<ColorField
|
|
33
|
+
label = {'Color Field'}
|
|
34
|
+
tooltip = {'TOOLTIP'}
|
|
35
|
+
width = {'300px'}
|
|
36
|
+
value = {color}
|
|
37
|
+
onChange = {action('CHANGED')}/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import ControlledList from './ControlledList';
|
|
4
|
+
import Tag from '../Tag/Tag';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'ControlledList',
|
|
8
|
+
componenet: ControlledList
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Interface For Reference
|
|
12
|
+
interface IControlledListProps {
|
|
13
|
+
items? : any[];
|
|
14
|
+
removable? : boolean;
|
|
15
|
+
onRemove?(index) : void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ControlledListWithTags = () => (
|
|
19
|
+
<div style={{width: '8%'}}>
|
|
20
|
+
<ControlledList
|
|
21
|
+
items = {[<Tag key = {`tag1`} copy = 'Sample Tag' />, <Tag key = {`tag2`} copy = 'Sample Tag' />]}
|
|
22
|
+
removable = {true}
|
|
23
|
+
onRemove = {action('REMOVED')}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import DeterminateLoader from './DeterminateLoader';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'DeterminateLoader',
|
|
7
|
+
component: DeterminateLoader
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
interface IDeterminateLoaderProps {
|
|
11
|
+
progress : number; // expects int 0-100 (%)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const DeterminateLoader50Percent = () => (
|
|
15
|
+
<DeterminateLoader
|
|
16
|
+
progress = {50}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const DeterminateLoader25Percent = () => (
|
|
21
|
+
<DeterminateLoader
|
|
22
|
+
progress = {25}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const DeterminateLoaderLoading = () => {
|
|
27
|
+
const [percent, setPercent] = useState(0);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
if ( percent < 100) {
|
|
32
|
+
setPercent(percent + 1);
|
|
33
|
+
}
|
|
34
|
+
}, 10);
|
|
35
|
+
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<DeterminateLoader
|
|
40
|
+
progress = {percent}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import ImposiumDropdown from './dropdown';
|
|
3
|
+
import Button from '../button/Button';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'DropDown',
|
|
7
|
+
component: ImposiumDropdown
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export interface IDropdownMenuProps {
|
|
11
|
+
toggleRef : any;
|
|
12
|
+
show : boolean;
|
|
13
|
+
fixed? : boolean;
|
|
14
|
+
children : React.ReactChild;
|
|
15
|
+
position : 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
|
|
16
|
+
onOutsideClick : (...args) => any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IDropdownMenuState {
|
|
20
|
+
build : any;
|
|
21
|
+
offset : any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const defaultDropDown = () => {
|
|
25
|
+
const dropdownToggleRef = React.useRef(undefined);
|
|
26
|
+
const [toggle, setToggle] = React.useState(false);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<Button onClick = {() => setToggle(!toggle)} ref = {dropdownToggleRef}>
|
|
31
|
+
Sample DropDown Toggle
|
|
32
|
+
</Button>
|
|
33
|
+
<ImposiumDropdown
|
|
34
|
+
toggleRef = {dropdownToggleRef}
|
|
35
|
+
show = {toggle}
|
|
36
|
+
fixed
|
|
37
|
+
position = 'bottomright'
|
|
38
|
+
onOutsideClick = {() => setToggle(!toggle)}>
|
|
39
|
+
Sample
|
|
40
|
+
</ImposiumDropdown>
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import {IToolTipConfig} from '../Tooltip';
|
|
4
|
+
import FieldWrapper from './FieldWrapper';
|
|
5
|
+
import SelectField from '../select-field/SelectField';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'FieldWrapper',
|
|
9
|
+
component: FieldWrapper
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
interface IFieldWrapperProps {
|
|
13
|
+
buttons? : any;
|
|
14
|
+
children : any;
|
|
15
|
+
customClass? : string;
|
|
16
|
+
label? : any;
|
|
17
|
+
tooltip? : IToolTipConfig | string;
|
|
18
|
+
info? : any;
|
|
19
|
+
width? : string | number;
|
|
20
|
+
labelPosition? : string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface IFieldWrapperState {
|
|
24
|
+
showInfo : boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const defaultFieldWrapperWithSelectField = () => (
|
|
28
|
+
<FieldWrapper
|
|
29
|
+
width = '50%'
|
|
30
|
+
label = {'Field Wrapper'}>
|
|
31
|
+
<SelectField
|
|
32
|
+
label = {'SelectField'}
|
|
33
|
+
value = {'SelectField'}
|
|
34
|
+
width = '50%'
|
|
35
|
+
options = {['Item1', 'Item2']}
|
|
36
|
+
onChange = {action('CLICKED')}/>
|
|
37
|
+
<SelectField
|
|
38
|
+
label = {'SelectField'}
|
|
39
|
+
value = {'SelectField'}
|
|
40
|
+
width = '50%'
|
|
41
|
+
options = {['Item1', 'Item2']}
|
|
42
|
+
onChange = {action('CLICKED')}/>
|
|
43
|
+
</FieldWrapper>
|
|
44
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import HRule from './HRule';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'HRule',
|
|
6
|
+
component: HRule
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// This is hard to see
|
|
10
|
+
export const defaultHRule = () => (
|
|
11
|
+
<>
|
|
12
|
+
<HRule />
|
|
13
|
+
<HRule style = 'subtle' />
|
|
14
|
+
<HRule />
|
|
15
|
+
<HRule style = 'subtle' />
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import ListField from './ListField';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
import { IToolTipConfig } from '../Tooltip';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'ListFIeld',
|
|
8
|
+
component: ListField
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
interface IListFieldProps {
|
|
12
|
+
buttons? : any;
|
|
13
|
+
disabled? : boolean;
|
|
14
|
+
label? : string;
|
|
15
|
+
options : any;
|
|
16
|
+
placeholder? : string;
|
|
17
|
+
tooltip ? : IToolTipConfig | string;
|
|
18
|
+
tooltipAdd? : IToolTipConfig | string;
|
|
19
|
+
width? : string | number;
|
|
20
|
+
onChange(e) : void;
|
|
21
|
+
onError(e) : void;
|
|
22
|
+
info? : string;
|
|
23
|
+
labelPosition? : string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface IListFieldState {
|
|
27
|
+
textInputValue : string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const defaultListFIeld = () => (
|
|
31
|
+
<div style={{width: '25%'}}>
|
|
32
|
+
<ListField
|
|
33
|
+
options = {['Option1', 'Option2']}
|
|
34
|
+
label = {'ListField'}
|
|
35
|
+
tooltip = {'TOOLTIP'}
|
|
36
|
+
tooltipAdd = {'TOOLTIP ADD'}
|
|
37
|
+
onError = {action('ERROR')}
|
|
38
|
+
onChange = {action('CHANGE')}/>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Modal from './Modal';
|
|
3
|
+
import Button from '../button/Button';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Modal',
|
|
7
|
+
component: Modal
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
interface IModalProps {
|
|
11
|
+
children? : any;
|
|
12
|
+
isOpen : boolean;
|
|
13
|
+
style? : any;
|
|
14
|
+
wrapperStyle? : any;
|
|
15
|
+
onRequestClose(e) : void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const defaultModal = () => {
|
|
19
|
+
const [open, setOpen] = React.useState(false);
|
|
20
|
+
const dropdownToggleRef = React.useRef(null);
|
|
21
|
+
|
|
22
|
+
const handleModalOpen = () => {
|
|
23
|
+
setOpen(!open);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<Button onClick = {() => setOpen(!open)} ref = {dropdownToggleRef}>
|
|
29
|
+
Modal Button
|
|
30
|
+
</Button>
|
|
31
|
+
<Modal
|
|
32
|
+
onRequestClose= {handleModalOpen}
|
|
33
|
+
wrapperStyle = {{
|
|
34
|
+
top: '50px',
|
|
35
|
+
left: '0px',
|
|
36
|
+
width: '100%',
|
|
37
|
+
height: `calc(100% - 50px)`
|
|
38
|
+
}}
|
|
39
|
+
style = {{
|
|
40
|
+
width: '600px',
|
|
41
|
+
height: '70%',
|
|
42
|
+
top: '10%',
|
|
43
|
+
left: 'calc((100% - 600px) / 2)'
|
|
44
|
+
}}
|
|
45
|
+
isOpen = {open}
|
|
46
|
+
>
|
|
47
|
+
Modal Content
|
|
48
|
+
</Modal>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import NumberField from './NumberField';
|
|
3
|
+
import { IToolTipConfig } from '../Tooltip';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'NumberField',
|
|
7
|
+
component: NumberField
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
interface INumberFieldProps {
|
|
11
|
+
buttons? : any;
|
|
12
|
+
label? : string;
|
|
13
|
+
placeholder? : string;
|
|
14
|
+
readOnly? : boolean;
|
|
15
|
+
value : number;
|
|
16
|
+
tooltip? : IToolTipConfig | string;
|
|
17
|
+
width? : string | number;
|
|
18
|
+
onChange(e) : void;
|
|
19
|
+
info? : string;
|
|
20
|
+
labelPosition? : string;
|
|
21
|
+
min? : number;
|
|
22
|
+
max? : number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const defaultNumberField = () => {
|
|
26
|
+
const [ number, setNumber ] = React.useState(0);
|
|
27
|
+
|
|
28
|
+
const handleChange = (e) => {
|
|
29
|
+
if (e.target.value) {
|
|
30
|
+
setNumber(e.target.value);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<NumberField
|
|
36
|
+
label = {'Number Field'}
|
|
37
|
+
tooltip = {'TOOLTIP'}
|
|
38
|
+
width = '33%'
|
|
39
|
+
value = {number}
|
|
40
|
+
onChange = {handleChange}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import Section from './Section';
|
|
4
|
+
import TextField from '../text-field/TextField';
|
|
5
|
+
import NumberField from '../number-field/NumberField';
|
|
6
|
+
import Button from '../button/Button';
|
|
7
|
+
import ButtonMenu from '../button-menu/ButtonMenu';
|
|
8
|
+
import ButtonMenuItem from '../button-menu/ButtonMenuItem';
|
|
9
|
+
import Card from '../card/Card';
|
|
10
|
+
import {ICON_COPY, ICON_BARS} from '../../constants/icons';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Section',
|
|
14
|
+
component: Section
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const defaultSection = () => {
|
|
18
|
+
|
|
19
|
+
const menuItems = [
|
|
20
|
+
<ButtonMenuItem
|
|
21
|
+
key = 'duplicate'
|
|
22
|
+
label = {<span>{ICON_COPY} Button Duplicate Overlay</span>}
|
|
23
|
+
onClick = {action('CLICKED')}/>,
|
|
24
|
+
<ButtonMenuItem
|
|
25
|
+
key = 'delete'
|
|
26
|
+
label = {<span>{ICON_COPY} Button Duplicate Overlay</span>}
|
|
27
|
+
onClick = {action('CLICKED')}/>
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const menu = <ButtonMenu
|
|
31
|
+
position = 'left'
|
|
32
|
+
items = {menuItems}
|
|
33
|
+
button = {<Button style = 'subtle'>
|
|
34
|
+
{ICON_BARS}
|
|
35
|
+
</Button>}/>;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Section
|
|
39
|
+
title = 'Section Title'
|
|
40
|
+
buttons = {menu}
|
|
41
|
+
>
|
|
42
|
+
<Card
|
|
43
|
+
title = 'Card'
|
|
44
|
+
open = {true}
|
|
45
|
+
collapsable = {false}>
|
|
46
|
+
<TextField
|
|
47
|
+
label = {'TextField'}
|
|
48
|
+
tooltip = {'TOOLTIP'}
|
|
49
|
+
value = {'name'}
|
|
50
|
+
width = '33%'
|
|
51
|
+
onChange = {action('CLICKED')}/>
|
|
52
|
+
<NumberField
|
|
53
|
+
label = {'NumberField'}
|
|
54
|
+
tooltip = {'TOOLTIP'}
|
|
55
|
+
width = '33%'
|
|
56
|
+
readOnly = {true}
|
|
57
|
+
value = {1}
|
|
58
|
+
onChange = {action('CLICKED')}
|
|
59
|
+
/>
|
|
60
|
+
</Card>
|
|
61
|
+
<Card
|
|
62
|
+
title = 'Card'
|
|
63
|
+
open = {true}
|
|
64
|
+
collapsable = {false}>
|
|
65
|
+
<TextField
|
|
66
|
+
label = {'TextField'}
|
|
67
|
+
tooltip = {'TOOLTIP'}
|
|
68
|
+
value = {'name'}
|
|
69
|
+
width = '33%'
|
|
70
|
+
onChange = {action('CLICKED')}/>
|
|
71
|
+
<NumberField
|
|
72
|
+
label = {'NumberField'}
|
|
73
|
+
tooltip = {'TOOLTIP'}
|
|
74
|
+
width = '33%'
|
|
75
|
+
readOnly = {true}
|
|
76
|
+
value = {1}
|
|
77
|
+
onChange = {action('CLICKED')}
|
|
78
|
+
/>
|
|
79
|
+
</Card>
|
|
80
|
+
</Section>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import SelectField from './SelectField';
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
import { IToolTipConfig } from '../Tooltip';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'SelectField',
|
|
8
|
+
components: SelectField
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
interface ISelectOption {
|
|
12
|
+
label : string;
|
|
13
|
+
value : string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ISelectFieldProps {
|
|
17
|
+
buttons? : any;
|
|
18
|
+
label? : string;
|
|
19
|
+
selectRef? : any;
|
|
20
|
+
options : any;
|
|
21
|
+
disable ? : boolean;
|
|
22
|
+
tooltip ? : IToolTipConfig | string;
|
|
23
|
+
placeholder? : string;
|
|
24
|
+
value : any;
|
|
25
|
+
width? : string | number;
|
|
26
|
+
onChange(e) : void;
|
|
27
|
+
info? : string;
|
|
28
|
+
labelPosition? : string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const defaultSelectField = () => (
|
|
32
|
+
<SelectField
|
|
33
|
+
label = {'Select Field'}
|
|
34
|
+
value = {'value'}
|
|
35
|
+
width = '50%'
|
|
36
|
+
options = { ['Option1', 'Option2'] }
|
|
37
|
+
onChange = {action('CHANGED')}/>
|
|
38
|
+
);
|