borderRadius.js

  1. import directional from './util/directional.js';
  2. /**
  3. * Directional borderRadius helper
  4. * @function borderRadius
  5. * @param {number|string|object} value Value for all directions or object of values:
  6. * @param {number|string} [value.x] Left and right value
  7. * @param {number|string} [value.y] Top and bottom value
  8. * @param {number|string} [value.top] Top value (takes precedence over y)
  9. * @param {number|string} [value.right] Right value (takes precedence over x)
  10. * @param {number|string} [value.bottom] Bottom value (takes precedence over y)
  11. * @param {number|string} [value.left] Left value (takes precedence over x)
  12. * @return {object} Style object
  13. * @example
  14. * // All directions
  15. * borderRadius('foo');
  16. * // → {
  17. * // borderTopRadius: 'foo',
  18. * // borderRightRadius: 'foo',
  19. * // borderBottomRadius: 'foo',
  20. * // borderLeftRadius: 'foo'
  21. * // }
  22. * @example
  23. * // A single axis
  24. * borderRadius({x: 'bar'});
  25. * // → {
  26. * // borderLeftRadius: 'bar',
  27. * // borderRightRadius: 'bar'
  28. * // }
  29. * @example
  30. * // Any combination
  31. * borderRadius({y: 'foo', top: 'bar', right: 'baz'});
  32. * // → {
  33. * // borderTopRadius: 'bar',
  34. * // borderRightRadius: 'baz',
  35. * // borderBottomRadius: 'foo'
  36. * // }
  37. */
  38. export default directional(
  39. 'borderTopRadius',
  40. 'borderRightRadius',
  41. 'borderBottomRadius',
  42. 'borderLeftRadius'
  43. );