orc-shared 5.10.2-dev.4 → 5.99.0-dev.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 (226) hide show
  1. package/dist/components/AppFrame/About.js +13 -13
  2. package/dist/components/AppFrame/Anchor.js +7 -7
  3. package/dist/components/AppFrame/AppFrame.js +3 -3
  4. package/dist/components/AppFrame/Help.js +4 -4
  5. package/dist/components/AppFrame/MenuItem.js +17 -26
  6. package/dist/components/AppFrame/Preferences.js +14 -14
  7. package/dist/components/AppFrame/Sidebar.js +6 -6
  8. package/dist/components/AppFrame/Topbar.js +6 -6
  9. package/dist/components/ApplicationModuleLoader.js +3 -2
  10. package/dist/components/Authenticate.js +29 -22
  11. package/dist/components/DropMenu/Menu.js +9 -9
  12. package/dist/components/ErrorPlaceholder.js +8 -24
  13. package/dist/components/Form/Field.js +4 -4
  14. package/dist/components/Form/Inputs/Button.js +2 -2
  15. package/dist/components/{IconButton.js → Form/Inputs/MultiSelector.js} +33 -31
  16. package/dist/components/Form/Inputs/index.js +1 -1
  17. package/dist/components/InternetExplorerWarningMessage.js +15 -15
  18. package/dist/components/LoadingIcon.js +38 -17
  19. package/dist/components/MaterialUI/DataDisplay/Modal.js +3 -3
  20. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
  21. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +4 -4
  22. package/dist/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
  23. package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
  24. package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
  25. package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  26. package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
  27. package/dist/components/MaterialUI/Inputs/DatePicker.js +1 -1
  28. package/dist/components/MaterialUI/Inputs/InputBase.js +20 -188
  29. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  30. package/dist/components/MaterialUI/Inputs/Select.js +10 -0
  31. package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
  32. package/dist/components/MaterialUI/Inputs/Switch.js +1 -1
  33. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
  34. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
  35. package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +27 -42
  36. package/dist/components/MaterialUI/Surfaces/Paper.js +1 -1
  37. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
  38. package/dist/components/MaterialUI/muiThemes.js +2 -0
  39. package/dist/components/Provision.js +30 -13
  40. package/dist/components/Routing/SegmentPage.js +115 -56
  41. package/dist/components/Scope/ScopeNode.js +62 -57
  42. package/dist/components/Sidepanel.js +59 -23
  43. package/dist/components/Spritesheet.js +35 -17
  44. package/dist/components/Text.js +1 -60
  45. package/dist/components/ToastList.js +95 -64
  46. package/dist/components/Treeview/Branch.js +82 -20
  47. package/dist/components/Treeview/Label.js +108 -31
  48. package/dist/components/Treeview/Leaf.js +56 -12
  49. package/dist/components/Treeview/Node.js +22 -9
  50. package/dist/components/Treeview/index.js +7 -1
  51. package/dist/components/Treeview/settings.js +17 -6
  52. package/dist/utils/index.js +0 -4
  53. package/dist/utils/testUtils.js +1 -12
  54. package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
  55. package/package.json +2 -2
  56. package/src/components/AppFrame/About.js +13 -13
  57. package/src/components/AppFrame/Anchor.js +7 -7
  58. package/src/components/AppFrame/AppFrame.js +3 -3
  59. package/src/components/AppFrame/Help.js +4 -4
  60. package/src/components/AppFrame/MenuItem.js +15 -23
  61. package/src/components/AppFrame/Preferences.js +14 -14
  62. package/src/components/AppFrame/Sidebar.js +6 -6
  63. package/src/components/AppFrame/Topbar.js +6 -6
  64. package/src/components/ApplicationModuleLoader.js +2 -2
  65. package/src/components/ApplicationModuleLoader.test.js +15 -28
  66. package/src/components/Authenticate.js +21 -23
  67. package/src/components/Authenticate.test.js +19 -27
  68. package/src/components/DropMenu/Menu.js +9 -9
  69. package/src/components/ErrorPlaceholder.js +4 -21
  70. package/src/components/ErrorPlaceholder.test.js +7 -14
  71. package/src/components/Form/Field.js +4 -4
  72. package/src/components/Form/InputField.test.js +2 -1
  73. package/src/components/Form/Inputs/Button.js +2 -2
  74. package/src/components/Form/Inputs/MultiSelector.js +23 -0
  75. package/src/components/Form/Inputs/MultiSelector.test.js +112 -0
  76. package/src/components/Form/Inputs/index.js +1 -1
  77. package/src/components/InternetExplorerWarningMessage.js +15 -15
  78. package/src/components/Loader.test.js +50 -59
  79. package/src/components/LoadingIcon.js +27 -14
  80. package/src/components/LoadingIcon.test.js +11 -15
  81. package/src/components/MaterialUI/DataDisplay/Modal.js +3 -3
  82. package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
  83. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +3 -3
  84. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -74
  85. package/src/components/MaterialUI/DataDisplay/PredefinedElements/Translations.test.js +6 -18
  86. package/src/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
  87. package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
  88. package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
  89. package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
  90. package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
  91. package/src/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  92. package/src/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
  93. package/src/components/MaterialUI/Inputs/DatePicker.js +1 -1
  94. package/src/components/MaterialUI/Inputs/InputBase.js +31 -214
  95. package/src/components/MaterialUI/Inputs/InputBase.test.js +1 -460
  96. package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  97. package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +1 -1
  98. package/src/components/MaterialUI/Inputs/Select.js +7 -0
  99. package/src/components/MaterialUI/Inputs/Select.test.js +45 -0
  100. package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
  101. package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
  102. package/src/components/MaterialUI/Inputs/Switch.js +1 -1
  103. package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
  104. package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
  105. package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -2
  106. package/src/components/MaterialUI/ScopeSelector/TreeItem.js +8 -31
  107. package/src/components/MaterialUI/Surfaces/Paper.js +1 -1
  108. package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
  109. package/src/components/MaterialUI/muiThemes.js +3 -0
  110. package/src/components/Navigation/Navigation.test.js +0 -5
  111. package/src/components/Navigation/useNavigationState.test.js +79 -222
  112. package/src/components/Provision.js +36 -42
  113. package/src/components/Provision.test.js +10 -26
  114. package/src/components/Routing/SegmentPage.js +68 -52
  115. package/src/components/Routing/SegmentPage.test.js +4 -12
  116. package/src/components/Scope/ScopeNode.js +44 -55
  117. package/src/components/Scope/ScopeNode.test.js +84 -163
  118. package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
  119. package/src/components/Sidepanel.js +38 -32
  120. package/src/components/Sidepanel.test.js +54 -27
  121. package/src/components/Spritesheet.js +23 -21
  122. package/src/components/Spritesheet.test.js +10 -10
  123. package/src/components/Text.js +0 -49
  124. package/src/components/ToastList.js +79 -90
  125. package/src/components/ToastList.test.js +29 -103
  126. package/src/components/Treeview/Branch.js +65 -47
  127. package/src/components/Treeview/Branch.test.js +2 -43
  128. package/src/components/Treeview/Label.js +68 -54
  129. package/src/components/Treeview/Label.test.js +55 -63
  130. package/src/components/Treeview/Leaf.js +41 -22
  131. package/src/components/Treeview/Leaf.test.js +1 -15
  132. package/src/components/Treeview/Node.js +16 -9
  133. package/src/components/Treeview/Node.test.js +269 -200
  134. package/src/components/Treeview/Treeview.test.js +248 -248
  135. package/src/components/Treeview/index.js +6 -0
  136. package/src/components/Treeview/settings.js +10 -6
  137. package/src/utils/index.js +0 -4
  138. package/src/utils/testUtils.js +0 -10
  139. package/src/utils/testUtils.test.js +0 -68
  140. package/src/utils/toastHelper.js +8 -0
  141. package/src/utils/toastHelper.test.js +41 -0
  142. package/dist/components/Button.js +0 -70
  143. package/dist/components/CategoryList.js +0 -197
  144. package/dist/components/Checkbox.js +0 -103
  145. package/dist/components/Icon.js +0 -69
  146. package/dist/components/Input.js +0 -101
  147. package/dist/components/List/DataCell.js +0 -129
  148. package/dist/components/List/HeadCell.js +0 -125
  149. package/dist/components/List/HeadRow.js +0 -73
  150. package/dist/components/List/List.js +0 -274
  151. package/dist/components/List/Row.js +0 -109
  152. package/dist/components/List/enhanceColumnDefs.js +0 -111
  153. package/dist/components/List/index.js +0 -59
  154. package/dist/components/Modal/Dialog.js +0 -75
  155. package/dist/components/Modal/Wrapper.js +0 -69
  156. package/dist/components/Modal/index.js +0 -86
  157. package/dist/components/MultiSelector.js +0 -187
  158. package/dist/components/Navigation/Bar.js +0 -293
  159. package/dist/components/Navigation/Tab.js +0 -182
  160. package/dist/components/Placeholder.js +0 -114
  161. package/dist/components/Scope/Selector.js +0 -123
  162. package/dist/components/Selector.js +0 -185
  163. package/dist/components/Switch.js +0 -128
  164. package/dist/components/Toolbar.js +0 -227
  165. package/dist/components/Tooltip.js +0 -66
  166. package/dist/getTheme.js +0 -158
  167. package/dist/getThemeOverrides.js +0 -93
  168. package/dist/hocs/withAuthentication.js +0 -72
  169. package/dist/utils/styledPropFuncs.js +0 -88
  170. package/src/components/Button.js +0 -90
  171. package/src/components/Button.test.js +0 -49
  172. package/src/components/CategoryList.js +0 -140
  173. package/src/components/CategoryList.test.js +0 -667
  174. package/src/components/Checkbox.js +0 -63
  175. package/src/components/Checkbox.test.js +0 -122
  176. package/src/components/Icon.js +0 -18
  177. package/src/components/IconButton.js +0 -30
  178. package/src/components/IconButton.test.js +0 -61
  179. package/src/components/Input.js +0 -35
  180. package/src/components/Input.test.js +0 -34
  181. package/src/components/List/DataCell.js +0 -77
  182. package/src/components/List/DataCell.test.js +0 -357
  183. package/src/components/List/HeadCell.js +0 -105
  184. package/src/components/List/HeadCell.test.js +0 -331
  185. package/src/components/List/HeadRow.js +0 -21
  186. package/src/components/List/HeadRow.test.js +0 -27
  187. package/src/components/List/List.js +0 -162
  188. package/src/components/List/List.test.js +0 -705
  189. package/src/components/List/Row.js +0 -72
  190. package/src/components/List/Row.test.js +0 -194
  191. package/src/components/List/enhanceColumnDefs.js +0 -54
  192. package/src/components/List/enhanceColumnDefs.test.js +0 -179
  193. package/src/components/List/index.js +0 -6
  194. package/src/components/Modal/Background.js +0 -10
  195. package/src/components/Modal/Dialog.js +0 -27
  196. package/src/components/Modal/Dialog.test.js +0 -20
  197. package/src/components/Modal/Modal.test.js +0 -52
  198. package/src/components/Modal/Wrapper.js +0 -32
  199. package/src/components/Modal/Wrapper.test.js +0 -55
  200. package/src/components/Modal/index.js +0 -22
  201. package/src/components/MultiSelector.js +0 -104
  202. package/src/components/MultiSelector.test.js +0 -348
  203. package/src/components/Navigation/Bar.js +0 -212
  204. package/src/components/Navigation/Bar.test.js +0 -552
  205. package/src/components/Navigation/Tab.js +0 -156
  206. package/src/components/Navigation/Tab.test.js +0 -404
  207. package/src/components/Placeholder.js +0 -61
  208. package/src/components/Placeholder.test.js +0 -106
  209. package/src/components/Scope/Selector.js +0 -70
  210. package/src/components/Scope/Selector.test.js +0 -138
  211. package/src/components/Selector.js +0 -191
  212. package/src/components/Selector.test.js +0 -157
  213. package/src/components/Switch.js +0 -112
  214. package/src/components/Switch.test.js +0 -130
  215. package/src/components/Text.test.js +0 -132
  216. package/src/components/Toolbar.js +0 -178
  217. package/src/components/Toolbar.test.js +0 -478
  218. package/src/components/Tooltip.js +0 -51
  219. package/src/components/Tooltip.test.js +0 -21
  220. package/src/getTheme.js +0 -103
  221. package/src/getTheme.test.js +0 -92
  222. package/src/getThemeOverrides.js +0 -27
  223. package/src/hocs/withAuthentication.js +0 -18
  224. package/src/hocs/withAuthentication.test.js +0 -120
  225. package/src/utils/styledPropFuncs.js +0 -20
  226. package/src/utils/styledPropFuncs.test.js +0 -166
@@ -73,7 +73,7 @@ const useStyles = makeStyles(theme => ({
73
73
  },
74
74
  active: {
75
75
  backgroundColor: `${theme.palette.primary.dark} !important`,
76
- boxShadow: "inset 10px 0 10px 1px rgba(0,0,0,0.18)",
76
+ boxShadow: `inset ${theme.spacing(1, 0, 1, 0.1)} rgba(0,0,0,0.18)`,
77
77
 
78
78
  "&:after": {
79
79
  borderLeftColor: `${theme.palette.primary.dark} !important`,
@@ -165,7 +165,7 @@ const StepperModal = ({
165
165
  <FormattedMessage {...sharedMessages.cancel} />
166
166
  </Button>
167
167
 
168
- {(currentStep < steps.length - 1 || steps[currentStep]?.isIntermediate) &&
168
+ {currentStep < steps.length - 1 &&
169
169
  (steps[currentStep]?.actions?.length > 0 ? (
170
170
  steps[currentStep].actions.map(action => (
171
171
  <Button
@@ -191,7 +191,7 @@ const StepperModal = ({
191
191
  </Button>
192
192
  ))}
193
193
 
194
- {currentStep === steps.length - 1 && !steps[currentStep]?.isIntermediate && (
194
+ {currentStep === steps.length - 1 && (
195
195
  <Button
196
196
  variant="contained"
197
197
  color="primary"
@@ -335,80 +335,6 @@ describe("StepperModal", () => {
335
335
  expect(okCallback, "was called");
336
336
  });
337
337
 
338
- it("Renders StepperModal correctly without confirm button for an intermediate step", () => {
339
- const open = true;
340
- const title = "title";
341
- const backdropClickCallback = jest.fn();
342
- const okCallback = jest.fn();
343
- const cancelCallback = jest.fn();
344
- const modalProps = new ModalProps();
345
- const actions = [
346
- {
347
- value: "first value",
348
- label: "first action",
349
- Handler: () => {},
350
- },
351
- {
352
- value: "second value",
353
- label: "second action",
354
- Handler: () => {},
355
- },
356
- ];
357
- const steps = [{ title: "step1", content: <div>content</div>, actions, isIntermediate: true }];
358
-
359
- const titleComponent = (
360
- <div>
361
- <div>{title}</div>
362
- <div>step1</div>
363
- </div>
364
- );
365
- const messageComponent = <div>{steps[0].content}</div>;
366
-
367
- modalProps.set(ModalProps.propNames.title, titleComponent);
368
- modalProps.set(ModalProps.propNames.open, open);
369
- modalProps.set(ModalProps.propNames.backdropClickCallback, backdropClickCallback);
370
- modalProps.set(ModalProps.propNames.type, "wide");
371
-
372
- const actionPanel = (
373
- <div>
374
- <div></div>
375
- <div>
376
- <Button variant="outlined" disabled={false} onClick={() => cancelCallback()}>
377
- {sharedMessages.cancel.defaultMessage}
378
- </Button>
379
- <Button variant="contained" color="primary" disabled={false} onClick={() => {}} disableElevation>
380
- first action
381
- </Button>
382
- <Button variant="contained" color="primary" disabled={false} onClick={() => {}} disableElevation>
383
- second action
384
- </Button>
385
- </div>
386
- </div>
387
- );
388
-
389
- modalProps.set(ModalProps.propNames.actionPanel, actionPanel);
390
-
391
- const component = (
392
- <IntlProvider locale="en-US" messages={messages}>
393
- <StepperModal
394
- steps={steps}
395
- title={title}
396
- open={open}
397
- confirmCallback={okCallback}
398
- closeCallback={cancelCallback}
399
- />
400
- </IntlProvider>
401
- );
402
-
403
- const expected = (
404
- <IntlProvider locale="en-US" messages={messages}>
405
- <Modal message={messageComponent} modalProps={modalProps} />
406
- </IntlProvider>
407
- );
408
-
409
- expect(component, "when mounted", "to satisfy", expected);
410
- });
411
-
412
338
  it("Render closed modal", () => {
413
339
  const open = false;
414
340
 
@@ -50,9 +50,7 @@ describe("Translations ", () => {
50
50
  <div>
51
51
  <div>
52
52
  <label>{"en-US"}</label>
53
- <div>
54
- <InputBase />
55
- </div>
53
+ <InputBase />
56
54
  </div>
57
55
  </div>
58
56
  </div>
@@ -63,9 +61,7 @@ describe("Translations ", () => {
63
61
  <div>
64
62
  <div>
65
63
  <label>{"en-CA"}</label>
66
- <div>
67
- <InputBase />
68
- </div>
64
+ <InputBase />
69
65
  </div>
70
66
  </div>
71
67
  </div>,
@@ -73,9 +69,7 @@ describe("Translations ", () => {
73
69
  <div>
74
70
  <div>
75
71
  <label>{"fr-CA"}</label>
76
- <div>
77
- <InputBase />
78
- </div>
72
+ <InputBase />
79
73
  </div>
80
74
  </div>
81
75
  </div>,
@@ -108,9 +102,7 @@ describe("Translations ", () => {
108
102
  <div>
109
103
  <div>
110
104
  <label>{"en-US"}</label>
111
- <div>
112
- <InputBase />
113
- </div>
105
+ <InputBase />
114
106
  </div>
115
107
  <div>{aError}</div>
116
108
  </div>
@@ -122,9 +114,7 @@ describe("Translations ", () => {
122
114
  <div>
123
115
  <div>
124
116
  <label>{"en-CA"}</label>
125
- <div>
126
- <InputBase />
127
- </div>
117
+ <InputBase />
128
118
  </div>
129
119
  </div>
130
120
  </div>,
@@ -132,9 +122,7 @@ describe("Translations ", () => {
132
122
  <div>
133
123
  <div>
134
124
  <label>{"fr-CA"}</label>
135
- <div>
136
- <InputBase />
137
- </div>
125
+ <InputBase />
138
126
  </div>
139
127
  </div>
140
128
  </div>,
@@ -29,7 +29,7 @@ const useStyles = makeStyles(theme => ({
29
29
  },
30
30
  "&::-webkit-scrollbar-thumb": {
31
31
  background: theme.palette.grey.borders,
32
- border: `5px white solid`,
32
+ border: `${theme.spacing(0.5)} white solid`,
33
33
  backgroundClip: "padding-box",
34
34
  borderRadius: theme.spacing(1.5),
35
35
  },
@@ -352,7 +352,11 @@ const DefaultFullTable = React.forwardRef((props, ref) => {
352
352
  context={props.context}
353
353
  />
354
354
  </TableMui>
355
- {props.tableRows.length > 0 ? null : <div className={props.classes.placeholder}>{props.placeholder}</div>}
355
+ {props.tableRows.length > 0 ? null : (
356
+ <div className={classNames(props.classes.placeholder, props.customClasses.placeholderContainer)}>
357
+ {props.placeholder}
358
+ </div>
359
+ )}
356
360
  </div>
357
361
  );
358
362
  });
@@ -441,6 +445,7 @@ const Table = React.forwardRef(
441
445
  customClasses["tableCell"] = tableProps?.getStyle(TableProps.ruleNames.tableCell) || null;
442
446
  customClasses["headerCell"] = tableProps?.getStyle(TableProps.ruleNames.headerCell) || null;
443
447
  customClasses["tableContainer"] = tableProps?.getStyle(TableProps.ruleNames.tableContainer) || null;
448
+ customClasses["placeholderContainer"] = tableProps?.getStyle(TableProps.ruleNames.placeholderContainer) || null;
444
449
  customClasses["container"] = tableProps?.getStyle(TableProps.ruleNames.container) || null;
445
450
  customClasses["table"] = tableProps?.getStyle(TableProps.ruleNames.table) || null;
446
451
 
@@ -8,7 +8,7 @@ import TableMui from "@material-ui/core/Table";
8
8
  import TableHead from "@material-ui/core/TableHead";
9
9
  import TableRow from "@material-ui/core/TableRow";
10
10
  import { buildHeaderAndRowFromConfig } from "./tableHelpers";
11
- import Placeholder from "../../Placeholder";
11
+ import Placeholder from "./PredefinedElements/Placeholder";
12
12
  import TableInfoBar from "./PredefinedElements/TableInfoBar";
13
13
  import { ignoreConsoleError } from "../../../utils/testUtils";
14
14
  import TableProps from "./TableProps";
@@ -1102,6 +1102,26 @@ describe("Table", () => {
1102
1102
  expect(placeHolder.length, "to equal", 1);
1103
1103
  });
1104
1104
 
1105
+ it("Renders Table with placeholder and custom class if rows are empty", () => {
1106
+ const { headers, rows } = buildHeaderAndRowFromConfig(config, []);
1107
+
1108
+ const placeholder = <Placeholder />;
1109
+
1110
+ const tableProps = new TableProps();
1111
+ tableProps.setStyle(TableProps.ruleNames.placeholderContainer, "placeholder-container-custom-class");
1112
+
1113
+ const component = <Table rows={rows} headers={headers} placeholder={placeholder} tableProps={tableProps} />;
1114
+
1115
+ const mountedComponent = mount(component);
1116
+
1117
+ const placeHolder = mountedComponent.find(Placeholder);
1118
+ expect(placeHolder.exists(), "to be true");
1119
+
1120
+ const placeholderContainer = placeHolder.parent();
1121
+ expect(placeholderContainer.exists(), "to be true");
1122
+ expect(placeholderContainer.hasClass("placeholder-container-custom-class"), "to be true");
1123
+ });
1124
+
1105
1125
  it("Renders Table with tableInfo if provided", () => {
1106
1126
  const { headers, rows } = buildHeaderAndRowFromConfig(config, []);
1107
1127
 
@@ -24,6 +24,7 @@ class TableProps extends ComponentProps {
24
24
  tableContainer: "tableContainer",
25
25
  container: "container",
26
26
  table: "table",
27
+ placeholderContainer: "placeholderContainer",
27
28
  };
28
29
 
29
30
  constructor() {
@@ -47,6 +48,7 @@ class TableProps extends ComponentProps {
47
48
  this.componentClasses.set(this.constructor.ruleNames.tableCell, null);
48
49
  this.componentClasses.set(this.constructor.ruleNames.headerCell, null);
49
50
  this.componentClasses.set(this.constructor.ruleNames.tableContainer, null);
51
+ this.componentClasses.set(this.constructor.ruleNames.placeholderContainer, null);
50
52
  this.componentClasses.set(this.constructor.ruleNames.container, null);
51
53
  this.componentClasses.set(this.constructor.ruleNames.table, null);
52
54
 
@@ -12,7 +12,16 @@ describe("TableProps Props", () => {
12
12
  "constrained",
13
13
  ];
14
14
 
15
- const ruleNames = ["tableHeader", "tableRow", "tableCell", "headerCell", "tableContainer", "container", "table"];
15
+ const ruleNames = [
16
+ "tableHeader",
17
+ "tableRow",
18
+ "tableCell",
19
+ "headerCell",
20
+ "tableContainer",
21
+ "placeholderContainer",
22
+ "container",
23
+ "table",
24
+ ];
16
25
 
17
26
  expect(TableProps.propNames, "to have keys", propNames);
18
27
  expect(TableProps.ruleNames, "to have keys", ruleNames);
@@ -34,7 +43,16 @@ describe("TableProps Props", () => {
34
43
  "saveScrollbarPosition",
35
44
  ];
36
45
 
37
- const ruleNames = ["tableHeader", "tableRow", "tableCell", "headerCell", "tableContainer", "container", "table"];
46
+ const ruleNames = [
47
+ "tableHeader",
48
+ "tableRow",
49
+ "tableCell",
50
+ "headerCell",
51
+ "tableContainer",
52
+ "placeholderContainer",
53
+ "container",
54
+ "table",
55
+ ];
38
56
 
39
57
  const tableProps = new TableProps();
40
58
 
@@ -30,7 +30,7 @@ const useStyles = makeStyles(theme => ({
30
30
  },
31
31
  "&::-webkit-scrollbar-thumb": {
32
32
  background: theme.palette.grey.borders,
33
- border: `5px white solid`,
33
+ border: `${theme.spacing(0.5)} white solid`,
34
34
  backgroundClip: "padding-box",
35
35
  borderRadius: theme.spacing(1.5),
36
36
  },
@@ -16,7 +16,7 @@ const useStyles = makeStyles(theme => ({
16
16
  display: "flex",
17
17
  flexDirection: props => (props.row ? "row" : "column"),
18
18
  flexWrap: "wrap",
19
- marginLeft: "8px",
19
+ marginLeft: theme.spacing(0.8),
20
20
  },
21
21
  errorText: {
22
22
  marginTop: theme.spacing(0.5),
@@ -27,7 +27,7 @@ const useStyles = makeStyles(theme => ({
27
27
  "&:focus, &:focus-within": {
28
28
  borderRadius: theme.shape.borderRadius,
29
29
  borderColor: theme.palette.focus,
30
- boxShadow: `0 0 4px ${theme.palette.focus}`,
30
+ boxShadow: `0 0 ${theme.spacing(0.4)} ${theme.palette.focus}`,
31
31
  outline: "none",
32
32
  },
33
33
  "& .react-datepicker": {
@@ -5,8 +5,6 @@ import InputBaseProps, { isInputProps } from "./InputBaseProps";
5
5
  import classNames from "classnames";
6
6
  import { NumericFormat, numericFormatter } from "react-number-format";
7
7
  import { trimSpacesAndLeadingZeros } from "../../../utils/inputHelper";
8
- import Icon from "../DataDisplay/Icon";
9
- import IconButton from "@material-ui/core/IconButton";
10
8
 
11
9
  export const useStyles = makeStyles(theme => ({
12
10
  container: {
@@ -41,25 +39,11 @@ export const useStyles = makeStyles(theme => ({
41
39
  maxWidth: "unset",
42
40
  minWidth: 0,
43
41
  border: `${theme.spacing(0.1)} solid ${theme.palette.grey.borders}`,
44
- borderRadius: props => {
45
- const topLeft = props.label ? 0 : 0.5;
46
- const topRight = props.isAdvancedNumericInput ? 0 : 0.5;
47
- const bottomRight = topRight;
48
- const bottomLeft = topLeft;
49
-
50
- return theme.spacing(topLeft, topRight, bottomRight, bottomLeft);
51
- },
42
+ borderRadius: props => (props.label ? theme.spacing(0, 0.5, 0.5, 0) : theme.spacing(0.5)),
52
43
  paddingLeft: theme.spacing(0.85),
53
44
  "&:focus, &:active": {
54
45
  border: `${theme.spacing(0.1)} solid ${theme.palette.focus}`,
55
- borderRadius: props => {
56
- const topLeft = props.label ? 0 : 0.5;
57
- const topRight = props.isAdvancedNumericInput ? 0 : 0.5;
58
- const bottomRight = topRight;
59
- const bottomLeft = topLeft;
60
-
61
- return theme.spacing(topLeft, topRight, bottomRight, bottomLeft);
62
- },
46
+ borderRadius: props => (props.label ? theme.spacing(0, 0.5, 0.5, 0) : theme.spacing(0.5)),
63
47
  },
64
48
  },
65
49
  errorInput: {
@@ -95,41 +79,6 @@ export const useStyles = makeStyles(theme => ({
95
79
  inputMultiline: {
96
80
  padding: theme.spacing(0.6, 0.6, 0.6, 0.85),
97
81
  },
98
- numericSpinnerContainer: {
99
- display: "flex",
100
- backgroundColor: theme.palette.grey.light,
101
- flexDirection: "column",
102
- borderTopLeftRadius: 0,
103
- borderBottomLeftRadius: 0,
104
- borderTopRightRadius: theme.shape.borderRadius,
105
- borderBottomRightRadius: theme.shape.borderRadius,
106
- border: `${theme.spacing(0.1)} solid ${theme.palette.grey.borders}`,
107
- padding: 0,
108
- margin: "0 0 0 -1px",
109
- },
110
- numericSpinnerUp: {
111
- fontSize: "8px",
112
- padding: "0 3px",
113
- borderBottom: "1px solid #CCCCCC",
114
- borderRadius: 0,
115
- flex: 1,
116
- margin: 0,
117
- width: "20px",
118
- "& + .MuiButton-root, & + .MuiIconButton-root, & + .MuiInputBase-root": {
119
- marginLeft: 0,
120
- },
121
- },
122
- numericSpinnerDown: {
123
- fontSize: "8px",
124
- padding: "0 3px",
125
- borderRadius: 0,
126
- flex: 1,
127
- margin: 0,
128
- marginLeft: 0,
129
- "& + .MuiButton-root, & + .MuiIconButton-root, & + .MuiInputBase-root": {
130
- marginLeft: 0,
131
- },
132
- },
133
82
  }));
134
83
 
135
84
  export const AdvancedNumericInput = props => {
@@ -180,13 +129,6 @@ const InputBase = ({ inputProps }) => {
180
129
  const isAdvancedNumericInput = type.toLowerCase() === "advancednumericinput";
181
130
  const inputComponent = isAdvancedNumericInput ? AdvancedNumericInput : undefined;
182
131
  const inputControlType = isAdvancedNumericInput ? "text" : type;
183
- const [inputText, setInputText] = React.useState(null);
184
- const textToDisplay = inputText ?? value;
185
- const classes = useStyles({ label, errorPosition, isAdvancedNumericInput });
186
-
187
- let controlSpecificSuffix = null;
188
- let onKeyDown = null;
189
- let onWheel = null;
190
132
 
191
133
  if (isAdvancedNumericInput && numericInputProps) {
192
134
  Object.keys(numericInputProps).forEach(key => {
@@ -215,115 +157,6 @@ const InputBase = ({ inputProps }) => {
215
157
  inputAttributes.isAllowed = val => {
216
158
  return val.value === "" || val.value === "-" || val.value !== null;
217
159
  };
218
-
219
- if (decimalScale === 0 && !disabled) {
220
- const getInitialNumericValue = () => {
221
- if (0 >= inputAttributes.min && 0 <= inputAttributes.max) {
222
- return 0;
223
- }
224
-
225
- if (Math.abs(inputAttributes.min) < Math.abs(inputAttributes.max)) {
226
- return inputAttributes.min;
227
- }
228
-
229
- return inputAttributes.max;
230
- };
231
-
232
- const increaseNumericValue = () => {
233
- if (textToDisplay) {
234
- const currentValue = parseInt(textToDisplay, 10);
235
- if (currentValue + 1 <= inputAttributes.max) {
236
- setInputText((currentValue + 1).toString());
237
- }
238
- } else {
239
- let currentValue = getInitialNumericValue();
240
- if (currentValue === 0 && currentValue + 1 <= inputAttributes.max) {
241
- currentValue++;
242
- }
243
- setInputText(currentValue.toString());
244
- }
245
- };
246
- const decreaseNumericValue = () => {
247
- if (textToDisplay) {
248
- const currentValue = parseInt(textToDisplay, 10);
249
- if (currentValue - 1 >= inputAttributes.min) {
250
- setInputText((currentValue - 1).toString());
251
- }
252
- } else {
253
- let currentValue = getInitialNumericValue();
254
- if (currentValue === 0 && currentValue - 1 >= inputAttributes.min) {
255
- currentValue--;
256
- }
257
- setInputText(currentValue.toString());
258
- }
259
- };
260
-
261
- const focusInput = target => {
262
- target.closest(".InputBase-input-wrapper").getElementsByTagName("input")[0].focus();
263
- };
264
-
265
- controlSpecificSuffix = (
266
- <div className={classes.numericSpinnerContainer}>
267
- <IconButton
268
- className={classes.numericSpinnerUp}
269
- tabIndex="-1"
270
- data-qa="increase"
271
- disabled={disabled}
272
- onMouseDown={event => event.preventDefault()} // prevent the button from stealing focus
273
- onClick={event => {
274
- event.preventDefault();
275
- event.stopPropagation();
276
- increaseNumericValue();
277
- focusInput(event.target);
278
- }}
279
- >
280
- <Icon id="chevron-up" />
281
- </IconButton>
282
-
283
- <IconButton
284
- className={classes.numericSpinnerDown}
285
- tabIndex="-1"
286
- data-qa="decrease"
287
- disabled={disabled}
288
- onMouseDown={event => event.preventDefault()} // prevent the button from stealing focus
289
- onClick={event => {
290
- event.preventDefault();
291
- event.stopPropagation();
292
- decreaseNumericValue();
293
- focusInput(event.target);
294
- }}
295
- >
296
- <Icon id="chevron-down" />
297
- </IconButton>
298
- </div>
299
- );
300
-
301
- onKeyDown = event => {
302
- if (event.key === "ArrowUp") {
303
- event.preventDefault();
304
- event.stopPropagation();
305
-
306
- increaseNumericValue();
307
- }
308
- // Note Alex20260119: using an 'else if' caused issue with code coverage
309
- if (event.key === "ArrowDown") {
310
- event.preventDefault();
311
- event.stopPropagation();
312
-
313
- decreaseNumericValue();
314
- }
315
- };
316
-
317
- onWheel = event => {
318
- if (event.deltaY < 0) {
319
- increaseNumericValue();
320
- } else {
321
- decreaseNumericValue();
322
- }
323
-
324
- focusInput(event.target);
325
- };
326
- }
327
160
  }
328
161
 
329
162
  const defaultRows = 4;
@@ -337,6 +170,7 @@ const InputBase = ({ inputProps }) => {
337
170
  // causing onBlur to never fire
338
171
  item.target.focus();
339
172
  };
173
+ const classes = useStyles({ label, errorPosition });
340
174
 
341
175
  const onChangeHandler = event => {
342
176
  if (event.persist) {
@@ -388,6 +222,8 @@ const InputBase = ({ inputProps }) => {
388
222
 
389
223
  const inputBaseInputStyle = inputProps?.getStyle(InputBaseProps.ruleNames.input);
390
224
  const errorTextStyle = inputProps?.getStyle(InputBaseProps.ruleNames.errorText);
225
+ const [inputText, setInputText] = React.useState(null);
226
+ const textToDisplay = inputText ?? value;
391
227
 
392
228
  React.useEffect(() => {
393
229
  if (inputText === null || window.bypassDebounce === true) {
@@ -413,55 +249,36 @@ const InputBase = ({ inputProps }) => {
413
249
  // eslint-disable-next-line react-hooks/exhaustive-deps
414
250
  }, [inputText, metadata, timeoutDelay, update, value]);
415
251
 
416
- if (onKeyDown) {
417
- if (inputAttributes.onKeyDown) {
418
- const originalKeyDown = inputAttributes.onKeyDown;
419
- inputAttributes.onKeyDown = event => {
420
- originalKeyDown(event);
421
-
422
- if (!event.isDefaultPrevented()) {
423
- onKeyDown(event);
424
- }
425
- };
426
- } else {
427
- inputAttributes.onKeyDown = onKeyDown;
428
- }
429
- }
430
-
431
252
  return (
432
253
  <div className={classes.container}>
433
254
  <div className={classes.inputContainer}>
434
255
  {label && <label className={`${classes.prepend} ${disabled && classes.disabledPrepend}`}>{label}</label>}
435
- <div style={{ display: "flex" }} className="InputBase-input-wrapper">
436
- <InputBaseMUI
437
- classes={{
438
- input: classNames(classes.controlInput, inputBaseInputStyle),
439
- error: classes.errorInput,
440
- disabled: classes.disabled,
441
- multiline: classes.multiline,
442
- inputMultiline: classes.inputMultiline,
443
- }}
444
- onBlur={onBlurInternal}
445
- onClick={onClick}
446
- type={inputControlType}
447
- placeholder={placeholder}
448
- value={textToDisplay}
449
- fullWidth={true}
450
- onWheel={onWheel}
451
- onChange={event => onChangeHandler(event)}
452
- error={!!error}
453
- inputProps={inputAttributes}
454
- inputComponent={inputComponent}
455
- disabled={disabled}
456
- multiline={multiline}
457
- startAdornment={startAdornment}
458
- endAdornment={endAdornment}
459
- minRows={rows}
460
- title={tooltipText}
461
- autoComplete={autoComplete}
462
- />
463
- {controlSpecificSuffix}
464
- </div>
256
+ <InputBaseMUI
257
+ classes={{
258
+ input: classNames(classes.controlInput, inputBaseInputStyle),
259
+ error: classes.errorInput,
260
+ disabled: classes.disabled,
261
+ multiline: classes.multiline,
262
+ inputMultiline: classes.inputMultiline,
263
+ }}
264
+ onBlur={onBlurInternal}
265
+ onClick={onClick}
266
+ type={inputControlType}
267
+ placeholder={placeholder}
268
+ value={textToDisplay}
269
+ fullWidth={true}
270
+ onChange={event => onChangeHandler(event)}
271
+ error={!!error}
272
+ inputProps={inputAttributes}
273
+ inputComponent={inputComponent}
274
+ disabled={disabled}
275
+ multiline={multiline}
276
+ startAdornment={startAdornment}
277
+ endAdornment={endAdornment}
278
+ minRows={rows}
279
+ title={tooltipText}
280
+ autoComplete={autoComplete}
281
+ />
465
282
  </div>
466
283
  {error && <div className={classNames(classes.errorText, errorTextStyle)}>{error}</div>}
467
284
  </div>