wordWrap.js 743 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = wordWrap;
  4. /**
  5. * Provides an easy way to change the `wordWrap` property.
  6. *
  7. * @example
  8. * // Styles as object usage
  9. * const styles = {
  10. * ...wordWrap('break-word')
  11. * }
  12. *
  13. * // styled-components usage
  14. * const div = styled.div`
  15. * ${wordWrap('break-word')}
  16. * `
  17. *
  18. * // CSS as JS Output
  19. *
  20. * const styles = {
  21. * overflowWrap: 'break-word',
  22. * wordWrap: 'break-word',
  23. * wordBreak: 'break-all',
  24. * }
  25. */
  26. function wordWrap(wrap) {
  27. if (wrap === void 0) {
  28. wrap = 'break-word';
  29. }
  30. var wordBreak = wrap === 'break-word' ? 'break-all' : wrap;
  31. return {
  32. overflowWrap: wrap,
  33. wordWrap: wrap,
  34. wordBreak: wordBreak
  35. };
  36. }
  37. module.exports = exports.default;