@teselagen/ui 0.0.11 → 0.0.13

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 (125) hide show
  1. package/README.md +7 -0
  2. package/cypress.config.ts +6 -0
  3. package/index.html +12 -0
  4. package/package.json +5 -11
  5. package/project.json +74 -0
  6. package/src/AdvancedOptions.js +33 -0
  7. package/src/AdvancedOptions.spec.js +24 -0
  8. package/src/AssignDefaultsModeContext.js +21 -0
  9. package/src/AsyncValidateFieldSpinner/index.js +12 -0
  10. package/src/BlueprintError/index.js +14 -0
  11. package/src/BounceLoader/index.js +16 -0
  12. package/src/BounceLoader/style.css +45 -0
  13. package/src/CollapsibleCard/index.js +92 -0
  14. package/src/CollapsibleCard/style.css +21 -0
  15. package/src/DNALoader/index.js +20 -0
  16. package/src/DNALoader/style.css +251 -0
  17. package/src/DataTable/CellDragHandle.js +130 -0
  18. package/src/DataTable/DisabledLoadingComponent.js +15 -0
  19. package/src/DataTable/DisplayOptions.js +218 -0
  20. package/src/DataTable/FilterAndSortMenu.js +397 -0
  21. package/src/DataTable/PagingTool.js +232 -0
  22. package/src/DataTable/SearchBar.js +57 -0
  23. package/src/DataTable/SortableColumns.js +53 -0
  24. package/src/DataTable/TableFormTrackerContext.js +10 -0
  25. package/src/DataTable/dataTableEnhancer.js +291 -0
  26. package/src/DataTable/defaultFormatters.js +32 -0
  27. package/src/DataTable/defaultProps.js +45 -0
  28. package/src/DataTable/defaultValidators.js +40 -0
  29. package/src/DataTable/editCellHelper.js +44 -0
  30. package/src/DataTable/getCellVal.js +20 -0
  31. package/src/DataTable/getVals.js +8 -0
  32. package/src/DataTable/index.js +3537 -0
  33. package/src/DataTable/isTruthy.js +12 -0
  34. package/src/DataTable/isValueEmpty.js +3 -0
  35. package/src/DataTable/style.css +600 -0
  36. package/src/DataTable/utils/computePresets.js +42 -0
  37. package/src/DataTable/utils/convertSchema.js +69 -0
  38. package/src/DataTable/utils/getIdOrCodeOrIndex.js +9 -0
  39. package/src/DataTable/utils/getTableConfigFromStorage.js +5 -0
  40. package/src/DataTable/utils/queryParams.js +1032 -0
  41. package/src/DataTable/utils/rowClick.js +156 -0
  42. package/src/DataTable/utils/selection.js +8 -0
  43. package/src/DataTable/utils/withSelectedEntities.js +65 -0
  44. package/src/DataTable/utils/withTableParams.js +328 -0
  45. package/src/DataTable/validateTableWideErrors.js +135 -0
  46. package/src/DataTable/viewColumn.js +37 -0
  47. package/src/DialogFooter/index.js +79 -0
  48. package/src/DialogFooter/style.css +9 -0
  49. package/src/DropdownButton.js +36 -0
  50. package/src/FillWindow.css +6 -0
  51. package/src/FillWindow.js +69 -0
  52. package/src/FormComponents/Uploader.js +1197 -0
  53. package/src/FormComponents/getNewName.js +31 -0
  54. package/src/FormComponents/index.js +1384 -0
  55. package/src/FormComponents/itemUpload.js +84 -0
  56. package/src/FormComponents/sortify.js +73 -0
  57. package/src/FormComponents/style.css +247 -0
  58. package/src/FormComponents/tryToMatchSchemas.js +222 -0
  59. package/src/FormComponents/utils.js +6 -0
  60. package/src/HotkeysDialog/index.js +79 -0
  61. package/src/HotkeysDialog/style.css +54 -0
  62. package/src/InfoHelper/index.js +83 -0
  63. package/src/InfoHelper/style.css +7 -0
  64. package/src/IntentText/index.js +18 -0
  65. package/src/Loading/index.js +74 -0
  66. package/src/Loading/style.css +4 -0
  67. package/src/MatchHeaders.js +223 -0
  68. package/src/MenuBar/index.js +416 -0
  69. package/src/MenuBar/style.css +45 -0
  70. package/src/PromptUnsavedChanges/index.js +40 -0
  71. package/src/ResizableDraggableDialog/index.js +138 -0
  72. package/src/ResizableDraggableDialog/style.css +42 -0
  73. package/src/ScrollToTop/index.js +72 -0
  74. package/src/SimpleStepViz.js +26 -0
  75. package/src/TgSelect/index.js +465 -0
  76. package/src/TgSelect/style.css +34 -0
  77. package/src/TgSuggest/index.js +121 -0
  78. package/src/Timeline/TimelineEvent.js +31 -0
  79. package/src/Timeline/index.js +22 -0
  80. package/src/Timeline/style.css +29 -0
  81. package/src/UploadCsvWizard.css +4 -0
  82. package/src/UploadCsvWizard.js +731 -0
  83. package/src/autoTooltip.js +89 -0
  84. package/src/constants.js +1 -0
  85. package/src/customIcons.js +361 -0
  86. package/src/enhancers/withDialog/index.js +196 -0
  87. package/src/enhancers/withDialog/tg_modalState.js +46 -0
  88. package/src/enhancers/withField.js +20 -0
  89. package/src/enhancers/withFields.js +11 -0
  90. package/src/enhancers/withLocalStorage.js +11 -0
  91. package/src/index.js +76 -0
  92. package/src/rerenderOnWindowResize.js +27 -0
  93. package/src/showAppSpinner.js +12 -0
  94. package/src/showConfirmationDialog/index.js +116 -0
  95. package/src/showDialogOnDocBody.js +37 -0
  96. package/src/style.css +214 -0
  97. package/src/toastr.js +92 -0
  98. package/src/typeToCommonType.js +6 -0
  99. package/src/useDialog.js +64 -0
  100. package/src/utils/S3Download.js +14 -0
  101. package/src/utils/adHoc.js +10 -0
  102. package/src/utils/basicHandleActionsWithFullState.js +14 -0
  103. package/src/utils/combineReducersWithFullState.js +14 -0
  104. package/src/utils/commandControls.js +83 -0
  105. package/src/utils/commandUtils.js +112 -0
  106. package/src/utils/determineBlackOrWhiteTextColor.js +4 -0
  107. package/src/utils/getDayjsFormatter.js +35 -0
  108. package/src/utils/getTextFromEl.js +28 -0
  109. package/src/utils/handlerHelpers.js +30 -0
  110. package/src/utils/hotkeyUtils.js +129 -0
  111. package/src/utils/menuUtils.js +402 -0
  112. package/src/utils/popoverOverflowModifiers.js +11 -0
  113. package/src/utils/pureNoFunc.js +31 -0
  114. package/src/utils/renderOnDoc.js +29 -0
  115. package/src/utils/showProgressToast.js +22 -0
  116. package/src/utils/tagUtils.js +45 -0
  117. package/src/utils/tgFormValues.js +32 -0
  118. package/src/utils/withSelectTableRecords.js +38 -0
  119. package/src/utils/withStore.js +10 -0
  120. package/src/wrapDialog.js +112 -0
  121. package/tsconfig.json +4 -0
  122. package/vite.config.ts +7 -0
  123. package/index.mjs +0 -109378
  124. package/index.umd.js +0 -109381
  125. package/style.css +0 -10421
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import { Icon, Button, Tooltip } from "@blueprintjs/core";
3
+
4
+ export const viewColumn = {
5
+ width: 35,
6
+ noEllipsis: true,
7
+ hideInMenu: true,
8
+ immovable: true,
9
+ type: "action",
10
+ render: () => {
11
+ return <Icon className="dt-eyeIcon" icon="eye-open" />;
12
+ }
13
+ };
14
+ export const openColumn = {
15
+ ...viewColumn,
16
+ render: (val, record, rowInfo, props) => {
17
+ return (
18
+ <Tooltip content="Open">
19
+ <Button
20
+ onClick={e => {
21
+ e.stopPropagation();
22
+ props.onDoubleClick &&
23
+ props.onDoubleClick(
24
+ rowInfo.original,
25
+ rowInfo.index,
26
+ props.history
27
+ );
28
+ }}
29
+ minimal
30
+ small
31
+ className="dt-eyeIcon"
32
+ icon="document-open"
33
+ />
34
+ </Tooltip>
35
+ );
36
+ }
37
+ };
@@ -0,0 +1,79 @@
1
+ /* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
2
+
3
+ import React, { useRef } from "react";
4
+ import { Intent, Button, Classes } from "@blueprintjs/core";
5
+ import { noop } from "lodash";
6
+ import classNames from "classnames";
7
+
8
+ function DialogFooter({
9
+ hideModal,
10
+ loading,
11
+ submitting,
12
+ onBackClick,
13
+ style,
14
+ onClick = noop,
15
+ secondaryAction,
16
+ intent = Intent.PRIMARY,
17
+ secondaryIntent,
18
+ backText = "Back",
19
+ secondaryText = "Cancel",
20
+ additionalButtons,
21
+ className,
22
+ secondaryClassName = "",
23
+ text = "Submit",
24
+ disabled,
25
+ containerClassname,
26
+ noCancel
27
+ }) {
28
+ const r = useRef();
29
+ return (
30
+ <div
31
+ style={style}
32
+ ref={r}
33
+ className={classNames(Classes.DIALOG_FOOTER, containerClassname)}
34
+ >
35
+ <div className={Classes.DIALOG_FOOTER_ACTIONS}>
36
+ {onBackClick && (
37
+ <Button
38
+ className={Classes.MINIMAL + " " + secondaryClassName}
39
+ text={backText}
40
+ onClick={onBackClick}
41
+ />
42
+ )}
43
+ {!noCancel && (
44
+ <Button
45
+ intent={secondaryIntent}
46
+ className={Classes.MINIMAL + " " + secondaryClassName}
47
+ text={secondaryText}
48
+ onClick={
49
+ secondaryAction ||
50
+ hideModal ||
51
+ function() {
52
+ try {
53
+ r.current
54
+ .closest(".bp3-dialog")
55
+ .querySelector(".bp3-dialog-close-button")
56
+ .click();
57
+ } catch (error) {
58
+ console.error(`error closing dialog:`, error);
59
+ }
60
+ }
61
+ }
62
+ />
63
+ )}
64
+ {additionalButtons}
65
+ <Button
66
+ text={text}
67
+ intent={intent}
68
+ type="submit"
69
+ className={className}
70
+ onClick={onClick}
71
+ disabled={disabled}
72
+ loading={loading || submitting}
73
+ />
74
+ </div>
75
+ </div>
76
+ );
77
+ }
78
+
79
+ export default DialogFooter;
@@ -0,0 +1,9 @@
1
+ .tg-dialog-footer-error {
2
+ display: flex;
3
+ justify-content: flex-end;
4
+ margin-top: 5;
5
+ }
6
+
7
+ .tg-dialog-footer-error .bp3-form-group {
8
+ margin-bottom: 0;
9
+ }
@@ -0,0 +1,36 @@
1
+ /* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
2
+
3
+ import React from "react";
4
+ import { Button, Popover, Position } from "@blueprintjs/core";
5
+ import classnames from "classnames";
6
+ import popoverOverflowModifiers from "./utils/popoverOverflowModifiers";
7
+
8
+ function DropdownButton({
9
+ disabled,
10
+ menu,
11
+ noRightIcon,
12
+ popoverProps,
13
+ className,
14
+ ...rest
15
+ }) {
16
+ return (
17
+ <Popover
18
+ minimal
19
+ modifiers={popoverOverflowModifiers}
20
+ disabled={disabled}
21
+ autoFocus={false}
22
+ content={menu}
23
+ position={Position.BOTTOM_LEFT}
24
+ {...popoverProps}
25
+ >
26
+ <Button
27
+ disabled={disabled}
28
+ className={classnames(className, "dropdown-button")}
29
+ rightIcon={noRightIcon ? undefined : "caret-down"}
30
+ {...rest}
31
+ />
32
+ </Popover>
33
+ );
34
+ }
35
+
36
+ export default DropdownButton;
@@ -0,0 +1,6 @@
1
+ .tg-fillWindow {
2
+ background: white;
3
+ }
4
+ .bp3-dark .tg-fillWindow {
5
+ background: #293742;
6
+ }
@@ -0,0 +1,69 @@
1
+ import React from "react";
2
+ import { isFunction } from "lodash";
3
+ import reactDom from "react-dom";
4
+ import rerenderOnWindowResize from "./rerenderOnWindowResize";
5
+ import "./FillWindow.css";
6
+
7
+ // use like:
8
+ // <FillWindow>
9
+ // {({ width, height }) => {
10
+ // return <div style={{width, height}}></div>
11
+ // }
12
+ // <FillWindow/>
13
+
14
+ export default class FillWindow extends React.Component {
15
+ constructor(props) {
16
+ super(props);
17
+ rerenderOnWindowResize(this);
18
+ }
19
+ // this is left here for posterity. componentDidMount didn't work before commit ee1853a5ae2e6e27b720dd225650cc2154076db5 "fixing rerenderOnWindowResize to bind this keyword correctly"
20
+ // componentDidMount(){
21
+ // this.setState({thomas: "realCool"})
22
+ // }
23
+
24
+ render() {
25
+ const w = window,
26
+ d = document,
27
+ e = d.documentElement,
28
+ g = d.getElementsByTagName("body")[0],
29
+ width = w.innerWidth || e.clientWidth || g.clientWidth,
30
+ height = w.innerHeight || e.clientHeight || g.clientHeight;
31
+ const windowDimensions = {
32
+ width,
33
+ height
34
+ };
35
+ const {
36
+ containerStyle = {},
37
+ style,
38
+ styleOverrides,
39
+ className,
40
+ asPortal,
41
+ ...rest
42
+ } = this.props;
43
+ if (this.props.disabled) return this.props.children(windowDimensions);
44
+ const inner = (
45
+ <div
46
+ className={
47
+ "tg-fillWindow " + (asPortal ? "bp3-portal " : "") + (className || "")
48
+ }
49
+ style={{
50
+ ...style,
51
+ width,
52
+ height,
53
+ position: "fixed",
54
+ top: 0,
55
+ left: 0,
56
+ ...containerStyle,
57
+ ...styleOverrides
58
+ }}
59
+ {...rest}
60
+ >
61
+ {this.props.children && isFunction(this.props.children)
62
+ ? this.props.children(windowDimensions)
63
+ : this.props.children}
64
+ </div>
65
+ );
66
+ if (asPortal) return reactDom.createPortal(inner, window.document.body);
67
+ return inner;
68
+ }
69
+ }