group.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. const genButtonBorderStyle = (buttonTypeCls, borderColor) => ({
  7. // Border
  8. [`> span, > ${buttonTypeCls}`]: {
  9. '&:not(:last-child)': {
  10. [`&, & > ${buttonTypeCls}`]: {
  11. '&:not(:disabled)': {
  12. borderInlineEndColor: borderColor
  13. }
  14. }
  15. },
  16. '&:not(:first-child)': {
  17. [`&, & > ${buttonTypeCls}`]: {
  18. '&:not(:disabled)': {
  19. borderInlineStartColor: borderColor
  20. }
  21. }
  22. }
  23. }
  24. });
  25. const genGroupStyle = token => {
  26. const {
  27. componentCls,
  28. fontSize,
  29. lineWidth,
  30. colorPrimaryHover,
  31. colorErrorHover
  32. } = token;
  33. return {
  34. [`${componentCls}-group`]: [{
  35. position: 'relative',
  36. display: 'inline-flex',
  37. // Border
  38. [`> span, > ${componentCls}`]: {
  39. '&:not(:last-child)': {
  40. [`&, & > ${componentCls}`]: {
  41. borderStartEndRadius: 0,
  42. borderEndEndRadius: 0
  43. }
  44. },
  45. '&:not(:first-child)': {
  46. marginInlineStart: -lineWidth,
  47. [`&, & > ${componentCls}`]: {
  48. borderStartStartRadius: 0,
  49. borderEndStartRadius: 0
  50. }
  51. }
  52. },
  53. [componentCls]: {
  54. position: 'relative',
  55. zIndex: 1,
  56. [`&:hover,
  57. &:focus,
  58. &:active`]: {
  59. zIndex: 2
  60. },
  61. '&[disabled]': {
  62. zIndex: 0
  63. }
  64. },
  65. [`${componentCls}-icon-only`]: {
  66. fontSize
  67. }
  68. },
  69. // Border Color
  70. genButtonBorderStyle(`${componentCls}-primary`, colorPrimaryHover), genButtonBorderStyle(`${componentCls}-danger`, colorErrorHover)]
  71. };
  72. };
  73. var _default = exports.default = genGroupStyle;