How to use the @axa-fr/react-toolkit-core.Constants.propTypes 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 / popover / src / Popover.js View on Github external
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Constants } from '@axa-fr/react-toolkit-core';
import PopoverBase from './PopoverBase';
import PopoverPlacements from './PopoverPlacements';
import PopoverModes from './PopoverModes';

const propTypes = {
  ...Constants.propTypes,
  title: PropTypes.string,
  children: PropTypes.any,
  placement: PropTypes.oneOf([
    PopoverPlacements.top,
    PopoverPlacements.bottom,
    PopoverPlacements.left,
    PopoverPlacements.right,
  ]),
  mode: PropTypes.oneOf([PopoverModes.over, PopoverModes.click]),
};
const defaultClassName = 'af-popover__container';
const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
  placement: PopoverPlacements.top,
  mode: PopoverModes.click,
github AxaGuilDEv / react-toolkit / packages / Layout / header / src / NavBar / NavBarBase.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import { ClassManager, Constants } from '@axa-fr/react-toolkit-core';
import ToggleButton from '../ToggleButton';

const propTypes = {
  ...Constants.propTypes,
  isVisible: PropTypes.bool.isRequired,
  onClick: PropTypes.func.isRequired,
  handleKeys: PropTypes.func.isRequired,
  onFocus: PropTypes.func.isRequired,
  onBlur: PropTypes.func.isRequired,
  id: PropTypes.string,
  toggleMenuId: PropTypes.string,
  children: PropTypes.node,
  isMenuFocused: PropTypes.bool,
};

const defaultClassName = 'af-nav-container';
const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
  children: null,
github AxaGuilDEv / react-toolkit / packages / help / src / Help.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import Popover, {
  PopoverBase,
  PopoverModes,
  PopoverPlacements,
} from '@axa-fr/react-toolkit-popover';
import { Constants } from '@axa-fr/react-toolkit-core';

const propTypes = {
  ...Constants.propTypes,
  children: PropTypes.oneOfType([
    PropTypes.element,
    PropTypes.string,
    PropTypes.node,
  ]),
  placement: PropTypes.oneOf([
    PopoverPlacements.top,
    PopoverPlacements.bottom,
    PopoverPlacements.left,
    PopoverPlacements.right,
  ]),
  mode: PropTypes.oneOf([PopoverModes.over, PopoverModes.click]),
};
const defaultProps = {
  ...Constants.defaultProps,
  children: '',
github AxaGuilDEv / react-toolkit / packages / collapse / src / Accordion.js View on Github external
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { ClassManager, Constants } from '@axa-fr/react-toolkit-core';

const propTypes = {
  ...Constants.propTypes,
  children: PropTypes.node.isRequired,
  defaultCollapse: PropTypes.bool,
  onlyOne: PropTypes.bool,
};
const defaultClassName = 'af-accordion';
const defaultProps = {
  ...Constants.defaultProps,
  defaultCollapse: true,
  onlyOne: true,
  className: defaultClassName,
};

export const AccordionBase = props => {
  const { children, className, classModifier, handleToggle, collapses } = props;
  const renderedChildren = React.Children.map(children, child => {
    const index = Array.isArray(children) ? children.indexOf(child) : 0;
github AxaGuilDEv / react-toolkit / packages / Layout / header / src / NavBar / NavBar.js View on Github external
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Constants } from '@axa-fr/react-toolkit-core';
import NavBarBase from './NavBarBase';
import { setPosition } from './NavBar.helpers';

const propTypes = {
  ...Constants.propTypes,
  isVisible: PropTypes.bool.isRequired,
  onClick: PropTypes.func.isRequired,
  id: PropTypes.string,
  toggleMenuId: PropTypes.string,
  children: PropTypes.node,
  positionInit: PropTypes.number,
};

const defaultClassName = 'af-nav-container';
const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
  children: null,
  id: 'mainmenu',
  toggleMenuId: 'togglemenu',
  positionInit: 0,
github AxaGuilDEv / react-toolkit / packages / Layout / header / src / Title / Title.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import { ClassManager, Constants } from '@axa-fr/react-toolkit-core';
import Action from '@axa-fr/react-toolkit-action';
import ToggleButton from '../ToggleButton';

const propTypes = {
  ...Constants.propTypes,
  title: PropTypes.string.isRequired,
  subtitle: PropTypes.string,
  children: PropTypes.node,
  toggleMenu: PropTypes.func,
};

const defaultClassName = 'af-title-bar';
const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
  children: null,
  subtitle: '',
  toggleMenu: null,
};

const Title = props => {
github AxaGuilDEv / react-toolkit / packages / popover / src / PopoverBase.js View on Github external
import React, { PureComponent } from 'react';
import { Manager, Reference, Popper } from 'react-popper';
import outy from 'outy';
import PropTypes from 'prop-types';
import { ClassManager, Constants } from '@axa-fr/react-toolkit-core';
import PopoverPlacements from './PopoverPlacements';

const propTypes = {
  ...Constants.propTypes,
  isOpen: PropTypes.bool.isRequired,
  children: PropTypes.any,
  onToggle: PropTypes.func,
  onOutsideTap: PropTypes.func,
  placement: PropTypes.oneOf([
    PopoverPlacements.top,
    PopoverPlacements.bottom,
    PopoverPlacements.left,
    PopoverPlacements.right,
  ]),
};
const defaultClassName = 'af-popover__container';
const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
  placement: PopoverPlacements.top,
github AxaGuilDEv / react-toolkit / packages / tabs / src / Tabs.Title.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

import { Constants, ClassManager } from '@axa-fr/react-toolkit-core';

const propTypes = {
  ...Constants.propTypes,
  children: PropTypes.any.isRequired,
  active: PropTypes.bool.isRequired,
  className: PropTypes.string,
  classModifier: PropTypes.string,
};

const defaultClassName = 'af-tabs__item';

const defaultProps = {
  ...Constants.defaultProps,
  children: null,
  active: false,
  className: defaultClassName,
};

const Title = props => {
github AxaGuilDEv / react-toolkit / packages / Form / steps / src / StepLink.js View on Github external
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import { Constants } from '@axa-fr/react-toolkit-core';
import StepBase from './StepBase';

const propTypes = {
  ...Constants.propTypes,
  id: PropTypes.string.isRequired,
  href: PropTypes.string,
  onClick: PropTypes.func.isRequired,
  number: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).isRequired,
  title: PropTypes.string.isRequired,
  icon: PropTypes.string,
};
const defaultClassName = 'past af-steps-list-step';
const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
};

class StepLink extends Component {
  constructor(props) {
    super(props);
github AxaGuilDEv / react-toolkit / packages / table / src / Header.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';

import { Constants, ClassManager } from '@axa-fr/react-toolkit-core';

import Tr from './Tr';

const propTypes = {
  ...Constants.propTypes,
  children: PropTypes.any.isRequired,
};

const defaultClassName = 'af-table__thead';
const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
};

const Header = props => {
  const { children, headers, className, classModifier } = props;
  const componentClassName = ClassManager.getComponentClassName(
    className,
    classModifier,
    defaultClassName
  );