superdesk-ui-framework 3.0.1-beta.3 → 3.0.1-beta.30

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 (262) hide show
  1. package/app/fonts/sd_icons.eot +0 -0
  2. package/app/fonts/sd_icons.svg +14 -7
  3. package/app/fonts/sd_icons.ttf +0 -0
  4. package/app/fonts/sd_icons.woff +0 -0
  5. package/app/scripts/toggleBoxNext.js +1 -1
  6. package/app/styles/_big-icon-font.scss +1 -1
  7. package/app/styles/_buttons.scss +11 -6
  8. package/app/styles/_content-divider.scss +63 -8
  9. package/app/styles/_helpers.scss +24 -1
  10. package/app/styles/_icon-font.scss +17 -10
  11. package/app/styles/_labels.scss +0 -1
  12. package/app/styles/_master-desk.scss +3 -2
  13. package/app/styles/_modals.scss +6 -3
  14. package/app/styles/_normalize.scss +4 -0
  15. package/app/styles/_sd-tag-input.scss +256 -296
  16. package/app/styles/_simple-list.scss +0 -2
  17. package/app/styles/_table-list.scss +116 -12
  18. package/app/styles/app.scss +1 -0
  19. package/app/styles/components/_list-item.scss +36 -17
  20. package/app/styles/components/_sd-collapse-box.scss +6 -6
  21. package/app/styles/components/_sd-comment-box.scss +8 -4
  22. package/app/styles/components/_sd-editor-popup.scss +4 -4
  23. package/app/styles/components/_sd-grid-item.scss +30 -16
  24. package/app/styles/components/_sd-media-carousel.scss +37 -2
  25. package/app/styles/components/_sd-photo-preview.scss +3 -3
  26. package/app/styles/components/_sd-searchbar.scss +7 -0
  27. package/app/styles/components/_subnav.scss +470 -470
  28. package/app/styles/design-tokens/_design-tokens-general.scss +1 -1
  29. package/app/styles/design-tokens/_new-colors.scss +30 -13
  30. package/app/styles/dropdowns/_basic-dropdown.scss +6 -0
  31. package/app/styles/form-elements/_forms-general.scss +81 -7
  32. package/app/styles/form-elements/_input-wrap.scss +138 -0
  33. package/app/styles/form-elements/_inputs.scss +368 -110
  34. package/app/styles/grids/_grid-layout.scss +34 -1
  35. package/app/styles/interface-elements/_side-panel.scss +1 -1
  36. package/app/styles/layout/_basic-layout.scss +2 -2
  37. package/app/styles/layout/_editor.scss +10 -4
  38. package/app/styles/primereact/_pr-datepicker.scss +4 -2
  39. package/app/styles/primereact/_pr-dialog.scss +5 -0
  40. package/app/styles/primereact/_pr-dropdown.scss +17 -1
  41. package/app/styles/primereact/_pr-menu.scss +6 -5
  42. package/app/styles/variables/_colors.scss +21 -21
  43. package/app-typescript/components/Badge.tsx +3 -2
  44. package/app-typescript/components/ContentDivider.tsx +3 -0
  45. package/app-typescript/components/DatePicker.tsx +40 -52
  46. package/app-typescript/components/Dropdown.tsx +127 -82
  47. package/app-typescript/components/DurationInput.tsx +400 -0
  48. package/app-typescript/components/EmptyState.tsx +2 -1
  49. package/app-typescript/components/Form/FormLabel.tsx +8 -1
  50. package/app-typescript/components/Form/FormRowNew.tsx +41 -0
  51. package/app-typescript/components/Form/InputBase.tsx +95 -0
  52. package/app-typescript/components/Form/InputNew.tsx +107 -0
  53. package/app-typescript/components/Form/InputWrapper.tsx +79 -0
  54. package/app-typescript/components/Form/index.tsx +4 -0
  55. package/app-typescript/components/Input.tsx +28 -45
  56. package/app-typescript/components/Label.tsx +65 -10
  57. package/app-typescript/components/Layouts/AuthoringContainer.tsx +2 -1
  58. package/app-typescript/components/Layouts/AuthoringFrame.tsx +2 -1
  59. package/app-typescript/components/Layouts/AuthoringFrameRightBar.tsx +21 -2
  60. package/app-typescript/components/Layouts/AuthoringInnerHeader.tsx +1 -1
  61. package/app-typescript/components/Layouts/AuthoringMain.tsx +4 -2
  62. package/app-typescript/components/Layouts/CoreLayout.tsx +2 -1
  63. package/app-typescript/components/Layouts/CoreLayoutMain.tsx +7 -1
  64. package/app-typescript/components/Layouts/Layout.tsx +1 -1
  65. package/app-typescript/components/LeftMenu.tsx +127 -122
  66. package/app-typescript/components/Lists/ContentList.tsx +66 -33
  67. package/app-typescript/components/Lists/TableList.tsx +348 -151
  68. package/app-typescript/components/Menu.tsx +2 -2
  69. package/app-typescript/components/MultiSelect.tsx +37 -50
  70. package/app-typescript/components/NavButton.tsx +2 -1
  71. package/app-typescript/components/Navigation/BottomNav.tsx +3 -2
  72. package/app-typescript/components/SearchBar.tsx +39 -12
  73. package/app-typescript/components/Select.tsx +23 -41
  74. package/app-typescript/components/SelectWithTemplate.tsx +32 -7
  75. package/app-typescript/components/Spacer.tsx +87 -0
  76. package/app-typescript/components/TimePicker.tsx +38 -15
  77. package/app-typescript/components/TreeSelect.tsx +546 -212
  78. package/app-typescript/index.ts +6 -1
  79. package/dist/examples.bundle.css +344 -71
  80. package/dist/examples.bundle.js +48203 -45174
  81. package/dist/playgrounds/react-playgrounds/CoreLayout.tsx +65 -54
  82. package/dist/playgrounds/react-playgrounds/Index.tsx +1 -0
  83. package/dist/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
  84. package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +26 -23
  85. package/dist/playgrounds/react-playgrounds/Rundowns.tsx +20 -21
  86. package/dist/playgrounds/react-playgrounds/SamsPlayground.tsx +12 -3
  87. package/dist/playgrounds/react-playgrounds/TestGround.tsx +379 -25
  88. package/dist/playgrounds/react-playgrounds/components/Layout.tsx +1 -1
  89. package/dist/react/Badges.tsx +18 -0
  90. package/dist/react/ContentDivider.tsx +22 -18
  91. package/dist/react/ContentList.tsx +200 -18
  92. package/dist/react/DatePicker.tsx +21 -1
  93. package/dist/react/Dropdowns.tsx +580 -48
  94. package/dist/react/DurationInput.tsx +108 -0
  95. package/dist/react/Index.tsx +5 -0
  96. package/dist/react/Inputs.tsx +147 -2
  97. package/dist/react/Labels.tsx +51 -1
  98. package/dist/react/LeftNavigations.tsx +71 -44
  99. package/dist/react/MultiSelect.tsx +10 -7
  100. package/dist/react/NavButtons.tsx +31 -1
  101. package/dist/react/SelectWithTemplate.tsx +6 -1
  102. package/dist/react/TableList.tsx +79 -186
  103. package/dist/react/TimePicker.tsx +22 -12
  104. package/dist/react/Togglebox.tsx +1 -1
  105. package/dist/react/TreeSelect.tsx +295 -51
  106. package/dist/react/tree-select/TreeSelect.tsx +273 -0
  107. package/dist/react/tree-select/example-1.tsx +71 -0
  108. package/dist/react/tree-select/example-2.tsx +59 -0
  109. package/dist/sd_icons.eot +0 -0
  110. package/dist/sd_icons.svg +14 -7
  111. package/dist/sd_icons.ttf +0 -0
  112. package/dist/sd_icons.woff +0 -0
  113. package/dist/superdesk-ui.bundle.css +2282 -782
  114. package/dist/superdesk-ui.bundle.js +37312 -21800
  115. package/dist/vendor.bundle.js +27 -27
  116. package/examples/css/docs-page.css +4 -4
  117. package/examples/index.js +4 -0
  118. package/examples/pages/playgrounds/react-playgrounds/CoreLayout.tsx +65 -54
  119. package/examples/pages/playgrounds/react-playgrounds/Index.tsx +1 -0
  120. package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
  121. package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +26 -23
  122. package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +20 -21
  123. package/examples/pages/playgrounds/react-playgrounds/SamsPlayground.tsx +12 -3
  124. package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +379 -25
  125. package/examples/pages/playgrounds/react-playgrounds/components/Layout.tsx +1 -1
  126. package/examples/pages/react/Badges.tsx +18 -0
  127. package/examples/pages/react/ContentDivider.tsx +22 -18
  128. package/examples/pages/react/ContentList.tsx +200 -18
  129. package/examples/pages/react/DatePicker.tsx +21 -1
  130. package/examples/pages/react/Dropdowns.tsx +580 -48
  131. package/examples/pages/react/DurationInput.tsx +108 -0
  132. package/examples/pages/react/Index.tsx +5 -0
  133. package/examples/pages/react/Inputs.tsx +147 -2
  134. package/examples/pages/react/Labels.tsx +51 -1
  135. package/examples/pages/react/LeftNavigations.tsx +71 -44
  136. package/examples/pages/react/MultiSelect.tsx +10 -7
  137. package/examples/pages/react/NavButtons.tsx +31 -1
  138. package/examples/pages/react/SelectWithTemplate.tsx +6 -1
  139. package/examples/pages/react/TableList.tsx +79 -186
  140. package/examples/pages/react/TimePicker.tsx +22 -12
  141. package/examples/pages/react/Togglebox.tsx +1 -1
  142. package/examples/pages/react/TreeSelect.tsx +295 -51
  143. package/examples/pages/react/tree-select/TreeSelect.tsx +273 -0
  144. package/examples/pages/react/tree-select/example-1.tsx +71 -0
  145. package/examples/pages/react/tree-select/example-2.tsx +59 -0
  146. package/package.json +5 -5
  147. package/react/components/Badge.d.ts +1 -0
  148. package/react/components/Badge.js +2 -2
  149. package/react/components/ContentDivider.d.ts +1 -0
  150. package/react/components/ContentDivider.js +2 -0
  151. package/react/components/DatePicker.d.ts +1 -0
  152. package/react/components/DatePicker.js +6 -22
  153. package/react/components/Dropdown.d.ts +6 -5
  154. package/react/components/Dropdown.js +57 -30
  155. package/react/components/DurationInput.d.ts +42 -0
  156. package/react/components/DurationInput.js +364 -0
  157. package/react/components/EmptyState.d.ts +1 -0
  158. package/react/components/EmptyState.js +1 -1
  159. package/react/components/Form/FormLabel.d.ts +4 -1
  160. package/react/components/Form/FormLabel.js +9 -3
  161. package/react/components/Form/FormRowNew.d.ts +12 -0
  162. package/react/components/Form/FormRowNew.js +67 -0
  163. package/react/components/Form/InputBase.d.ts +41 -0
  164. package/react/components/Form/InputBase.js +86 -0
  165. package/react/components/Form/InputNew.d.ts +45 -0
  166. package/react/components/Form/InputNew.js +75 -0
  167. package/react/components/Form/InputWrapper.d.ts +28 -0
  168. package/react/components/Form/InputWrapper.js +91 -0
  169. package/react/components/Form/index.d.ts +4 -0
  170. package/react/components/Form/index.js +9 -1
  171. package/react/components/Input.js +5 -34
  172. package/react/components/Label.d.ts +2 -0
  173. package/react/components/Label.js +34 -3
  174. package/react/components/Layouts/AuthoringContainer.d.ts +1 -0
  175. package/react/components/Layouts/AuthoringContainer.js +1 -1
  176. package/react/components/Layouts/AuthoringFrame.d.ts +1 -0
  177. package/react/components/Layouts/AuthoringFrame.js +1 -1
  178. package/react/components/Layouts/AuthoringFrameRightBar.d.ts +9 -2
  179. package/react/components/Layouts/AuthoringFrameRightBar.js +14 -3
  180. package/react/components/Layouts/AuthoringInnerHeader.js +1 -1
  181. package/react/components/Layouts/AuthoringMain.js +1 -1
  182. package/react/components/Layouts/CoreLayout.d.ts +1 -0
  183. package/react/components/Layouts/CoreLayout.js +1 -1
  184. package/react/components/Layouts/CoreLayoutMain.d.ts +1 -0
  185. package/react/components/Layouts/CoreLayoutMain.js +8 -1
  186. package/react/components/Layouts/Layout.js +1 -1
  187. package/react/components/LeftMenu.d.ts +3 -1
  188. package/react/components/LeftMenu.js +8 -1
  189. package/react/components/Lists/ContentList.d.ts +51 -0
  190. package/react/components/Lists/ContentList.js +110 -0
  191. package/react/components/Lists/TableList.d.ts +64 -0
  192. package/react/components/Lists/TableList.js +240 -0
  193. package/react/components/Menu.js +1 -1
  194. package/react/components/MultiSelect.d.ts +40 -0
  195. package/react/components/MultiSelect.js +70 -0
  196. package/react/components/NavButton.d.ts +1 -1
  197. package/react/components/Navigation/BottomNav.d.ts +1 -0
  198. package/react/components/Navigation/BottomNav.js +2 -2
  199. package/react/components/SearchBar.d.ts +3 -2
  200. package/react/components/SearchBar.js +28 -4
  201. package/react/components/Select.d.ts +1 -1
  202. package/react/components/Select.js +4 -26
  203. package/react/components/SelectWithTemplate.d.ts +11 -1
  204. package/react/components/SelectWithTemplate.js +19 -10
  205. package/react/components/TimePicker.d.ts +11 -1
  206. package/react/components/TimePicker.js +10 -3
  207. package/react/components/TreeSelect.d.ts +82 -0
  208. package/react/components/TreeSelect.js +521 -0
  209. package/react/index.d.ts +6 -0
  210. package/react/index.js +16 -3
  211. package/.vscode/settings.json +0 -5
  212. package/app-typescript/dist/components/Alert.d.ts +0 -16
  213. package/app-typescript/dist/components/Autocomplete.d.ts +0 -48
  214. package/app-typescript/dist/components/Avatar.d.ts +0 -33
  215. package/app-typescript/dist/components/Badge.d.ts +0 -13
  216. package/app-typescript/dist/components/Button.d.ts +0 -23
  217. package/app-typescript/dist/components/ButtonGroup.d.ts +0 -12
  218. package/app-typescript/dist/components/CheckButtonGroup.d.ts +0 -11
  219. package/app-typescript/dist/components/CheckGroup.d.ts +0 -9
  220. package/app-typescript/dist/components/Checkbox.d.ts +0 -19
  221. package/app-typescript/dist/components/CheckboxButton.d.ts +0 -19
  222. package/app-typescript/dist/components/DatePicker.d.ts +0 -37
  223. package/app-typescript/dist/components/Divider.d.ts +0 -9
  224. package/app-typescript/dist/components/DonutChart.d.ts +0 -12
  225. package/app-typescript/dist/components/Dropdown.d.ts +0 -28
  226. package/app-typescript/dist/components/DropdownFirst.d.ts +0 -42
  227. package/app-typescript/dist/components/EmptyState.d.ts +0 -11
  228. package/app-typescript/dist/components/FormLabel.d.ts +0 -9
  229. package/app-typescript/dist/components/Genie.d.ts +0 -13
  230. package/app-typescript/dist/components/GridItem.d.ts +0 -69
  231. package/app-typescript/dist/components/GridList.d.ts +0 -14
  232. package/app-typescript/dist/components/HeadingText.d.ts +0 -10
  233. package/app-typescript/dist/components/HelloWorld.d.ts +0 -8
  234. package/app-typescript/dist/components/Icon.d.ts +0 -12
  235. package/app-typescript/dist/components/IconButton.d.ts +0 -12
  236. package/app-typescript/dist/components/IconLabel.d.ts +0 -11
  237. package/app-typescript/dist/components/Input.d.ts +0 -24
  238. package/app-typescript/dist/components/Label.d.ts +0 -15
  239. package/app-typescript/dist/components/LeftMenu.d.ts +0 -26
  240. package/app-typescript/dist/components/Loader.d.ts +0 -8
  241. package/app-typescript/dist/components/NavButton.d.ts +0 -15
  242. package/app-typescript/dist/components/Popover.d.ts +0 -13
  243. package/app-typescript/dist/components/PropsList.d.ts +0 -15
  244. package/app-typescript/dist/components/Radio.d.ts +0 -19
  245. package/app-typescript/dist/components/RadioButton.d.ts +0 -20
  246. package/app-typescript/dist/components/Select.d.ts +0 -29
  247. package/app-typescript/dist/components/SelectWithTemplate.d.ts +0 -32
  248. package/app-typescript/dist/components/SlidingToolbar.d.ts +0 -8
  249. package/app-typescript/dist/components/StrechBar.d.ts +0 -4
  250. package/app-typescript/dist/components/SubNav.d.ts +0 -10
  251. package/app-typescript/dist/components/Switch.d.ts +0 -12
  252. package/app-typescript/dist/components/TabCustom.d.ts +0 -25
  253. package/app-typescript/dist/components/TabList.d.ts +0 -22
  254. package/app-typescript/dist/components/Tag.d.ts +0 -9
  255. package/app-typescript/dist/components/TagInput.d.ts +0 -7
  256. package/app-typescript/dist/components/TagInputTest.d.ts +0 -18
  257. package/app-typescript/dist/components/TimePicker.d.ts +0 -11
  258. package/app-typescript/dist/components/Tooltip.d.ts +0 -11
  259. package/app-typescript/dist/components/_Positioner.d.ts +0 -27
  260. package/app-typescript/dist/index.d.ts +0 -56
  261. package/patches/@superdesk+primereact+5.0.2-4.patch +0 -57
  262. package/yarn-error.log +0 -111
@@ -3,150 +3,155 @@ import classNames from "classnames";
3
3
  import Scrollspy from "react-scrollspy";
4
4
 
5
5
  interface IMenuItem {
6
- id: string;
7
- label: string;
8
- route?: string;
9
- ref?: string;
10
- onClick?(): void;
6
+ id: string;
7
+ label: string;
8
+ route?: string;
9
+ ref?: string;
10
+ onClick?(): void;
11
11
  }
12
12
 
13
13
  interface IMenuGroup {
14
- label: string;
15
- items: Array<IMenuItem>;
14
+ label: string;
15
+ items: Array<IMenuItem>;
16
16
  }
17
17
 
18
18
  interface IMenu {
19
- className?: string;
20
- groups: Array<IMenuGroup>;
21
- activeItemId: string;
22
- ariaLabel?: string;
23
- scrollSpy?: string;
24
- offset?: number;
25
- reverseItemBorder?: boolean;
26
- style?: "default" | "inverse" | "blanc";
27
- size?: "medium" | "large";
28
- onSelect(id: string, route: string): void;
19
+ className?: string;
20
+ groups: Array<IMenuGroup>;
21
+ activeItemId?: string;
22
+ scrollTo?: string;
23
+ ariaLabel?: string;
24
+ scrollSpy?: string;
25
+ offset?: number;
26
+ reverseItemBorder?: boolean;
27
+ style?: "default" | "inverse" | "blanc";
28
+ size?: "medium" | "large";
29
+ onSelect(id: string, route: string): void;
29
30
  }
30
31
 
31
32
  interface IState {
32
- active: string;
33
+ active: string;
33
34
  }
34
35
 
35
36
  export class LeftMenu extends React.PureComponent<IMenu, IState> {
36
- constructor(props: IMenu) {
37
- super(props);
37
+ constructor(props: IMenu) {
38
+ super(props);
38
39
 
39
- this.state = {
40
- active: "",
41
- };
42
- }
40
+ this.state = {
41
+ active: this.props.activeItemId ? this.props.activeItemId : '',
42
+ };
43
+ }
44
+
45
+ handleClick(item: IMenuItem, event?: React.MouseEvent) {
46
+ event?.preventDefault();
47
+
48
+ this.setState({
49
+ active: item.id,
50
+ });
43
51
 
44
- handleClick(item: IMenuItem, event?: React.MouseEvent) {
45
- event?.preventDefault();
52
+ if (item.ref) {
53
+ return document
54
+ .getElementById(item.ref)
55
+ ?.scrollIntoView({ block: "nearest", behavior: "smooth" });
56
+ }
46
57
 
47
- this.setState({
48
- active: item.id,
49
- });
58
+ if (item.onClick) {
59
+ return item.onClick();
60
+ }
50
61
 
51
- if (item.ref) {
52
- return document
53
- .getElementById(item.ref)
54
- ?.scrollIntoView({ block: "nearest", behavior: "smooth" });
62
+ this.props.onSelect(item.id, item.route ? item.route : "");
55
63
  }
56
64
 
57
- if (item.onClick) {
58
- return item.onClick();
65
+ componentDidMount() {
66
+ if (this.props.scrollTo) {
67
+ return document
68
+ .getElementById(this.props.scrollTo)
69
+ ?.scrollIntoView({ block: "nearest", behavior: "smooth" });
70
+ }
59
71
  }
60
72
 
61
- this.props.onSelect(item.id, item.route ? item.route : "");
62
- }
63
-
64
- render() {
65
- let classes = classNames(
66
- "sd-left-nav",
67
- {
68
- "sd-left-nav--default": this.props.style === undefined,
69
- [`sd-left-nav--${this.props.style}`]:
70
- this.props.style || this.props.style !== undefined,
71
- "sd-left-nav--medium": this.props.size === undefined,
72
- [`sd-left-nav--${this.props.size}`]:
73
- this.props.size || this.props.size !== undefined,
74
- "sd-left-nav--reverse-border": this.props.reverseItemBorder,
75
- },
76
- this.props.className,
77
- );
78
-
79
- const scrollspyList = () => {
80
- let scrollSpyList: Array<string> = [];
81
- let scrollSpyItems: Array<JSX.Element> = [];
82
- this.props.groups.map((element, index) => {
83
- scrollSpyList = [...scrollSpyList, element.label];
84
- scrollSpyItems.push(
85
- <span className="sd-left-nav__group-header" key={"group-" + index}>
86
- {element.label}
87
- </span>,
73
+ render() {
74
+ let classes = classNames(
75
+ "sd-left-nav",
76
+ {
77
+ "sd-left-nav--default": this.props.style === undefined,
78
+ [`sd-left-nav--${this.props.style}`]:
79
+ this.props.style || this.props.style !== undefined,
80
+ "sd-left-nav--medium": this.props.size === undefined,
81
+ [`sd-left-nav--${this.props.size}`]:
82
+ this.props.size || this.props.size !== undefined,
83
+ "sd-left-nav--reverse-border": this.props.reverseItemBorder,
84
+ },
85
+ this.props.className,
88
86
  );
89
87
 
90
- element.items.map((elementOfItem, indexOfItem) => {
91
- scrollSpyList = [...scrollSpyList, `${elementOfItem.ref}`];
92
-
93
- scrollSpyItems.push(
94
- <a
95
- key={"item-" + indexOfItem}
96
- onClick={(event) => {
97
- this.handleClick(elementOfItem, event);
98
- }}
99
- className="sd-left-nav__btn"
100
- >
101
- {elementOfItem.label}
102
- </a>,
103
- );
104
- });
105
- });
106
-
107
- return (
108
- <Scrollspy
109
- offset={this.props.offset ? this.props.offset : -300}
110
- items={scrollSpyList}
111
- rootEl={this.props.scrollSpy}
112
- currentClassName="sd-left-nav__btn--active"
113
- >
114
- {scrollSpyItems.map((element) => element)}
115
- </Scrollspy>
116
- );
117
- };
118
-
119
- const defaultList = () => {
120
- return this.props.groups.map((group, i) => {
88
+ const scrollspyList = () => {
89
+ let scrollSpyList: Array<string> = [];
90
+ let scrollSpyItems: Array<JSX.Element> = [];
91
+ this.props.groups.map((element, index) => {
92
+ scrollSpyList = [...scrollSpyList, element.label];
93
+ scrollSpyItems.push(
94
+ <span className="sd-left-nav__group-header" key={"group-" + index}>
95
+ {element.label}
96
+ </span>,
97
+ );
98
+
99
+ element.items.map((elementOfItem, indexOfItem) => {
100
+ scrollSpyList = [...scrollSpyList, `${elementOfItem.ref}`];
101
+
102
+ scrollSpyItems.push(
103
+ <a key={"item-" + indexOfItem}
104
+ onClick={(event) => {
105
+ this.handleClick(elementOfItem, event);
106
+ }}
107
+ className="sd-left-nav__btn" >
108
+ {elementOfItem.label}
109
+ </a>,
110
+ );
111
+ });
112
+ });
113
+
114
+ return (
115
+ <Scrollspy
116
+ offset={this.props.offset ? this.props.offset : -300}
117
+ items={scrollSpyList}
118
+ rootEl={this.props.scrollSpy}
119
+ currentClassName="sd-left-nav__btn--active" >
120
+ {scrollSpyItems.map((element) => element)}
121
+ </Scrollspy>
122
+ );
123
+ };
124
+
125
+ const defaultList = () => {
126
+ return this.props.groups.map((group, i) => {
127
+ return (
128
+ <React.Fragment key={i}>
129
+ <span className="sd-left-nav__group-header">{group.label}</span>
130
+ {group.items.map((item, j) => {
131
+ return (
132
+ <button
133
+ key={j}
134
+ onClick={(event) => {
135
+ this.handleClick(item, event);
136
+ }}
137
+ className={
138
+ item.id === this.state.active
139
+ ? "sd-left-nav__btn sd-left-nav__btn--active"
140
+ : "sd-left-nav__btn"
141
+ }>
142
+ {item.label}
143
+ </button>
144
+ );
145
+ })}
146
+ </React.Fragment>
147
+ );
148
+ });
149
+ };
150
+
121
151
  return (
122
- <React.Fragment key={i}>
123
- <span className="sd-left-nav__group-header">{group.label}</span>
124
- {group.items.map((item, j) => {
125
- return (
126
- <button
127
- key={j}
128
- onClick={(event) => {
129
- this.handleClick(item, event);
130
- }}
131
- className={
132
- item.id === this.state.active
133
- ? "sd-left-nav__btn sd-left-nav__btn--active"
134
- : "sd-left-nav__btn"
135
- }
136
- >
137
- {item.label}
138
- </button>
139
- );
140
- })}
141
- </React.Fragment>
152
+ <nav className={classes} aria-label={this.props.ariaLabel}>
153
+ {this.props.scrollSpy ? scrollspyList() : defaultList()}
154
+ </nav>
142
155
  );
143
- });
144
- };
145
-
146
- return (
147
- <nav className={classes} aria-label={this.props.ariaLabel}>
148
- {this.props.scrollSpy ? scrollspyList() : defaultList()}
149
- </nav>
150
- );
151
- }
156
+ }
152
157
  }
@@ -4,48 +4,81 @@ import classNames from 'classnames';
4
4
  interface IPropsItem {
5
5
  action?: React.ReactNode;
6
6
  locked?: boolean;
7
- itemColum: Array<{itemRow: Array<{content: any}>, border?: boolean, fullwidth?: boolean}>;
7
+ itemColum: Array<{ itemRow: Array<{ content: any }>, border?: boolean, fullwidth?: boolean }>;
8
8
  activated?: boolean;
9
9
  selected?: boolean;
10
- fetched?: boolean;
10
+ archived?: boolean;
11
11
  loading?: boolean;
12
12
  onClick?(): void;
13
13
  onDoubleClick?(): void;
14
14
  }
15
15
 
16
16
  class ContentListItem extends React.PureComponent<IPropsItem> {
17
+
18
+ private timer: any;
19
+ private delay = 200;
20
+ private prevent = false;
21
+
22
+ onSingleClick = () => {
23
+ this.timer = setTimeout(() => {
24
+ if (!this.prevent) {
25
+ if (this.props.onClick) {
26
+ this.props.onClick();
27
+ }
28
+ }
29
+ }, this.delay);
30
+ }
31
+
32
+ onDoubleClick = () => {
33
+ clearTimeout(this.timer);
34
+ this.prevent = true;
35
+ if (this.props.onDoubleClick) {
36
+ this.props.onDoubleClick();
37
+ }
38
+ setTimeout(() => {
39
+ this.prevent = false;
40
+ }, this.delay);
41
+ }
42
+
43
+ onActionMenuClick = (event: React.MouseEvent<HTMLElement>) => {
44
+ event.preventDefault();
45
+ event.stopPropagation();
46
+ }
47
+
17
48
  render() {
18
- let classes = classNames('sd-list-item sd-list-item-group sd-list-item-group--space-between-items', {
49
+ let classes = classNames('sd-list-item sd-shadow--z1', {
19
50
  'sd-list-item--activated': this.props.activated,
20
51
  'sd-list-item--selected': this.props.selected,
21
- 'fetched': this.props.fetched,
52
+ 'fetched': this.props.archived,
22
53
  'actioning': this.props.loading,
23
- });
54
+ });
24
55
 
25
56
  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
57
+ <div
58
+ role='listitem'
59
+ className={classes}
60
+ onClick={this.onSingleClick}
61
+ onDoubleClick={this.onDoubleClick}>
62
+ {this.props.locked
29
63
  ? <div className="sd-list-item__border sd-list-item__border--locked"></div>
30
64
  : <div className="sd-list-item__border"></div>}
31
- {this.props.itemColum.map((item, index) => {
32
- return <div
65
+ {this.props.itemColum.map((item, index) => {
66
+ return <div
33
67
  className={`sd-list-item__column ${item.fullwidth && 'sd-list-item__column--grow'} ${!item.border && 'sd-list-item__column--no-border'}`}
34
68
  key={index}>
35
69
  {item.itemRow.map((e, i) => {
36
70
  return (
37
71
  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>
72
+ ? <React.Fragment key={i}>{e.content}</React.Fragment>
73
+ : <div className="sd-list-item__row" key={i}>
74
+ {e.content}
75
+ </div>
42
76
  );
43
77
  })}
44
- </div>;
45
- })}
46
- <div className="sd-list-item__action-menu">
47
- {this.props.action}
48
- </div>
78
+ </div>;
79
+ })}
80
+ <div className="sd-list-item__action-menu" onClick={this.onActionMenuClick}>
81
+ {this.props.action}
49
82
  </div>
50
83
  </div>
51
84
  );
@@ -60,14 +93,14 @@ interface IProps {
60
93
  loading?: boolean,
61
94
  activated?: boolean,
62
95
  selected?: boolean,
63
- fetched?: boolean,
96
+ archived?: boolean,
64
97
  onClick?(): void,
65
98
  onDoubleClick?(): void;
66
99
  }>;
67
100
  }
68
101
 
69
102
  interface IItemArray {
70
- itemRow: Array<{content: React.ReactNode}>;
103
+ itemRow: Array<{ content: React.ReactNode }>;
71
104
  border?: boolean;
72
105
  fullwidth?: boolean;
73
106
  }
@@ -76,21 +109,21 @@ class ContentList extends React.PureComponent<IProps> {
76
109
  render() {
77
110
  let classes = classNames('sd-list-item-group sd-list-item-group--space-between-items');
78
111
  return (
79
- <ul className={classes}>
112
+ <div role='list' className={classes}>
80
113
  {this.props.items.map((item, index) => {
81
114
  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} />;
115
+ key={index}
116
+ itemColum={item.itemColum}
117
+ locked={item.locked}
118
+ action={item.action}
119
+ loading={item.loading}
120
+ activated={item.activated}
121
+ selected={item.selected}
122
+ archived={item.archived}
123
+ onClick={item.onClick}
124
+ onDoubleClick={item.onDoubleClick} />;
92
125
  })}
93
- </ul>
126
+ </div>
94
127
  );
95
128
  }
96
129
  }