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
@@ -0,0 +1,40 @@
1
+ import * as React from "react";
2
+ interface IProps<T> {
3
+ value: Array<T>;
4
+ options: Array<T>;
5
+ placeholder?: string;
6
+ optionLabel: string;
7
+ emptyFilterMessage?: string;
8
+ filterPlaceholder?: string;
9
+ maxSelectedLabels?: number;
10
+ selectedItemsLabel?: string;
11
+ ariaLabelledBy?: string;
12
+ tabIndex?: string | any;
13
+ filter?: boolean;
14
+ showClear?: boolean;
15
+ showSelectAll?: boolean;
16
+ itemTemplate?(item: any): JSX.Element | undefined;
17
+ selectedItemTemplate?(value: any): JSX.Element | undefined;
18
+ onChange(newValue: string): void;
19
+ invalid?: boolean;
20
+ inlineLabel?: boolean;
21
+ labelHidden?: boolean;
22
+ tabindex?: number;
23
+ fullWidth?: boolean;
24
+ info?: string;
25
+ error?: string;
26
+ required?: boolean;
27
+ label?: string;
28
+ disabled?: boolean;
29
+ }
30
+ interface IState<T> {
31
+ options: Array<T>;
32
+ value: Array<T>;
33
+ invalid: boolean;
34
+ }
35
+ export declare class MultiSelect<T> extends React.Component<IProps<T>, IState<T>> {
36
+ private htmlId;
37
+ constructor(props: IProps<T>);
38
+ render(): JSX.Element;
39
+ }
40
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.MultiSelect = void 0;
41
+ var React = __importStar(require("react"));
42
+ var multiselect_1 = require("@superdesk/primereact/multiselect");
43
+ var classnames_1 = __importDefault(require("classnames"));
44
+ var react_id_generator_1 = __importDefault(require("react-id-generator"));
45
+ var Form_1 = require("./Form");
46
+ var MultiSelect = /** @class */ (function (_super) {
47
+ __extends(MultiSelect, _super);
48
+ function MultiSelect(props) {
49
+ var _this = _super.call(this, props) || this;
50
+ _this.htmlId = (0, react_id_generator_1.default)();
51
+ _this.state = {
52
+ value: [],
53
+ options: [],
54
+ invalid: _this.props.invalid ? _this.props.invalid : false,
55
+ };
56
+ return _this;
57
+ }
58
+ MultiSelect.prototype.render = function () {
59
+ var _this = this;
60
+ var _a;
61
+ var classes = (0, classnames_1.default)({
62
+ 'showSelectAll': this.props.showSelectAll,
63
+ 'showFilter': this.props.filter,
64
+ });
65
+ return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.state.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
66
+ React.createElement(multiselect_1.MultiSelect, { panelClassName: classes, value: this.props.value, options: this.props.options, onChange: function (e) { return _this.props.onChange(e); }, display: "chip", filter: this.props.filter, filterBy: this.props.optionLabel, appendTo: document.body, placeholder: this.props.placeholder, optionLabel: this.props.optionLabel, emptyFilterMessage: this.props.emptyFilterMessage, filterPlaceholder: this.props.filterPlaceholder, itemTemplate: this.props.itemTemplate, selectedItemTemplate: this.props.selectedItemTemplate, maxSelectedLabels: (_a = this.props.maxSelectedLabels) !== null && _a !== void 0 ? _a : 4, selectedItemsLabel: this.props.selectedItemsLabel, ariaLabelledBy: this.htmlId + 'label', tabIndex: this.props.tabIndex ? this.props.tabIndex : '0', showClear: this.props.showClear, disabled: this.props.disabled, inputId: this.htmlId })));
67
+ };
68
+ return MultiSelect;
69
+ }(React.Component));
70
+ exports.MultiSelect = MultiSelect;
@@ -5,7 +5,7 @@ interface IProps {
5
5
  text?: string;
6
6
  iconSize?: 'small' | 'big';
7
7
  theme?: 'light' | 'dark';
8
- type?: 'default' | 'primary' | 'highlight' | 'darker';
8
+ type?: 'default' | 'primary' | 'highlight' | 'darker' | 'dark';
9
9
  state?: 'normal' | 'active';
10
10
  value?: 'button' | 'submit' | 'reset';
11
11
  onClick(): void;
@@ -8,6 +8,7 @@ interface IItem {
8
8
  active?: boolean;
9
9
  title: string;
10
10
  onClick(event: any): void;
11
+ onRemove(event: any): void;
11
12
  }
12
13
  interface IState {
13
14
  index: number;
@@ -71,7 +71,7 @@ var BottomNav = /** @class */ (function (_super) {
71
71
  };
72
72
  BottomNav.prototype.render = function () {
73
73
  var _this = this;
74
- return (React.createElement("ul", { className: 'sd-bottom-nav-list' }, this.state.items.map(function (item, index) {
74
+ return (React.createElement("ul", { className: 'sd-bottom-nav-list' }, this.props.items.map(function (item, index) {
75
75
  return (React.createElement("li", { key: index, className: 'sd-bottom-nav-list__item' + (item['active'] ? ' sd-bottom-nav-list__item--active' : (index === _this.state.index ? ' sd-bottom-nav-list__item--active' : '')) },
76
76
  React.createElement("a", { className: 'sd-bottom-nav-list__item-title', onClick: function (event) {
77
77
  _this.handleClick(index);
@@ -80,7 +80,7 @@ var BottomNav = /** @class */ (function (_super) {
80
80
  item['icon'] &&
81
81
  React.createElement(Icon_1.Icon, { name: item['icon'] }),
82
82
  React.createElement("span", null, item.title)),
83
- React.createElement(IconButton_1.IconButton, { size: 'small', icon: "close-small", ariaValue: 'Delete', onClick: function () { return _this.handleDelete(index); } })));
83
+ React.createElement(IconButton_1.IconButton, { size: 'small', icon: "close-small", ariaValue: 'Delete', onClick: function () { return item.onRemove(index); } })));
84
84
  })));
85
85
  };
86
86
  return BottomNav;
@@ -1,17 +1,18 @@
1
1
  import * as React from 'react';
2
2
  interface IProps {
3
- value?: string | number;
3
+ value?: string;
4
4
  type?: 'expanded' | 'collapsed' | 'boxed';
5
5
  placeholder: string;
6
6
  focused?: boolean;
7
7
  boxed?: boolean;
8
- onSubmit?(): void;
8
+ onSubmit?(value: string | number): void;
9
9
  }
10
10
  interface IState {
11
11
  inputValue: any;
12
12
  type: string;
13
13
  focused: boolean;
14
14
  boxed?: boolean;
15
+ keyDown?: boolean;
15
16
  }
16
17
  export declare class SearchBar extends React.PureComponent<IProps, IState> {
17
18
  private inputRef;
@@ -57,6 +57,7 @@ var SearchBar = /** @class */ (function (_super) {
57
57
  focused: _this.props.focused ? _this.props.focused : false,
58
58
  type: _this.props.type ? _this.props.type : 'expanded',
59
59
  boxed: _this.props.boxed ? _this.props.boxed : false,
60
+ keyDown: false,
60
61
  };
61
62
  _this.inputRef = React.createRef();
62
63
  return _this;
@@ -77,12 +78,35 @@ var SearchBar = /** @class */ (function (_super) {
77
78
  _a));
78
79
  return (React.createElement("div", { className: classes, ref: this.inputRef },
79
80
  React.createElement("label", { className: "sd-searchbar__icon" }),
80
- React.createElement("input", { id: "search-input", ref: function (input) { return (input && _this.props.focused) && input.focus(); }, className: "sd-searchbar__input", type: "text", placeholder: this.props.placeholder, value: this.state.inputValue, onChange: function (e) { return _this.setState({ inputValue: e.target.value }); }, onFocus: function () { return _this.setState({ focused: true }); } }),
81
+ React.createElement("input", { id: "search-input", ref: function (input) { return (input && _this.props.focused) && input.focus(); }, className: "sd-searchbar__input", type: "text", placeholder: this.props.placeholder, value: this.state.inputValue, onKeyPress: function (event) {
82
+ if (event.key === 'Enter') {
83
+ if (_this.props.onSubmit) {
84
+ _this.props.onSubmit(_this.state.inputValue);
85
+ }
86
+ _this.setState({ keyDown: true });
87
+ }
88
+ }, onKeyUp: function (event) {
89
+ if (event.key === 'Enter') {
90
+ _this.setState({ keyDown: false });
91
+ }
92
+ }, onChange: function (event) { return _this.setState({ inputValue: event.target.value }); }, onFocus: function () { return _this.setState({ focused: true }); } }),
81
93
  this.state.inputValue &&
82
- React.createElement("button", { className: "sd-searchbar__cancel", onClick: function () { return _this.setState({ inputValue: '' }); } },
94
+ React.createElement("button", { className: "sd-searchbar__cancel", onClick: function () {
95
+ _this.setState({ inputValue: '' });
96
+ setTimeout(function () {
97
+ if (_this.props.onSubmit) {
98
+ _this.props.onSubmit(_this.state.inputValue);
99
+ }
100
+ });
101
+ } },
83
102
  React.createElement(Icon_1.Icon, { name: 'remove-sign' })),
84
- React.createElement("button", { id: "sd-searchbar__search-btn", className: "sd-searchbar__search-btn", onSubmit: function () { return _this.props.onSubmit; } },
85
- React.createElement(Icon_1.Icon, { name: 'chevron-right-thin' }))));
103
+ this.state.inputValue &&
104
+ React.createElement("button", { id: "sd-searchbar__search-btn", className: "sd-searchbar__search-btn ".concat(this.state.keyDown ? 'sd-searchbar__search-btn--active' : ''), onClick: function () {
105
+ if (_this.props.onSubmit) {
106
+ _this.props.onSubmit(_this.state.inputValue);
107
+ }
108
+ } },
109
+ React.createElement(Icon_1.Icon, { name: 'chevron-right-thin' }))));
86
110
  };
87
111
  return SearchBar;
88
112
  }(React.PureComponent));
@@ -22,8 +22,8 @@ interface IState {
22
22
  invalid: boolean;
23
23
  }
24
24
  declare class Select extends React.Component<ISelect, IState> {
25
+ private htmlId;
25
26
  constructor(props: ISelect);
26
- htmlId: string;
27
27
  handleChange(event: React.ChangeEvent<HTMLSelectElement>): void;
28
28
  render(): JSX.Element;
29
29
  }
@@ -39,8 +39,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.Option = exports.Select = void 0;
41
41
  var React = __importStar(require("react"));
42
- var classnames_1 = __importDefault(require("classnames"));
42
+ // import classNames from 'classnames';
43
43
  var react_id_generator_1 = __importDefault(require("react-id-generator"));
44
+ var Form_1 = require("./Form");
44
45
  var Select = /** @class */ (function (_super) {
45
46
  __extends(Select, _super);
46
47
  function Select(props) {
@@ -59,31 +60,8 @@ var Select = /** @class */ (function (_super) {
59
60
  this.props.onChange(event.target.value);
60
61
  };
61
62
  Select.prototype.render = function () {
62
- var _a;
63
- var classes = (0, classnames_1.default)('sd-input sd-input--is-select', (_a = {
64
- 'sd-input--inline-label': this.props.inlineLabel,
65
- 'sd-input--required': this.props.required,
66
- 'sd-input--disabled': this.props.disabled,
67
- 'sd-input--full-width': this.props.fullWidth,
68
- 'sd-input--invalid': this.props.invalid || this.state.invalid,
69
- 'sd-input--medium': this.props.size === undefined
70
- },
71
- _a["sd-input--".concat(this.props.size)] = this.props.size || this.props.size !== undefined,
72
- _a['sd-input--boxed-style'] = this.props.boxedStyle,
73
- _a['sd-input--boxed-label'] = this.props.boxedLable,
74
- _a));
75
- var labelClasses = (0, classnames_1.default)('sd-input__label', {
76
- 'a11y-only': this.props.labelHidden,
77
- });
78
- return (React.createElement("div", { className: classes },
79
- React.createElement("label", { className: labelClasses, htmlFor: this.htmlId, tabIndex: this.props.tabindex === undefined ? undefined : -1 }, this.props.label),
80
- React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.state.value, "aria-describedby": this.htmlId, tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled }, this.props.children),
81
- React.createElement("div", { className: 'sd-input__message-box' },
82
- this.props.info && !this.props.invalid && !this.state.invalid ?
83
- React.createElement("div", { className: 'sd-input__hint' }, this.props.info) : null,
84
- this.props.invalid || this.state.invalid ?
85
- React.createElement("div", { className: 'sd-input__message' }, this.props.error)
86
- : null)));
63
+ return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.state.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
64
+ React.createElement("select", { className: 'sd-input__select', id: this.htmlId, value: this.state.value, "aria-describedby": this.htmlId, tabIndex: this.props.tabindex, onChange: this.handleChange, disabled: this.props.disabled }, this.props.children)));
87
65
  };
88
66
  return Select;
89
67
  }(React.Component));
@@ -12,19 +12,29 @@ interface IProps<T> {
12
12
  noResultsFoundMessage: string;
13
13
  filterPlaceholder?: string;
14
14
  disabled?: boolean;
15
- required?: boolean;
16
15
  autoFocus?: boolean;
17
16
  autoOpen?: boolean;
18
17
  width?: 'min' | '100%';
19
18
  zIndex?: number;
20
19
  'data-test-id'?: string;
20
+ inlineLabel?: boolean;
21
+ required?: boolean;
22
+ fullWidth?: boolean;
23
+ invalid?: boolean;
24
+ labelHidden?: boolean;
25
+ tabindex?: number;
26
+ label?: string;
27
+ info?: string;
28
+ error?: string;
21
29
  }
22
30
  interface IState<T> {
23
31
  options: Array<T>;
24
32
  loading: boolean;
33
+ invalid: boolean;
25
34
  }
26
35
  export declare class SelectWithTemplate<T> extends React.Component<IProps<T>, IState<T>> {
27
36
  componentRef: Dropdown | null;
37
+ private htmlId;
28
38
  constructor(props: IProps<T>);
29
39
  componentDidMount(): void;
30
40
  render(): JSX.Element;
@@ -33,18 +33,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
33
  __setModuleDefault(result, mod);
34
34
  return result;
35
35
  };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
36
39
  Object.defineProperty(exports, "__esModule", { value: true });
37
40
  exports.SelectWithTemplate = void 0;
38
41
  var React = __importStar(require("react"));
39
42
  var dropdown_1 = require("@superdesk/primereact/dropdown");
43
+ // import classNames from 'classnames';
44
+ var react_id_generator_1 = __importDefault(require("react-id-generator"));
45
+ var Form_1 = require("./Form");
40
46
  var labelKey = 'label';
41
47
  var SelectWithTemplate = /** @class */ (function (_super) {
42
48
  __extends(SelectWithTemplate, _super);
43
49
  function SelectWithTemplate(props) {
44
50
  var _this = _super.call(this, props) || this;
51
+ _this.htmlId = (0, react_id_generator_1.default)();
45
52
  _this.state = {
46
53
  options: [],
47
54
  loading: false,
55
+ invalid: _this.props.invalid ? _this.props.invalid : false,
48
56
  };
49
57
  _this.componentRef = null;
50
58
  return _this;
@@ -84,16 +92,17 @@ var SelectWithTemplate = /** @class */ (function (_super) {
84
92
  // needs to be passed to prime react component
85
93
  // or it will not be displayed at all, even if returned by itemTemplate
86
94
  var fakePlaceholderWithNonBreakingSpace = ' ';
87
- return (React.createElement(dropdown_1.Dropdown, { value: valueInternal, options: optionsInternal, onChange: function (e) {
88
- onChange(e.value == null ? null : e.value.original);
89
- }, placeholder: fakePlaceholderWithNonBreakingSpace, filterPlaceholder: filterPlaceholder, filter: true, filterBy: labelKey, showClear: !required, emptyFilterMessage: emptyFilterMessage, valueTemplate: function (option) { return React.createElement(ItemTemplate, { option: option == null ? null : option.original }); }, itemTemplate: function (option) { return React.createElement(ItemTemplate, { option: option.original }); }, disabled: disabled, required: required, autoFocus: autoFocus, appendTo: document.body, loading: loading, onFilterInputChange: function (searchString) {
90
- _this.setState({ loading: true });
91
- getItems(searchString).then(function (_options) {
92
- _this.setState({ options: _options, loading: false });
93
- });
94
- }, zIndex: zIndex, style: width === '100%' ? { display: 'flex', width: '100%' } : {}, ref: function (componentRef) {
95
- _this.componentRef = componentRef;
96
- } }));
95
+ return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.state.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
96
+ React.createElement(dropdown_1.Dropdown, { inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', value: valueInternal, options: optionsInternal, onChange: function (e) {
97
+ onChange(e.value == null ? null : e.value.original);
98
+ }, placeholder: fakePlaceholderWithNonBreakingSpace, filterPlaceholder: filterPlaceholder, filter: true, filterBy: labelKey, showClear: !required, emptyFilterMessage: emptyFilterMessage, valueTemplate: function (option) { return React.createElement(ItemTemplate, { option: option == null ? null : option.original }); }, itemTemplate: function (option) { return React.createElement(ItemTemplate, { option: option.original }); }, disabled: disabled, required: required, autoFocus: autoFocus, appendTo: document.body, loading: loading, onFilterInputChange: function (searchString) {
99
+ _this.setState({ loading: true });
100
+ getItems(searchString).then(function (_options) {
101
+ _this.setState({ options: _options, loading: false });
102
+ });
103
+ }, zIndex: zIndex, style: width === '100%' ? { display: 'flex', width: '100%' } : {}, ref: function (componentRef) {
104
+ _this.componentRef = componentRef;
105
+ } })));
97
106
  };
98
107
  return SelectWithTemplate;
99
108
  }(React.Component));
@@ -2,10 +2,20 @@ import * as React from 'react';
2
2
  interface IProps {
3
3
  value: string;
4
4
  onChange(valueNext: string): void;
5
- required?: boolean;
5
+ allowSeconds?: boolean;
6
6
  disabled?: boolean;
7
+ inlineLabel?: boolean;
8
+ required?: boolean;
9
+ fullWidth?: boolean;
10
+ invalid?: boolean;
11
+ labelHidden?: boolean;
12
+ tabindex?: number;
13
+ label?: string;
14
+ info?: string;
15
+ error?: string;
7
16
  }
8
17
  export declare class TimePicker extends React.PureComponent<IProps> {
18
+ private htmlId;
9
19
  render(): JSX.Element;
10
20
  }
11
21
  export {};
@@ -33,18 +33,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
33
  __setModuleDefault(result, mod);
34
34
  return result;
35
35
  };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
36
39
  Object.defineProperty(exports, "__esModule", { value: true });
37
40
  exports.TimePicker = void 0;
38
41
  var React = __importStar(require("react"));
42
+ var react_id_generator_1 = __importDefault(require("react-id-generator"));
43
+ var Form_1 = require("./Form");
39
44
  var TimePicker = /** @class */ (function (_super) {
40
45
  __extends(TimePicker, _super);
41
46
  function TimePicker() {
42
- return _super !== null && _super.apply(this, arguments) || this;
47
+ var _this = _super !== null && _super.apply(this, arguments) || this;
48
+ _this.htmlId = (0, react_id_generator_1.default)();
49
+ return _this;
43
50
  }
44
51
  TimePicker.prototype.render = function () {
45
52
  var _this = this;
46
- return (React.createElement("div", { className: "sd-input sd-input--no-label sd-input--no-margin", style: { display: 'inline-flex' } },
47
- React.createElement("input", { type: "time", className: "sd-input__input", value: this.props.value, required: this.props.required, disabled: this.props.disabled, onChange: function (event) {
53
+ return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.props.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
54
+ React.createElement("input", { id: this.htmlId, "aria-labelledby": this.htmlId + 'label', type: "time", step: this.props.allowSeconds ? 1 : undefined, className: "sd-input__input", value: this.props.value, required: this.props.required, disabled: this.props.disabled, onChange: function (event) {
48
55
  _this.props.onChange(event.target.value);
49
56
  } })));
50
57
  };
@@ -0,0 +1,82 @@
1
+ import * as React from "react";
2
+ interface IState<T> {
3
+ value: Array<T>;
4
+ options: Array<ITreeNode<T>>;
5
+ firstBranchOptions: Array<any>;
6
+ openDropdown: boolean;
7
+ activeTree: Array<any>;
8
+ filterArr: Array<any>;
9
+ searchFieldValue: string;
10
+ buttonTree: Array<any>;
11
+ buttonValue: any;
12
+ buttonMouseEvent: boolean;
13
+ loading: boolean;
14
+ }
15
+ interface IPropsBase<T> {
16
+ value?: Array<T>;
17
+ selectBranchWithChildren?: boolean;
18
+ readOnly?: boolean;
19
+ width?: string;
20
+ allowMultiple?: boolean;
21
+ loading?: boolean;
22
+ singleLevelSearch?: boolean;
23
+ placeholder?: string;
24
+ searchPlaceholder?: string;
25
+ invalid?: boolean;
26
+ inlineLabel?: boolean;
27
+ labelHidden?: boolean;
28
+ tabindex?: number;
29
+ fullWidth?: boolean;
30
+ info?: string;
31
+ error?: string;
32
+ required?: boolean;
33
+ label?: string;
34
+ disabled?: boolean;
35
+ getLabel(item: T): string;
36
+ getId(item: T): string;
37
+ getBackgroundColor?(item: T): string;
38
+ getBorderColor?(item: T): string;
39
+ optionTemplate?(item: T): React.ComponentType<T> | JSX.Element;
40
+ valueTemplate?(item: T, Wrapper: any): React.ComponentType<T> | JSX.Element;
41
+ onChange(e: Array<T>): void;
42
+ }
43
+ interface IPropsSync<T> extends IPropsBase<T> {
44
+ kind: 'synchronous';
45
+ getOptions(): Array<ITreeNode<T>>;
46
+ }
47
+ interface IPropsAsync<T> extends IPropsBase<T> {
48
+ kind: 'asynchronous';
49
+ getOptions?(): Array<ITreeNode<T>>;
50
+ searchOptions(term: string, callback?: (options: Array<ITreeNode<T>>) => void): any;
51
+ }
52
+ declare type IProps<T> = IPropsSync<T> | IPropsAsync<T>;
53
+ export interface ITreeNode<T> {
54
+ value: T;
55
+ children?: Array<ITreeNode<T>>;
56
+ }
57
+ export declare class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
58
+ private dropdownRef;
59
+ private openDropdownRef;
60
+ private htmlId;
61
+ private popperInstance;
62
+ constructor(props: IProps<T>);
63
+ componentDidMount: () => void;
64
+ componentDidUpdate(prevProps: Readonly<IProps<T>>, prevState: Readonly<IState<T>>): void;
65
+ toggleMenu(): void;
66
+ removeClick(i: number): void;
67
+ handleMultiLevel(item: ITreeNode<T>): void;
68
+ handleButton(item: ITreeNode<T>): void;
69
+ handleValue(event: React.MouseEvent<HTMLLIElement, MouseEvent>, item: ITreeNode<T>): void;
70
+ handleBranchValue(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, item: ITreeNode<T>): void;
71
+ handleTree(event: React.MouseEvent<HTMLLIElement, MouseEvent>, option: ITreeNode<T>): void;
72
+ backButton: () => false | undefined;
73
+ backButtonValue: () => void;
74
+ recursion(arr: Array<ITreeNode<T>>): void;
75
+ filteredItem(arr: Array<ITreeNode<T>>): JSX.Element | JSX.Element[] | undefined;
76
+ banchButton(): JSX.Element;
77
+ private debounceFn;
78
+ private ICancelFn;
79
+ handleDebounce(): void;
80
+ render(): JSX.Element;
81
+ }
82
+ export {};