How to use the @axa-fr/react-toolkit-core.PropsManager.omit function in @axa-fr/react-toolkit-core

To help you get started, we’ve selected a few @axa-fr/react-toolkit-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 AxaGuilDEv / react-toolkit / packages / action / src / ActionCore.tsx View on Github external
export interface ActionCoreProps
  extends React.DetailedHTMLProps<
      React.AnchorHTMLAttributes,
      HTMLAnchorElement
    > {
  icon: string;
  className?: string;
}

const defaultProps: Partial = {
  tabIndex: 0,
  href: '#',
};

const omitProperties = PropsManager.omit(['classModifier']);

const ActionCore: React.FC = ({ icon, ...otherProps }) => (
  <a>
    <i>
  </i></a><i>
);

ActionCore.defaultProps = defaultProps;

const enhance = compose(
  withClassDefault(defaultClassName),
  withClassModifier,
  withProps(({ onClick, href, role }: ActionCoreProps) =&gt; ({
    href: onClick ? '#' : href || undefined,
    role: onClick ? 'button' : role || undefined,
  }))</i>
github AxaGuilDEv / react-toolkit / packages / button / src / ButtonCore.tsx View on Github external
import * as React from 'react';
import {
  PropsManager,
  withClassDefault,
  withClassModifier,
  WithClassModifierOptions,
  compose
} from '@axa-fr/react-toolkit-core';

const DEFAULT_CLASSNAME = 'btn af-btn';

const omitProperties = PropsManager.omit(['classModifier']);

interface ButtonCoreComponentProps
  extends React.DetailedHTMLProps&lt;
      React.ButtonHTMLAttributes,
      HTMLButtonElement
    &gt; {}

const ButtonRaw: React.SFC = props =&gt; {
  const buttonProps: ButtonCoreComponentProps = omitProperties(props);
  return <button>;
};

export type ButtonCoreProps = ButtonCoreComponentProps &amp;
  WithClassModifierOptions;

const enhance = compose(</button>
github AxaGuilDEv / react-toolkit / packages / title / src / Title.tsx View on Github external
PropsManager,
  withClassDefault,
  withClassModifier,
  WithClassModifierOptions,
  compose,
} from '@axa-fr/react-toolkit-core';

const DEFAULT_CLASSNAME = 'af-title';

interface TitleBaseProps extends React.HTMLProps {}

const defaultProps: Partial = {
  children: null,
};

const omitProperties = PropsManager.omit(['classModifier']);

const TitleRaw: React.FC = ({ children, ...otherProps }) =&gt; (
  <h1>{children}</h1>
);

TitleRaw.defaultProps = defaultProps;

interface TitleProps extends WithClassModifierOptions, TitleBaseProps {}

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const Enhanced = enhance(TitleRaw);
Enhanced.displayName = 'Title';
github AxaGuilDEv / react-toolkit / packages / badge / src / Badge.tsx View on Github external
PropsManager,
  withClassDefault,
  withClassModifier,
  WithClassModifierOptions,
  compose,
} from '@axa-fr/react-toolkit-core';

const DEFAULT_CLASSNAME = 'af-badge';

interface BadgeBaseProps extends React.HTMLProps {}

const defaultProps: Partial = {
  children: null,
};

const omitProperties = PropsManager.omit(['classModifier']);

const BadgeRaw: React.SFC = ({ children, ...otherProps }) =&gt; (
  <span>{children}</span>
);

BadgeRaw.defaultProps = defaultProps;

interface BadgeProps extends WithClassModifierOptions, BadgeBaseProps {}

const enhance = compose(
  withClassDefault(DEFAULT_CLASSNAME),
  withClassModifier
);

const Enhanced = enhance(BadgeRaw);
Enhanced.displayName = 'Badge';