How to use the ra-core.warning function in ra-core

To help you get started, we’ve selected a few ra-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marmelab / react-admin / packages / ra-ui-materialui / src / layout / CardActions.tsx View on Github external
const CardActions = ({ className, children, ...rest }) => {
    warning(
        true,
        ' is deprecated. Please use the  component instead to wrap your action buttons'
    );
    const classes = useStyles({}); // the empty {} is a temp fix for https://github.com/mui-org/material-ui/issues/15942
    return (
        <div>
            {children}
        </div>
    );
};
github marmelab / react-admin / packages / ra-ui-materialui / src / layout / Title.js View on Github external
const Title = ({ className, defaultTitle, locale, record, title, ...rest }) =&gt; {
    const translate = useTranslate();
    const container = document.getElementById('react-admin-title');
    if (!container) return null;
    warning(!defaultTitle &amp;&amp; !title, 'Missing title prop in <title> element');

    const titleElement = !title ? (
        &lt;span className={className} {...rest}&gt;
            {defaultTitle}
        &lt;/span&gt;
    ) : typeof title === 'string' ? (
        &lt;span className={className} {...rest}&gt;
            {translate(title, { _: title })}
        &lt;/span&gt;
    ) : (
        createElement(title, { className, record, ...rest })
    );
    return createPortal(titleElement, container);
};
</title>
github bootstrap-styled / ra-ui / src / components / layout / Title.js View on Github external
const Title = ({
  className,
  defaultTitle,
  locale,
  record,
  title,
  translate,
  ...rest
}) =&gt; {
  const container = document.getElementById('react-admin-title');
  if (!container) return null;
  warning(!defaultTitle &amp;&amp; !title, 'Missing title prop in <title> element');

  const titleElement = !title ? (
    &lt;span className={className} {...rest}&gt;
      {defaultTitle}
    &lt;/span&gt;
  ) : typeof title === 'string' ? (
    &lt;span className={className} {...rest}&gt;
      {translate(title, { _: title })}
    &lt;/span&gt;
  ) : (
    React.cloneElement(title, { className, record, ...rest })
  );
  return ReactDOM.createPortal(titleElement, container);
};
</title>
github marmelab / react-admin / packages / ra-ui-materialui / src / input / AutocompleteInput.tsx View on Github external
InputProps: undefined,
    },
    optionText = 'name',
    optionValue = 'id',
    parse,
    resource,
    setFilter,
    shouldRenderSuggestions: shouldRenderSuggestionsOverride,
    source,
    suggestionLimit,
    translateChoice = true,
    validate,
    variant = 'filled',
    ...rest
}) =&gt; {
    warning(
        isValidElement(optionText) &amp;&amp; !matchSuggestion,
        `If the optionText prop is a React element, you must also specify the matchSuggestion prop:
 true}
/&gt;
        `
    );

    const classes = useStyles({ classes: classesOverride });

    let inputEl = useRef();
    let anchorEl = useRef();

    const {
        id,
        input,
github marmelab / react-admin / packages / ra-ui-materialui / src / input / AutocompleteArrayInput.tsx View on Github external
...options
    } = {},
    optionText = 'name',
    optionValue = 'id',
    parse,
    resource,
    setFilter,
    shouldRenderSuggestions: shouldRenderSuggestionsOverride,
    source,
    suggestionLimit,
    translateChoice = true,
    validate,
    variant = 'filled',
    ...rest
}) =&gt; {
    warning(
        isValidElement(optionText) &amp;&amp; !matchSuggestion,
        `If the optionText prop is a React element, you must also specify the matchSuggestion prop:
 true}
/&gt;
        `
    );

    const classes = useStyles({ classes: classesOverride });

    let inputEl = useRef();
    let anchorEl = useRef();

    const {
        id,
        input,