grep-components 1.7.0-grepf-1608.2 → 1.7.0

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.
@@ -16,6 +16,7 @@ export interface Properties {
16
16
  buttons?: Array<Button>;
17
17
  disableNewlines?: boolean;
18
18
  stripPastedStyles?: boolean;
19
+ blockPasting?: boolean;
19
20
  /**
20
21
  * Undefined: allow all styles.
21
22
  * Empty array: disable all styles.
@@ -1,13 +1,10 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { SxProps } from '@mui/material';
3
2
  export interface LoadingOverlayProps {
4
3
  show: boolean;
5
4
  overlay?: string;
6
5
  children?: ReactNode;
7
6
  minHeight?: number | string;
8
7
  minTime?: number;
9
- zIndex?: number;
10
- sx?: SxProps;
11
8
  }
12
9
  export declare const LoadingOverlay: React.FC<LoadingOverlayProps>;
13
10
  export default LoadingOverlay;
package/dist/index.js CHANGED
@@ -4722,7 +4722,7 @@ var GrepTableCard = function (props) {
4722
4722
  };
4723
4723
 
4724
4724
  var LoadingOverlay = function (_a) {
4725
- var _b = _a.overlay, overlay = _b === void 0 ? 'rgba(255,255,255, .5)' : _b, show = _a.show, children = _a.children, minTime = _a.minTime, zIndex = _a.zIndex, sx = _a.sx, box = __rest$1(_a, ["overlay", "show", "children", "minTime", "zIndex", "sx"]);
4725
+ var _b = _a.overlay, overlay = _b === void 0 ? 'rgba(255,255,255, .5)' : _b, show = _a.show, children = _a.children, minTime = _a.minTime, box = __rest$1(_a, ["overlay", "show", "children", "minTime"]);
4726
4726
  var _c = __read(useState(show), 2), enabled = _c[0], setEnabled = _c[1];
4727
4727
  useEffect(function () {
4728
4728
  var timeout = setTimeout(function () { return setEnabled(show); }, show ? 0 : minTime);
@@ -4730,11 +4730,11 @@ var LoadingOverlay = function (_a) {
4730
4730
  }, [show, minTime, setEnabled]);
4731
4731
  return (React__default.createElement(Box, { position: "relative", display: "block", overflow: show ? 'hidden' : '' },
4732
4732
  children,
4733
- React__default.createElement(Box, __assign({ position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", top: 0, left: 0, height: "100%", width: "100%", zIndex: enabled ? (zIndex ? zIndex : 999) : -999, style: {
4733
+ React__default.createElement(Box, __assign({ position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", top: 0, left: 0, height: "100%", width: "100%", zIndex: enabled ? 999 : -999, style: {
4734
4734
  backgroundColor: overlay,
4735
4735
  opacity: show ? 1 : 0,
4736
4736
  transition: "opacity ".concat(show ? 0 : minTime, "ms ease"),
4737
- }, sx: sx }, box),
4737
+ } }, box),
4738
4738
  React__default.createElement(CircularProgress, null))));
4739
4739
  };
4740
4740
 
@@ -21519,7 +21519,7 @@ var getCharCount = function (editorState) {
21519
21519
  return editorState.getCurrentContent().getPlainText('').length;
21520
21520
  };
21521
21521
  var EditorComponent = function (_a) {
21522
- var label = _a.label, classes = _a.classes, autoFocus = _a.autoFocus, helperText = _a.helperText, showCharCount = _a.showCharCount, allowedStyles = _a.allowedStyles, disableNewlines = _a.disableNewlines, onContentChange = _a.onContentChange, _b = _a.Toolbar, Toolbar = _b === void 0 ? FloatingToolbar : _b, props = __rest$1(_a, ["label", "classes", "autoFocus", "helperText", "showCharCount", "allowedStyles", "disableNewlines", "onContentChange", "Toolbar"]);
21522
+ var label = _a.label, classes = _a.classes, autoFocus = _a.autoFocus, helperText = _a.helperText, showCharCount = _a.showCharCount, allowedStyles = _a.allowedStyles, disableNewlines = _a.disableNewlines, onContentChange = _a.onContentChange, _b = _a.Toolbar, Toolbar = _b === void 0 ? FloatingToolbar : _b, blockPasting = _a.blockPasting, props = __rest$1(_a, ["label", "classes", "autoFocus", "helperText", "showCharCount", "allowedStyles", "disableNewlines", "onContentChange", "Toolbar", "blockPasting"]);
21523
21523
  var _c = useContext(EditorContext), state = _c.state, setState = _c.setState, setSelection = _c.setSelection;
21524
21524
  var ref = useRef();
21525
21525
  var canStyle = allowedStyles === undefined || allowedStyles.length > 0;
@@ -21578,7 +21578,7 @@ var EditorComponent = function (_a) {
21578
21578
  }
21579
21579
  };
21580
21580
  var handlePastedText = function (text, _html, editorState) {
21581
- if (disableNewlines) {
21581
+ if (!blockPasting) {
21582
21582
  onChange(EditorState.push(editorState, Modifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), text.replace(/\n/g, ' ')), 'remove-range'));
21583
21583
  }
21584
21584
  return 'handled';