All files / atom/popover/src config.js

100% Statements 15/15
50% Branches 1/2
100% Functions 3/3
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55            1x               1x 1x 1x 1x 1x 1x     1x       1x                                   1x   1x 4x         1x 2x  
import {Children} from 'react'
 
import cx from 'classnames'
 
import loadable from '@loadable/component'
 
export const TRIGGERS = {
  CLICK: 'click',
  FOCUS: 'focus',
  HOVER: 'hover',
  LEGACY: 'legacy',
  MANUAL: 'manual'
}
 
export const BASE_CLASS = 'sui-AtomPopover'
export const CLASS_INNER = `${BASE_CLASS}-inner`
export const PREFIX_PLACEMENT = `${BASE_CLASS}-`
export const DEFAULT_OFFSET = 'auto,4px'
export const DEFAULT_TRIGGER = TRIGGERS.LEGACY
export const DEFAULT_DELAY = 0
 
// https://github.com/reactstrap/reactstrap/blob/8.9.0/src/Popover.js
export const Popover = loadable(() => import('reactstrap/lib/Popover'), {
  ssr: true
})
 
export const PLACEMENTS = {
  AUTO: 'auto',
  AUTO_START: 'auto-start',
  AUTO_END: 'auto-end',
  TOP: 'top',
  TOP_START: 'top-start',
  TOP_END: 'top-end',
  RIGHT: 'right',
  RIGHT_START: 'right-start',
  RIGHT_END: 'right-end',
  BOTTOM: 'bottom',
  BOTTOM_START: 'bottom-start',
  BOTTOM_END: 'bottom-end',
  LEFT: 'left',
  LEFT_START: 'left-start',
  LEFT_END: 'left-end'
}
 
export const TYPES = {}
 
export const getClassName = ({defaultClass, type}) => {
  return cx(defaultClass, {
    [`${defaultClass}--type-${type}`]: Boolean(type)
  })
}
 
export const getChildrenAsReactNode = element =>
  typeof element === 'string' ? <span key={1}>{element}</span> : Children.only(element)