How to use the @axa-fr/react-toolkit-core.Constants.defaultProps 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 / tabs / src / Tab.js View on Github external
const propTypes = {
  ...Constants.propTypes,
  classModifier: PropTypes.string,
  className: PropTypes.string,
  children: PropTypes.any.isRequired,
  title: PropTypes.any.isRequired,
  active: PropTypes.bool.isRequired,
  setActiveIndex: PropTypes.func,
  index: PropTypes.number,
  disabled: PropTypes.bool,
};

const defaultClassName = 'af-tabs__item';

const defaultProps = {
  ...Constants.defaultProps,
  className: defaultClassName,
  children: null,
  title: null,
  active: false,
  role: 'TITLE',
  onChange: () => {},
  index: 0,
  disabled: false,
};

class Tab extends React.Component {
  /* eslint-disable no-unused-expressions */
  onChange = () => {
    const { disabled, index, onChange } = this.props;
    disabled
      ? e => {
github AxaGuilDEv / react-toolkit / packages / Layout / header / src / NavBar / NavBarBase.js View on Github external
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,
  id: 'mainmenu',
  toggleMenuId: 'togglemenu',
  isMenuFocused: false,
};

const NavBarBase = ({
  isVisible,
  onClick,
  id,
  toggleMenuId,
  isMenuFocused,
  className,
  classModifier,
  handleKeys,
github AxaGuilDEv / react-toolkit / packages / tabs / src / Tabs.Title.js View on Github external
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 => {
  const { active, className, classModifier } = props;
  const componentClassName = ClassManager.getComponentClassName(
    className,
    classModifier,
    defaultClassName
  );
  return (
github AxaGuilDEv / react-toolkit / packages / collapse / src / CollapseCardBase.js View on Github external
import Body from './Body';
import Header from './Header';

const defaultClassName = 'af-accordion__item';

const propTypes = {
  ...Constants.propTypes,
  children: PropTypes.any,
  collapse: PropTypes.bool,
  onToggle: PropTypes.func,
  id: PropTypes.string,
  index: PropTypes.number,
};

const defaultProps = {
  ...Constants.defaultProps,
  onToggle: null,
  collapse: true,
  className: defaultClassName,
  id: null,
  index: 0,
};

const getIds = id => {
  const newId = InputManager.getInputId(id);
  return {
    id: newId,
  };
};

class CollapseCardBase extends Component {
  constructor(props) {
github AxaGuilDEv / react-toolkit / packages / Form / Input / card / src / CardGroupStateless.js View on Github external
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Constants } from '@axa-fr/react-toolkit-core';
import cardType from './Constants';
import CardMeta from './CardMeta';

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

const defaultProps = {
  ...Constants.defaultProps,
  title: '',
  type: cardType.RADIO,
  children: null,
};

const CardGroupStateless = ({
  title,
  propClassName,
  type,
  children,
  className,
  classModifier,
  active,
  onChange,
  name,
  values,
github AxaGuilDEv / react-toolkit / packages / Form / steps / src / StepLink.js View on Github external
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);
    this.onClick = this.onClick.bind(this);
  }

  onClick(e) {
    e.preventDefault();
    const { id, href, number, title, onClick } = this.props;
    onClick({
      href,
      number,
      id,
github AxaGuilDEv / react-toolkit / packages / Layout / header / src / Title / Title.js View on Github external
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 => {
  const {
    title,
    subtitle,
    children,
    toggleMenu,
    className,
    classModifier,
  } = props;
  const componentClassName = ClassManager.getComponentClassName(
github AxaGuilDEv / react-toolkit / packages / popover / src / Popover.js View on Github external
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,
};

export class PopoverClick extends Component {
  constructor(props) {
    super(props);
    this.toggle = this.toggle.bind(this);
    this.outsideTap = this.outsideTap.bind(this);
    this.state = {
      isOpen: false,
    };
  }

  toggle() {
github AxaGuilDEv / react-toolkit / packages / table / src / Tr.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import { Constants, ClassManager } from '@axa-fr/react-toolkit-core';

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

const defaultClassName = 'af-table__tr';
const defaultProps = {
  ...Constants.defaultProps,
  children: null,
  className: defaultClassName,
  id: null,
};

const Tr = props => {
  const { children, id, className, classModifier, ...otherProps } = props;
  const componentClassName = ClassManager.getComponentClassName(
    className,
    classModifier,
    defaultClassName
  );
  return (
    
      {children}
github AxaGuilDEv / react-toolkit / packages / table / src / Body.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';

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

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

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

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

Body.propTypes = propTypes;
Body.defaultProps = defaultProps;
Body.displayName = 'Table.Body';