superdesk-ui-framework 3.0.1-beta.1 → 3.0.1-beta.2

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 (168) hide show
  1. package/app/fonts/sd_big-icons.eot +0 -0
  2. package/app/fonts/sd_big-icons.svg +55 -53
  3. package/app/fonts/sd_big-icons.ttf +0 -0
  4. package/app/fonts/sd_big-icons.woff +0 -0
  5. package/app/fonts/sd_icons.eot +0 -0
  6. package/app/fonts/sd_icons.svg +1 -0
  7. package/app/fonts/sd_icons.ttf +0 -0
  8. package/app/fonts/sd_icons.woff +0 -0
  9. package/app/img/dots.svg +3 -0
  10. package/app/styles/_accessibility.scss +3 -3
  11. package/app/styles/_big-icon-font.scss +60 -23
  12. package/app/styles/_boxed-list.scss +26 -3
  13. package/app/styles/_buttons.scss +4 -0
  14. package/app/styles/_helpers.scss +4 -3
  15. package/app/styles/_icon-font.scss +341 -307
  16. package/app/styles/_icon-labels.scss +66 -10
  17. package/app/styles/_table-list.scss +244 -0
  18. package/app/styles/app.scss +1 -0
  19. package/app/styles/components/_list-item.scss +24 -20
  20. package/app/styles/components/_sd-dropzone.scss +52 -16
  21. package/app/styles/components/_subnav.scss +87 -80
  22. package/app/styles/design-tokens/_design-tokens-general.scss +7 -0
  23. package/app/styles/design-tokens/_new-colors.scss +4 -2
  24. package/app/styles/form-elements/_inputs.scss +4 -0
  25. package/app/styles/grids/_grid-layout.scss +21 -7
  26. package/app/styles/layout/_container.scss +3 -0
  27. package/app/styles/layout/_editor.scss +108 -16
  28. package/app/styles/menus/_sd-sidebar-menu.scss +6 -0
  29. package/app/styles/primereact/_pr-dialog.scss +39 -7
  30. package/app-typescript/components/CreateButton.tsx +38 -0
  31. package/app-typescript/components/DropZone.tsx +4 -4
  32. package/app-typescript/components/Icon.tsx +3 -1
  33. package/app-typescript/components/IconLabel.tsx +8 -1
  34. package/app-typescript/components/Input.tsx +2 -0
  35. package/app-typescript/components/Layouts/AuthoringContainer.tsx +27 -0
  36. package/app-typescript/components/Layouts/AuthoringInnerHeader.tsx +2 -0
  37. package/app-typescript/components/Layouts/AuthoringMain.tsx +11 -7
  38. package/app-typescript/components/Layouts/AuthoringMainToolBar.tsx +7 -1
  39. package/app-typescript/components/Layouts/Container.tsx +1 -1
  40. package/app-typescript/components/Layouts/ContentSplitter.tsx +23 -0
  41. package/app-typescript/components/Layouts/Layout.tsx +33 -0
  42. package/app-typescript/components/Layouts/LayoutContainer.tsx +1 -4
  43. package/app-typescript/components/Layouts/MainPanel.tsx +10 -5
  44. package/app-typescript/components/Layouts/OverlayPanel.tsx +19 -0
  45. package/app-typescript/components/Layouts/Panel.tsx +1 -0
  46. package/app-typescript/components/Layouts/index.tsx +8 -2
  47. package/app-typescript/components/Lists/BoxedList.tsx +6 -2
  48. package/app-typescript/components/Lists/ContentList.tsx +100 -0
  49. package/app-typescript/components/Lists/TableList.tsx +208 -0
  50. package/app-typescript/components/Modal.tsx +27 -17
  51. package/app-typescript/components/Navigation/SideBarTabs.tsx +10 -0
  52. package/app-typescript/components/SearchBar.tsx +79 -0
  53. package/app-typescript/components/Select.tsx +2 -0
  54. package/app-typescript/components/SidebarMenu.tsx +68 -0
  55. package/app-typescript/components/Spinner.tsx +1 -1
  56. package/app-typescript/components/SwitchGroup.tsx +2 -1
  57. package/app-typescript/index.ts +3 -0
  58. package/dist/dots.svg +3 -0
  59. package/dist/examples.bundle.css +7871 -379
  60. package/dist/examples.bundle.js +29461 -15740
  61. package/dist/playgrounds/react-playgrounds/EditorTest.tsx +9 -4
  62. package/dist/playgrounds/react-playgrounds/Index.tsx +3 -1
  63. package/dist/playgrounds/react-playgrounds/PersonalProfile.tsx +13 -0
  64. package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +466 -0
  65. package/dist/playgrounds/react-playgrounds/Rundowns.tsx +1002 -0
  66. package/dist/playgrounds/react-playgrounds/TestGround.tsx +190 -182
  67. package/dist/playgrounds/react-playgrounds/UiPlayground.tsx +4 -0
  68. package/dist/playgrounds/react-playgrounds/components/AuthoringContainer.tsx +26 -0
  69. package/dist/playgrounds/react-playgrounds/components/ContentSplitter.tsx +22 -0
  70. package/dist/playgrounds/react-playgrounds/components/Index.tsx +6 -1
  71. package/dist/playgrounds/react-playgrounds/components/MainPanel.tsx +11 -1
  72. package/dist/playgrounds/react-playgrounds/components/SearchBar.tsx +51 -9
  73. package/dist/react/Container.tsx +1 -1
  74. package/dist/react/ContentList.tsx +280 -0
  75. package/dist/react/CreateButton.tsx +71 -0
  76. package/dist/react/DropZone.tsx +14 -6
  77. package/dist/react/IconButtons.tsx +6 -6
  78. package/dist/react/IconLabels.tsx +24 -2
  79. package/dist/react/Index.tsx +15 -0
  80. package/dist/react/Inputs.tsx +32 -3
  81. package/dist/react/Modal.tsx +1 -0
  82. package/dist/react/TableList.tsx +268 -0
  83. package/dist/sd_big-icons.eot +0 -0
  84. package/dist/sd_big-icons.svg +55 -53
  85. package/dist/sd_big-icons.ttf +0 -0
  86. package/dist/sd_big-icons.woff +0 -0
  87. package/dist/sd_icons.eot +0 -0
  88. package/dist/sd_icons.svg +1 -0
  89. package/dist/sd_icons.ttf +0 -0
  90. package/dist/sd_icons.woff +0 -0
  91. package/dist/superdesk-ui.bundle.css +44994 -24931
  92. package/dist/superdesk-ui.bundle.js +2437 -1949
  93. package/dist/vendor.bundle.js +27 -27
  94. package/examples/css/docs-page.css +2 -3
  95. package/examples/index.js +8 -0
  96. package/examples/pages/playgrounds/react-playgrounds/EditorTest.tsx +9 -4
  97. package/examples/pages/playgrounds/react-playgrounds/Index.tsx +3 -1
  98. package/examples/pages/playgrounds/react-playgrounds/PersonalProfile.tsx +13 -0
  99. package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +466 -0
  100. package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +1002 -0
  101. package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +190 -182
  102. package/examples/pages/playgrounds/react-playgrounds/UiPlayground.tsx +4 -0
  103. package/examples/pages/playgrounds/react-playgrounds/components/AuthoringContainer.tsx +26 -0
  104. package/examples/pages/playgrounds/react-playgrounds/components/ContentSplitter.tsx +22 -0
  105. package/examples/pages/playgrounds/react-playgrounds/components/Index.tsx +6 -1
  106. package/examples/pages/playgrounds/react-playgrounds/components/MainPanel.tsx +11 -1
  107. package/examples/pages/playgrounds/react-playgrounds/components/SearchBar.tsx +51 -9
  108. package/examples/pages/react/Container.tsx +1 -1
  109. package/examples/pages/react/ContentList.tsx +280 -0
  110. package/examples/pages/react/CreateButton.tsx +71 -0
  111. package/examples/pages/react/DropZone.tsx +14 -6
  112. package/examples/pages/react/IconButtons.tsx +6 -6
  113. package/examples/pages/react/IconLabels.tsx +24 -2
  114. package/examples/pages/react/Index.tsx +15 -0
  115. package/examples/pages/react/Inputs.tsx +32 -3
  116. package/examples/pages/react/Modal.tsx +1 -0
  117. package/examples/pages/react/TableList.tsx +268 -0
  118. package/package.json +2 -1
  119. package/react/components/CreateButton.d.ts +17 -0
  120. package/react/components/CreateButton.js +66 -0
  121. package/react/components/DropZone.d.ts +2 -2
  122. package/react/components/DropZone.js +2 -2
  123. package/react/components/Icon.d.ts +1 -0
  124. package/react/components/Icon.js +2 -1
  125. package/react/components/IconLabel.d.ts +2 -0
  126. package/react/components/IconLabel.js +6 -3
  127. package/react/components/Input.d.ts +1 -0
  128. package/react/components/Input.js +1 -0
  129. package/react/components/Layouts/AuthoringContainer.d.ts +11 -0
  130. package/react/components/Layouts/AuthoringContainer.js +58 -0
  131. package/react/components/Layouts/AuthoringInnerHeader.d.ts +1 -0
  132. package/react/components/Layouts/AuthoringInnerHeader.js +6 -3
  133. package/react/components/Layouts/AuthoringMain.d.ts +3 -1
  134. package/react/components/Layouts/AuthoringMain.js +2 -2
  135. package/react/components/Layouts/AuthoringMainToolBar.d.ts +1 -0
  136. package/react/components/Layouts/AuthoringMainToolBar.js +8 -1
  137. package/react/components/Layouts/Container.d.ts +1 -1
  138. package/react/components/Layouts/ContentSplitter.d.ts +10 -0
  139. package/react/components/Layouts/ContentSplitter.js +56 -0
  140. package/react/components/Layouts/Layout.d.ts +8 -0
  141. package/react/components/Layouts/Layout.js +35 -0
  142. package/react/components/Layouts/LayoutContainer.js +1 -1
  143. package/react/components/Layouts/MainPanel.d.ts +1 -0
  144. package/react/components/Layouts/MainPanel.js +11 -4
  145. package/react/components/Layouts/OverlayPanel.d.ts +8 -0
  146. package/react/components/Layouts/OverlayPanel.js +49 -0
  147. package/react/components/Layouts/Panel.d.ts +1 -0
  148. package/react/components/Layouts/index.d.ts +6 -2
  149. package/react/components/Layouts/index.js +12 -4
  150. package/react/components/Lists/BoxedList.d.ts +2 -0
  151. package/react/components/Lists/BoxedList.js +6 -4
  152. package/react/components/Modal.d.ts +2 -0
  153. package/react/components/Modal.js +11 -3
  154. package/react/components/Navigation/SideBarTabs.d.ts +1 -0
  155. package/react/components/Navigation/SideBarTabs.js +4 -0
  156. package/react/components/SearchBar.d.ts +23 -0
  157. package/react/components/SearchBar.js +87 -0
  158. package/react/components/Select.d.ts +1 -0
  159. package/react/components/Select.js +1 -0
  160. package/react/components/Spinner.js +1 -1
  161. package/react/components/SwitchGroup.d.ts +1 -0
  162. package/react/components/SwitchGroup.js +1 -1
  163. package/react/index.d.ts +2 -0
  164. package/react/index.js +5 -0
  165. package/sd_icons.eot +0 -0
  166. package/sd_icons.svg +189 -0
  167. package/sd_icons.ttf +0 -0
  168. package/sd_icons.woff +0 -0
@@ -3,7 +3,9 @@ import classNames from 'classnames';
3
3
  import {Icon} from './Icon';
4
4
  interface IProps {
5
5
  text: string;
6
+ innerLabel?: string;
6
7
  type?: 'default' | 'primary' | 'success' | 'warning' | 'alert' | 'highlight' | 'sd-green';
8
+ size?: 'default' | 'large' | 'small';
7
9
  icon?: string;
8
10
  style?: 'basic' | 'translucent'; // defaults to 'basic'
9
11
  }
@@ -12,12 +14,17 @@ export class IconLabel extends React.PureComponent<IProps> {
12
14
  render() {
13
15
  let classes = classNames('label-icon', {
14
16
  [`label-icon--${this.props.type}`]: this.props.type !== undefined,
17
+ [`label-icon--${this.props.size}`]: this.props.size !== undefined,
15
18
  'label-icon--translucent': this.props.style === 'translucent',
16
19
  });
17
20
 
18
21
  return (
19
22
  <span className={classes}>
20
- <Icon name={this.props.icon}/> {this.props.text}
23
+ {this.props.icon ?
24
+ <Icon name={this.props.icon}/> : null}
25
+ {this.props.innerLabel ?
26
+ <span className='label-icon--inner-label'>{this.props.innerLabel}</span> : null}
27
+ <span className='label-icon__value'>{this.props.text}</span>
21
28
  </span>
22
29
  );
23
30
  }
@@ -13,6 +13,7 @@ interface IPropsBase {
13
13
  inlineLabel?: boolean;
14
14
  labelHidden?: boolean;
15
15
  tabindex?: number;
16
+ fullWidth?: boolean;
16
17
  }
17
18
 
18
19
  interface IPropsText extends IPropsBase {
@@ -74,6 +75,7 @@ export class Input extends React.Component<IProps, IState> {
74
75
  'sd-input--inline-label': this.props.inlineLabel,
75
76
  'sd-input--required': this.props.required,
76
77
  'sd-input--disabled': this.props.disabled,
78
+ 'sd-input--full-width': this.props.fullWidth,
77
79
  'sd-input--invalid': this.props.invalid || this.state.invalid,
78
80
  });
79
81
  const labelClasses = classNames('sd-input__label', {
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ interface IProps {
5
+ children?: React.ReactNode;
6
+ side?: 'left' | 'right';
7
+ background?: 'transparent' | 'light' | 'grey' | 'dark';
8
+ open?: boolean;
9
+ }
10
+
11
+ export class AuthoringContainer extends React.PureComponent<IProps> {
12
+ render() {
13
+ let classes = classNames('sd-content-wrapper__authoring-content-area', {
14
+ [`sd-content-wrapper__authoring-content-area--${this.props.side}`] : this.props.side,
15
+ [`sd-content-wrapper__authoring-content-area--${this.props.background}`]:
16
+ this.props.background !== 'light' && this.props.background !== undefined,
17
+ 'open-editor': this.props.open,
18
+ });
19
+ return (
20
+ <div className={classes}>
21
+ <div className='sd-editor__container'>
22
+ {this.props.children}
23
+ </div>
24
+ </div>
25
+ );
26
+ }
27
+ }
@@ -5,6 +5,7 @@ import { Icon } from '../Icon';
5
5
  interface IProps {
6
6
  children?: React.ReactNode;
7
7
  collapsed?: boolean;
8
+ headerPadding?: 'small' | 'medium' | 'large';
8
9
  }
9
10
  interface IState {
10
11
  collapsed: boolean;
@@ -22,6 +23,7 @@ export class AuthoringInnerHeader extends React.PureComponent<IProps, IState> {
22
23
  render() {
23
24
  let classes = classNames('sd-editor-content__authoring-header', {
24
25
  'authoring-header--collapsed': this.state.collapsed,
26
+ [`authoring-header--padding-${this.props.headerPadding}`]: this.props.headerPadding,
25
27
  });
26
28
  return (
27
29
  <header className={classes}>
@@ -11,31 +11,35 @@ import {
11
11
  } from './';
12
12
 
13
13
  interface IProps {
14
- toolBar: React.ReactNode;
14
+ toolBar?: React.ReactNode;
15
15
  authoringMain?: React.ReactNode;
16
16
  authoringHeader?: React.ReactNode;
17
17
  authoringBookmarks?: React.ReactNode;
18
18
  headerCollapsed?: boolean;
19
+ headerPadding?: 'small' | 'medium' | 'large';
20
+ toolbarCustom?: boolean;
19
21
  }
20
22
 
21
23
  export class AuthoringMain extends React.PureComponent<IProps> {
22
24
  render() {
23
25
  return (
24
26
  <AuthoringMainContainer>
25
- <AuthoringMainToolBar>
26
- {this.props.toolBar}
27
- </AuthoringMainToolBar>
27
+ {this.props.toolBar && (
28
+ <AuthoringMainToolBar toolbarCustom={this.props.toolbarCustom}>
29
+ {this.props.toolBar}
30
+ </AuthoringMainToolBar>
31
+ )}
28
32
  <AuthoringMainContent>
29
- <AuthoringInnerHeader>
33
+ {this.props.authoringHeader && (
34
+ <AuthoringInnerHeader headerPadding={this.props.headerPadding}>
30
35
  {this.props.authoringHeader}
31
36
  </AuthoringInnerHeader>
32
-
37
+ )}
33
38
  {this.props.authoringBookmarks && (
34
39
  <AuthorinInnerSideBar>
35
40
  {this.props.authoringBookmarks}
36
41
  </AuthorinInnerSideBar>
37
42
  )}
38
-
39
43
  <AuthoringInnerBody>
40
44
  {this.props.children}
41
45
  </AuthoringInnerBody>
@@ -1,13 +1,19 @@
1
1
  import * as React from 'react';
2
+ import classNames from 'classnames';
2
3
 
3
4
  interface IProps {
4
5
  children?: React.ReactNode;
6
+ toolbarCustom?: boolean;
7
+
5
8
  }
6
9
 
7
10
  export class AuthoringMainToolBar extends React.PureComponent<IProps> {
8
11
  render() {
12
+ let classes = classNames('sd-editor-content__toolbar', {
13
+ 'sd-editor-content__toolbar--custom': this.props.toolbarCustom,
14
+ });
9
15
  return (
10
- <div className="sd-editor-content__toolbar">
16
+ <div className={classes}>
11
17
  {this.props.children}
12
18
  </div>
13
19
  );
@@ -7,7 +7,7 @@ interface IProps {
7
7
  className?: string;
8
8
  display?: 'flex' | 'inline-flex' | 'block';
9
9
  direction?: 'row' | 'column';
10
- gap?: 'none' | 'small' | 'medium' | 'large';
10
+ gap?: 'none' | 'x-small' | 'small' | 'medium' | 'large';
11
11
  theme?: 'light' | 'dark';
12
12
  }
13
13
 
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ interface IProps {
5
+ children?: React.ReactNode;
6
+ background?: 'transparent' | 'light' | 'grey' | 'dark';
7
+ visible?: boolean; // defaults to light (white)
8
+ }
9
+
10
+ export class ContentSplitter extends React.PureComponent<IProps> {
11
+ render() {
12
+ let classes = classNames('sd-content-wrapper__content-splitter', {
13
+ [`sd-content-wrapper__content-splitter--${this.props.background}`]:
14
+ this.props.background !== 'light' && this.props.background !== undefined,
15
+ 'content-splitter--visible': this.props.visible,
16
+ });
17
+ return (
18
+ <div className={classes}>
19
+ {this.props.children}
20
+ </div>
21
+ );
22
+ }
23
+ }
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+
3
+ interface IProps {
4
+ header: string;
5
+ children?: React.ReactNode;
6
+ theme?: string;
7
+ }
8
+
9
+ export const Layout = ({
10
+ header,
11
+ children,
12
+ theme,
13
+ }: IProps) => {
14
+ return (
15
+ <div className='sd-page-grid--test docs-page__full-width-helper' data-theme={theme}>
16
+ <div className='sd-main-menu'>
17
+ <div className='sd-main-menu__inner'></div>
18
+ </div>
19
+ <header className='sd-top-menu'>
20
+ <a className='sd-top-menu__collapse-nav'>
21
+ <i className='icon-collapse icon--white'></i>
22
+ </a>
23
+ <p className='sd-top-menu__header'>{header}</p>
24
+ </header>
25
+ <section id='1' className='sd-content sd-content-wrapper'>
26
+ {children}
27
+ </section>
28
+ <footer className='bottom-bar'>
29
+ This is the footer.
30
+ </footer>
31
+ </div>
32
+ );
33
+ };
@@ -7,10 +7,7 @@ interface IProps {
7
7
  export class LayoutContainer extends React.PureComponent<IProps> {
8
8
  render() {
9
9
  return (
10
- <div
11
- style={{height: '100%'}}
12
- className="sd-main-content-grid"
13
- >
10
+ <div className='sd-content-wrapper__main-content-area sd-main-content-grid comfort'>
14
11
  {this.props.children}
15
12
  </div>
16
13
  );
@@ -1,20 +1,25 @@
1
1
  import * as React from 'react';
2
+ import classNames from 'classnames';
2
3
 
3
4
  export interface IMainPanelProps {
4
5
  children?: React.ReactNode;
5
6
  className?: string;
7
+ padding?: 'small' | 'medium' | 'large' | 'none';
6
8
  onScroll?(event: React.UIEvent<HTMLDivElement>): void;
7
9
  id?: string;
8
10
  }
9
11
 
10
12
  export class MainPanel extends React.PureComponent<IMainPanelProps> {
11
- render() {
12
- const className = !this.props.className ?
13
- 'sd-main-content-grid__content' :
14
- `sd-main-content-grid__content ${this.props.className}`;
15
13
 
14
+ render() {
15
+ let classes = classNames('sd-main-content-grid__content', {
16
+ 'sd-padding--2': !this.props.padding || this.props.padding === 'small',
17
+ 'sd-padding--3': this.props.padding === 'medium',
18
+ 'sd-padding--4': this.props.padding === 'large',
19
+ 'sd-padding--0': this.props.padding === 'none',
20
+ }, this.props.className);
16
21
  return (
17
- <div className={className} onScroll={this.props.onScroll} id={this.props.id || undefined}>
22
+ <div className={classes}>
18
23
  {this.props.children}
19
24
  </div>
20
25
  );
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+
3
+ interface IProps {
4
+ children?: React.ReactNode;
5
+ }
6
+
7
+ export class OverlayPanel extends React.PureComponent<IProps> {
8
+ render() {
9
+ return (
10
+ <div className='sd-main-content-grid__overlay'>
11
+ <div className='sd-overlay-panel sd-overlay-panel--dark-ui'>
12
+ <div className='side-panel side-panel--shadow-right side-panel--dark-ui'>
13
+ {this.props.children}
14
+ </div>
15
+ </div>
16
+ </div>
17
+ );
18
+ }
19
+ }
@@ -150,6 +150,7 @@ class PanelFooter extends React.PureComponent {
150
150
 
151
151
  interface IPropsSlidingToolbar {
152
152
  right?: boolean;
153
+ open?: boolean;
153
154
  }
154
155
 
155
156
  class PanelHeaderSlidingToolbar extends React.PureComponent<IPropsSlidingToolbar> {
@@ -1,9 +1,15 @@
1
1
  export { Panel, PanelHeader, PanelContent, PanelContentBlock, PanelFooter, PanelHeaderSlidingToolbar } from './Panel';
2
+
3
+ export { Layout } from './Layout';
4
+ export { LayoutContainer } from './LayoutContainer';
2
5
  export { HeaderPanel } from './HeaderPanel';
6
+ export { MainPanel, IMainPanelProps } from './MainPanel';
3
7
  export { LeftPanel } from './LeftPanel';
4
8
  export { RightPanel } from './RightPanel';
5
- export { LayoutContainer } from './LayoutContainer';
6
- export { MainPanel, IMainPanelProps } from './MainPanel';
9
+ export { OverlayPanel } from './OverlayPanel';
10
+ export { AuthoringContainer } from './AuthoringContainer';
11
+ export { ContentSplitter } from './ContentSplitter';
12
+
7
13
  export { PageLayout } from './PageLayout';
8
14
  export { Container } from './Container';
9
15
 
@@ -65,8 +65,10 @@ interface IPropsItem {
65
65
  footer?: React.ReactNode;
66
66
  actions?: React.ReactNode;
67
67
  children?: React.ReactNode;
68
+ density?: 'compact' | 'comfortable' | 'loose';
68
69
  type?: 'default' | 'primary' | 'success' | 'warning' | 'alert' | 'highlight'; // defaults to 'default'
69
70
  clickable?: boolean;
71
+ alignVertical?: 'start' | 'center';
70
72
  slideInActions?: boolean;
71
73
  selected?: boolean;
72
74
  onClick?(): void;
@@ -75,13 +77,15 @@ interface IPropsItem {
75
77
  class BoxedListItem extends React.PureComponent<IPropsItem> {
76
78
  render() {
77
79
  let classes = classNames('boxed-list__item', {
78
- 'simple-list--compact': this.props.type === undefined,
80
+ 'boxed-list__item--comfortable': this.props.density === undefined,
81
+ [`boxed-list__item--${this.props.density}`]: this.props.density || this.props.density !== undefined,
79
82
  'boxed-list__item--clickable': this.props.clickable === true,
80
83
  'boxed-list__item--selected': this.props.selected,
81
84
  [`boxed-list__item--${this.props.type}`]: this.props.type || this.props.type !== undefined,
85
+ [`boxed-list__item--align-${this.props.alignVertical}`]: this.props.alignVertical,
82
86
  });
83
87
  return (
84
- <li className={classes}>
88
+ <li className={classes} onClick={this.props.onClick}>
85
89
 
86
90
  {this.props.media && (
87
91
  <BoxedListMedia>
@@ -0,0 +1,100 @@
1
+ import * as React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ interface IPropsItem {
5
+ action?: React.ReactNode;
6
+ locked?: boolean;
7
+ itemColum: Array<{itemRow: Array<{content: any}>, border?: boolean, fullwidth?: boolean}>;
8
+ activated?: boolean;
9
+ selected?: boolean;
10
+ fetched?: boolean;
11
+ loading?: boolean;
12
+ onClick?(): void;
13
+ onDoubleClick?(): void;
14
+ }
15
+
16
+ class ContentListItem extends React.PureComponent<IPropsItem> {
17
+ render() {
18
+ let classes = classNames('sd-list-item sd-list-item-group sd-list-item-group--space-between-items', {
19
+ 'sd-list-item--activated': this.props.activated,
20
+ 'sd-list-item--selected': this.props.selected,
21
+ 'fetched': this.props.fetched,
22
+ 'actioning': this.props.loading,
23
+ });
24
+
25
+ return (
26
+ <div className={classes} onClick={this.props.onClick} onDoubleClick={this.props.onDoubleClick}>
27
+ <div className="sd-list-item sd-shadow--z1">
28
+ {this.props.locked
29
+ ? <div className="sd-list-item__border sd-list-item__border--locked"></div>
30
+ : <div className="sd-list-item__border"></div>}
31
+ {this.props.itemColum.map((item, index) => {
32
+ return <div
33
+ className={`sd-list-item__column ${item.fullwidth && 'sd-list-item__column--grow'} ${!item.border && 'sd-list-item__column--no-border'}`}
34
+ key={index}>
35
+ {item.itemRow.map((e, i) => {
36
+ return (
37
+ item.itemRow.length <= 1
38
+ ? <React.Fragment key={i}>{e.content}</React.Fragment>
39
+ : <div className="sd-list-item__row" key={i}>
40
+ {e.content}
41
+ </div>
42
+ );
43
+ })}
44
+ </div>;
45
+ })}
46
+ <div className="sd-list-item__action-menu">
47
+ {this.props.action}
48
+ </div>
49
+ </div>
50
+ </div>
51
+ );
52
+ }
53
+ }
54
+
55
+ interface IProps {
56
+ items: Array<{
57
+ itemColum: Array<IItemArray>,
58
+ locked?: boolean,
59
+ action?: React.ReactNode,
60
+ loading?: boolean,
61
+ activated?: boolean,
62
+ selected?: boolean,
63
+ fetched?: boolean,
64
+ onClick?(): void,
65
+ onDoubleClick?(): void;
66
+ }>;
67
+ }
68
+
69
+ interface IItemArray {
70
+ itemRow: Array<{content: React.ReactNode}>;
71
+ border?: boolean;
72
+ fullwidth?: boolean;
73
+ }
74
+
75
+ class ContentList extends React.PureComponent<IProps> {
76
+ render() {
77
+ let classes = classNames('sd-list-item-group sd-list-item-group--space-between-items');
78
+ return (
79
+ <ul className={classes}>
80
+ {this.props.items.map((item, index) => {
81
+ return <ContentListItem
82
+ key={index}
83
+ itemColum={item.itemColum}
84
+ locked={item.locked}
85
+ action={item.action}
86
+ loading={item.loading}
87
+ activated={item.activated}
88
+ selected={item.selected}
89
+ fetched={item.fetched}
90
+ onClick={item.onClick}
91
+ onDoubleClick={item.onDoubleClick} />;
92
+ })}
93
+ </ul>
94
+ );
95
+ }
96
+ }
97
+
98
+ export {
99
+ ContentList, ContentListItem
100
+ };
@@ -0,0 +1,208 @@
1
+ import * as React from 'react';
2
+ import classNames from 'classnames';
3
+ import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
4
+ import { Tooltip } from '../Tooltip';
5
+ import { Button } from '../Button';
6
+ import { Dropdown } from '../Dropdown';
7
+
8
+ interface IPropsItem {
9
+ start?: React.ReactNode;
10
+ center?: React.ReactNode;
11
+ end?: React.ReactNode;
12
+ action?: React.ReactNode;
13
+ addItem?: boolean;
14
+ itemsDropdown?: any;
15
+ dragAndDrop?: boolean;
16
+ onClick?(): void;
17
+ }
18
+
19
+ class TableListItem extends React.PureComponent<IPropsItem> {
20
+ render() {
21
+ return (
22
+ this.props.addItem ?
23
+ <li className='table-list__item-container'>
24
+ <div
25
+ onClick={this.props.onClick}
26
+ className={`table-list__item ${this.props.onClick && 'table-list__item--clickable'} ${this.props.dragAndDrop && 'table-list__item--draggable'}`}>
27
+ <div className='table-list__item-content'>
28
+ <div className='table-list__item-content-block'>
29
+ {this.props.start && this.props.start}
30
+ </div>
31
+ <div className='table-list__item-content-block table-list__item-content-block--center'>
32
+ {this.props.center && this.props.center}
33
+ </div>
34
+ <div className='table-list__item-content-block'>
35
+ {this.props.end && this.props.end}
36
+ </div>
37
+ </div>
38
+ {this.props.action && <div className='table-list__slide-in-actions'>
39
+ {this.props.action}
40
+ </div>}
41
+ </div>
42
+ <div className='table-list__add-bar-container'>
43
+ <Tooltip text='Add item' flow='top' appendToBody={true}>
44
+ <div className='table-list__add-bar'>
45
+ <Dropdown
46
+ items={this.props.itemsDropdown}>
47
+ <Button
48
+ type="primary"
49
+ icon="plus-large"
50
+ text="Add item"
51
+ size="small"
52
+ shape="round"
53
+ iconOnly={true}
54
+ onClick={() => false}
55
+ />
56
+ </Dropdown>
57
+ </div>
58
+ </Tooltip>
59
+ </div>
60
+ </li>
61
+ : <li
62
+ className={`table-list__item ${this.props.onClick && 'table-list__item--clickable'} ${this.props.dragAndDrop && 'table-list__item--draggable'} table-list__item--margin`}
63
+ onClick={this.props.onClick}>
64
+ <div className='table-list__item-content'>
65
+ <div className='table-list__item-content-block'>
66
+ {this.props.start && this.props.start}
67
+ </div>
68
+ <div className='table-list__item-content-block table-list__item-content-block--center'>
69
+ {this.props.center && this.props.center}
70
+ </div>
71
+ <div className='table-list__item-content-block'>
72
+ {this.props.end && this.props.end}
73
+ </div>
74
+ </div>
75
+ {this.props.action && <div className='table-list__slide-in-actions'>
76
+ {this.props.action}
77
+ </div>}
78
+ </li>
79
+ );
80
+ }
81
+ }
82
+
83
+ interface IProps {
84
+ children?: React.ReactNode;
85
+ array?: Array<IPropsArray>;
86
+ addItem?: boolean;
87
+ dragAndDrop?: boolean;
88
+ itemsDropdown?: any;
89
+ className?: string;
90
+ onClick?(): void;
91
+ }
92
+
93
+ interface IPropsArray {
94
+ start?: React.ReactNode;
95
+ center?: React.ReactNode;
96
+ end?: React.ReactNode;
97
+ action?: React.ReactNode;
98
+ }
99
+
100
+ const reorder = (list, startIndex, endIndex) => {
101
+ const result = Array.from(list);
102
+ const [removed] = result.splice(startIndex, 1);
103
+ result.splice(endIndex, 0, removed);
104
+
105
+ return result;
106
+ };
107
+
108
+ class TableList extends React.PureComponent<IProps, {items: any}> {
109
+ constructor(props) {
110
+ super(props);
111
+ this.state = {
112
+ items: [],
113
+ };
114
+
115
+ this.onDragEnd = this.onDragEnd.bind(this);
116
+ }
117
+
118
+ componentDidMount(): void {
119
+ this.setState({items: this.props.array});
120
+ }
121
+
122
+ componentDidUpdate(prevProps: Readonly<IProps>, prevState: Readonly<{ items: any; }>, snapshot?: any): void {
123
+ if (prevProps.array !== this.props.array) {
124
+ this.setState({
125
+ items: this.props.array,
126
+ });
127
+ }
128
+ }
129
+
130
+ onDragEnd(result) {
131
+ if (!result.destination) {
132
+ return;
133
+ }
134
+ const items = reorder(
135
+ this.state.items,
136
+ result.source.index,
137
+ result.destination.index,
138
+ );
139
+ this.setState({
140
+ items,
141
+ });
142
+ }
143
+
144
+ render() {
145
+ let classes = classNames({
146
+ 'table-list' : !this.props.addItem,
147
+ [`${this.props.className}`]: this.props.className,
148
+ });
149
+
150
+ return (
151
+ this.props.array ?
152
+ this.props.dragAndDrop ?
153
+ <DragDropContext onDragEnd={this.onDragEnd}>
154
+ <Droppable droppableId="droppable">
155
+ {(provided, snapshot) => (
156
+ <ul
157
+ className={classes}
158
+ ref={provided.innerRef}
159
+ {...provided.droppableProps} >
160
+ {this.state.items.map((item, index) => (
161
+ <Draggable key={index} draggableId={`${index}`} index={index}>
162
+ {(provided2, snapshot2) => (
163
+ <div
164
+ ref={provided2.innerRef}
165
+ {...provided2.draggableProps}
166
+ {...provided2.dragHandleProps} >
167
+ <TableListItem
168
+ dragAndDrop={this.props.dragAndDrop}
169
+ start={item.start}
170
+ center={item.center}
171
+ end={item.end}
172
+ action={item.action}
173
+ onClick={item.onClick ? item.onClick : false}
174
+ addItem={this.props.addItem}
175
+ itemsDropdown={this.props.itemsDropdown} />
176
+ </div>
177
+ )}
178
+ </Draggable>
179
+ ))}
180
+ {provided.placeholder}
181
+ </ul>
182
+ )}
183
+ </Droppable>
184
+ </DragDropContext>
185
+ : <ul className={classes}>
186
+ {this.state.items.map((item, index) => (
187
+ <TableListItem
188
+ key={index}
189
+ start={item.start}
190
+ center={item.center}
191
+ end={item.end}
192
+ action={item.action}
193
+ onClick={item.onClick ? item.onClick : false}
194
+ addItem={this.props.addItem}
195
+ itemsDropdown={this.props.itemsDropdown} />
196
+ ))}
197
+ </ul>
198
+ : this.props.children &&
199
+ <ul className={classes}>
200
+ {this.props.children}
201
+ </ul>
202
+ );
203
+ }
204
+ }
205
+
206
+ export {
207
+ TableList, TableListItem
208
+ };