@imposium-hub/components 1.28.3 → 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.
Files changed (35) hide show
  1. package/.storybook/main.js +1 -1
  2. package/.storybook/preview-head.html +5 -0
  3. package/Entry.ts +2 -0
  4. package/components/assets/AssetsTableDurationCell.tsx +46 -0
  5. package/components/button-group-field/ButtonGroupField.stories.tsx +59 -0
  6. package/components/button-menu/ButtonMenu.stories.tsx +41 -0
  7. package/components/card/Card.stories.tsx +44 -0
  8. package/components/checkbox-field/CheckboxField.stories.tsx +34 -0
  9. package/components/color-field/ColorFiled.stories.tsx +39 -0
  10. package/components/controlled-list/ControlledList.stories.tsx +26 -0
  11. package/components/determinate-loader/DeterminateLoader.stories.tsx +43 -0
  12. package/components/dropdown/dropdown.stories.tsx +43 -0
  13. package/components/field-wrapper/FieldWrapper.stories.tsx +44 -0
  14. package/components/h-rule/HRule.stories.tsx +17 -0
  15. package/components/list-field/ListField.stories.tsx +40 -0
  16. package/components/modal/Modal.stories.tsx +51 -0
  17. package/components/number-field/NumberField.stories.tsx +43 -0
  18. package/components/number-field/NumberField.tsx +1 -1
  19. package/components/section/Section.stories.tsx +82 -0
  20. package/components/select-field/SelectField.stories.tsx +38 -0
  21. package/components/shortcut-menu/ShortcutMenu.stories.tsx +24 -0
  22. package/components/slider-field/SliderField.stories.tsx +48 -0
  23. package/components/tabs/Tabs.stories.tsx +66 -0
  24. package/components/text-area-field/TextAreaField.stories.tsx +46 -0
  25. package/components/text-field/TextField.stories.tsx +52 -0
  26. package/dist/components.js +2 -2
  27. package/dist/components.js.map +1 -1
  28. package/dist/styles.css +1 -1
  29. package/dist/styles.css.map +1 -1
  30. package/dist/styles.less +8 -0
  31. package/dist/styles.less.map +1 -1
  32. package/less/components/assets.less +4 -0
  33. package/less/components/form-field.less +4 -0
  34. package/package.json +14 -7
  35. package/services/API.ts +8 -0
@@ -6,7 +6,7 @@ module.exports = {
6
6
 
7
7
  config.module.rules.push({
8
8
  test: /(\.ts|\.tsx)$/,
9
- use: 'awesome-typescript-loader',
9
+ use: 'ts-loader',
10
10
  exclude: /node_modules/
11
11
  });
12
12
 
@@ -1 +1,6 @@
1
1
  <link rel="stylesheet" href="styles.css">
2
+ <style>
3
+ .sb-show-main{
4
+ padding:25px;
5
+ }
6
+ </style>
package/Entry.ts CHANGED
@@ -32,6 +32,7 @@ import NoAccess from './components/no-access/NoAccess';
32
32
  import ServiceIcon from './components/service-icon/ServiceIcon';
33
33
  import DeterminateLoader from './components/determinate-loader/DeterminateLoader';
34
34
  import AssetsTableDateCell from './components/assets/AssetsTableDateCell';
35
+ import AssetsTableDurationCell from './components/assets/AssetsTableDurationCell';
35
36
  import AssetField from './components/assets/AssetField';
36
37
  import AssetsTableDropzone from './components/assets/AssetsTableDropzone';
37
38
  import AssetsTableNameCell from './components/assets/AssetsTableNameCell';
@@ -163,6 +164,7 @@ export {
163
164
  AssetsTableStatusCell,
164
165
  AssetsTableNameFilter,
165
166
  AssetsTableNameCell,
167
+ AssetsTableDurationCell,
166
168
  AssetsTableTagsCell,
167
169
  AssetsTableTagsFilter,
168
170
  AssetsTableTagsPivot,
@@ -0,0 +1,46 @@
1
+ import * as React from 'react';
2
+ import NumberField from '../number-field/NumberField';
3
+ import { updateAssetName } from '../../redux/actions/asset-list';
4
+ import { connect } from 'react-redux';
5
+ import { bindActionCreators } from 'redux';
6
+ import { IImposiumAPI } from '../../services/API';
7
+
8
+ interface IAssetsTableDurationCell {
9
+ cell : any;
10
+ api : IImposiumAPI;
11
+ }
12
+
13
+ const AssetsTableDurationCell : React.FC<IAssetsTableDurationCell> = (props : IAssetsTableDurationCell) => {
14
+
15
+ const {cell: {row: {original: {duration, id}}}} = props;
16
+
17
+ if (duration !== null && duration !== undefined) {
18
+ return (
19
+ <div className = 'asset-duration-cell'>
20
+ {secondsToTime(duration)}
21
+ </div>
22
+ );
23
+ } else {
24
+ return null;
25
+ }
26
+
27
+ };
28
+
29
+ export const secondsToTime = (timeInSeconds) : string => {
30
+ const minutes : any = Math.floor(timeInSeconds / 60);
31
+ let seconds : any = Math.floor(timeInSeconds - minutes * 60);
32
+ if (seconds < 10) {
33
+ seconds = `0${seconds}`;
34
+ }
35
+ return `${minutes}:${seconds}`;
36
+ };
37
+
38
+ const mapDispatchToProps = (dispatch) : any => {
39
+ return bindActionCreators({updateAssetName}, dispatch);
40
+ };
41
+
42
+ const mapStateToProps = (state) : any => {
43
+ return {};
44
+ };
45
+
46
+ export default connect(mapStateToProps, mapDispatchToProps)(AssetsTableDurationCell);
@@ -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}&nbsp;Duplicate</span>}
23
+ onClick = {action('CLICKED')}/>,
24
+ <ButtonMenuItem
25
+ key = 'delete'
26
+ label = {<span>{ICON_BARS}&nbsp;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
+ };
@@ -10,7 +10,7 @@ interface INumberFieldProps {
10
10
  value : number;
11
11
  tooltip? : IToolTipConfig | string;
12
12
  width? : string | number;
13
- onChange(e) : void;
13
+ onChange?(e) : void;
14
14
  info? : string;
15
15
  labelPosition? : string;
16
16
  min? : number;