@etsoo/materialui 1.6.47 → 1.6.48

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.
@@ -60,7 +60,6 @@ const IconDialogTitle = (0, styles_1.styled)(DialogTitle_1.default, {
60
60
  `}
61
61
  `;
62
62
  const setError = (div, error) => {
63
- console.log("setError", error, div == null);
64
63
  if (div == null)
65
64
  return;
66
65
  div.innerText = error ?? "";
@@ -161,7 +160,7 @@ class NotificationMU extends react_2.NotificationReact {
161
160
  throw new Error("Data collector content must be a function component with mRef prop");
162
161
  }
163
162
  const mRef = content.props.mRef;
164
- let errorDiv = null;
163
+ const errorRef = react_1.default.createRef();
165
164
  // Setup callback
166
165
  const options = this.renderSetup ? this.renderSetup({}) : undefined;
167
166
  const handleSubmit = async () => {
@@ -180,16 +179,14 @@ class NotificationMU extends react_2.NotificationReact {
180
179
  return false;
181
180
  }
182
181
  if (typeof v === "string") {
183
- setError(errorDiv, v);
182
+ setError(errorRef.current, v);
184
183
  return false;
185
184
  }
186
185
  }
187
186
  this.dismiss();
188
187
  return true;
189
188
  };
190
- return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent_1.DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { ...inputProps, children: [content, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: (div) => {
191
- errorDiv = div;
192
- }, color: "error", align: "center" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
189
+ return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent_1.DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { ...inputProps, children: [content, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: errorRef, color: "error", align: "center" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
193
190
  if (this.onReturn)
194
191
  this.onReturn(undefined);
195
192
  this.dismiss();
@@ -201,7 +198,7 @@ class NotificationMU extends react_2.NotificationReact {
201
198
  const title = this.title ?? labels.promptTitle;
202
199
  const { buttons, cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton = true, primaryButtonProps, inputProps, closable = false, draggable = fullScreen === true ? false : true } = this.inputProps ?? {};
203
200
  const inputRef = react_1.default.createRef();
204
- let errorDiv = null;
201
+ const errorRef = react_1.default.createRef();
205
202
  const handleSubmit = async (event) => {
206
203
  // Error
207
204
  setError(undefined);
@@ -237,7 +234,7 @@ class NotificationMU extends react_2.NotificationReact {
237
234
  return false;
238
235
  }
239
236
  if (typeof v === "string") {
240
- setError(errorDiv, v);
237
+ setError(errorRef.current, v);
241
238
  input?.focus();
242
239
  return false;
243
240
  }
@@ -273,7 +270,7 @@ class NotificationMU extends react_2.NotificationReact {
273
270
  }
274
271
  }
275
272
  }, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { dividers: true, children: [typeof this.content === "string" ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.default, { children: this.content })) : (this.content), localInputs, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: (div) => {
276
- errorDiv = div;
273
+ console.log("ref", div);
277
274
  }, color: "error", align: "center" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
278
275
  if (this.onReturn)
279
276
  this.onReturn(undefined);
@@ -54,7 +54,6 @@ const IconDialogTitle = styled(DialogTitle, {
54
54
  `}
55
55
  `;
56
56
  const setError = (div, error) => {
57
- console.log("setError", error, div == null);
58
57
  if (div == null)
59
58
  return;
60
59
  div.innerText = error ?? "";
@@ -155,7 +154,7 @@ export class NotificationMU extends NotificationReact {
155
154
  throw new Error("Data collector content must be a function component with mRef prop");
156
155
  }
157
156
  const mRef = content.props.mRef;
158
- let errorDiv = null;
157
+ const errorRef = React.createRef();
159
158
  // Setup callback
160
159
  const options = this.renderSetup ? this.renderSetup({}) : undefined;
161
160
  const handleSubmit = async () => {
@@ -174,16 +173,14 @@ export class NotificationMU extends NotificationReact {
174
173
  return false;
175
174
  }
176
175
  if (typeof v === "string") {
177
- setError(errorDiv, v);
176
+ setError(errorRef.current, v);
178
177
  return false;
179
178
  }
180
179
  }
181
180
  this.dismiss();
182
181
  return true;
183
182
  };
184
- return (_jsxs(Dialog, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [_jsxs(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [_jsx(InfoIcon, { color: "primary" }), _jsx("span", { className: "dialogTitle", children: title }), closable && (_jsx(IconButton, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: _jsx(CloseIcon, {}) }))] }), _jsxs(DialogContent, { ...inputProps, children: [content, _jsx(Typography, { component: "div", variant: "caption", ref: (div) => {
185
- errorDiv = div;
186
- }, color: "error", align: "center" })] }), _jsx(DialogActions, { children: buttons ? (buttons(this, handleSubmit)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(Button, { color: "secondary", onClick: () => {
183
+ return (_jsxs(Dialog, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [_jsxs(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [_jsx(InfoIcon, { color: "primary" }), _jsx("span", { className: "dialogTitle", children: title }), closable && (_jsx(IconButton, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: _jsx(CloseIcon, {}) }))] }), _jsxs(DialogContent, { ...inputProps, children: [content, _jsx(Typography, { component: "div", variant: "caption", ref: errorRef, color: "error", align: "center" })] }), _jsx(DialogActions, { children: buttons ? (buttons(this, handleSubmit)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(Button, { color: "secondary", onClick: () => {
187
184
  if (this.onReturn)
188
185
  this.onReturn(undefined);
189
186
  this.dismiss();
@@ -195,7 +192,7 @@ export class NotificationMU extends NotificationReact {
195
192
  const title = this.title ?? labels.promptTitle;
196
193
  const { buttons, cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton = true, primaryButtonProps, inputProps, closable = false, draggable = fullScreen === true ? false : true } = this.inputProps ?? {};
197
194
  const inputRef = React.createRef();
198
- let errorDiv = null;
195
+ const errorRef = React.createRef();
199
196
  const handleSubmit = async (event) => {
200
197
  // Error
201
198
  setError(undefined);
@@ -231,7 +228,7 @@ export class NotificationMU extends NotificationReact {
231
228
  return false;
232
229
  }
233
230
  if (typeof v === "string") {
234
- setError(errorDiv, v);
231
+ setError(errorRef.current, v);
235
232
  input?.focus();
236
233
  return false;
237
234
  }
@@ -267,7 +264,7 @@ export class NotificationMU extends NotificationReact {
267
264
  }
268
265
  }
269
266
  }, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [_jsxs(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [_jsx(InfoIcon, { color: "primary" }), _jsx("span", { className: "dialogTitle", children: title }), closable && (_jsx(IconButton, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: _jsx(CloseIcon, {}) }))] }), _jsxs(DialogContent, { dividers: true, children: [typeof this.content === "string" ? (_jsx(DialogContentText, { children: this.content })) : (this.content), localInputs, _jsx(Typography, { component: "div", variant: "caption", ref: (div) => {
270
- errorDiv = div;
267
+ console.log("ref", div);
271
268
  }, color: "error", align: "center" })] }), _jsx(DialogActions, { children: buttons ? (buttons(this, handleSubmit)) : (_jsxs(React.Fragment, { children: [cancelButton && (_jsx(Button, { color: "secondary", onClick: () => {
272
269
  if (this.onReturn)
273
270
  this.onReturn(undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.47",
3
+ "version": "1.6.48",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -71,7 +71,6 @@ const IconDialogTitle = styled(DialogTitle, {
71
71
  `;
72
72
 
73
73
  const setError = (div?: HTMLDivElement | null, error?: string) => {
74
- console.log("setError", error, div == null);
75
74
  if (div == null) return;
76
75
  div.innerText = error ?? "";
77
76
  div.style.paddingTop = error ? "8px" : "0px";
@@ -387,7 +386,7 @@ export class NotificationMU extends NotificationReact {
387
386
 
388
387
  const mRef = content.props.mRef;
389
388
 
390
- let errorDiv: HTMLDivElement | null = null;
389
+ const errorRef = React.createRef<HTMLDivElement>();
391
390
 
392
391
  // Setup callback
393
392
  const options = this.renderSetup ? this.renderSetup({}) : undefined;
@@ -412,7 +411,7 @@ export class NotificationMU extends NotificationReact {
412
411
  }
413
412
 
414
413
  if (typeof v === "string") {
415
- setError(errorDiv, v);
414
+ setError(errorRef.current, v);
416
415
  return false;
417
416
  }
418
417
  }
@@ -456,9 +455,7 @@ export class NotificationMU extends NotificationReact {
456
455
  <Typography
457
456
  component="div"
458
457
  variant="caption"
459
- ref={(div) => {
460
- errorDiv = div;
461
- }}
458
+ ref={errorRef}
462
459
  color="error"
463
460
  align="center"
464
461
  />
@@ -520,8 +517,7 @@ export class NotificationMU extends NotificationReact {
520
517
  } = this.inputProps ?? {};
521
518
 
522
519
  const inputRef = React.createRef<HTMLInputElement>();
523
-
524
- let errorDiv: HTMLDivElement | null = null;
520
+ const errorRef = React.createRef<HTMLDivElement>();
525
521
 
526
522
  const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
527
523
  // Error
@@ -565,7 +561,7 @@ export class NotificationMU extends NotificationReact {
565
561
  }
566
562
 
567
563
  if (typeof v === "string") {
568
- setError(errorDiv, v);
564
+ setError(errorRef.current, v);
569
565
  input?.focus();
570
566
  return false;
571
567
  }
@@ -667,7 +663,7 @@ export class NotificationMU extends NotificationReact {
667
663
  component="div"
668
664
  variant="caption"
669
665
  ref={(div) => {
670
- errorDiv = div;
666
+ console.log("ref", div);
671
667
  }}
672
668
  color="error"
673
669
  align="center"