group.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. groupBorderColor,
  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: token.calc(lineWidth).mul(-1).equal(),
  47. [`&, & > ${componentCls}`]: {
  48. borderStartStartRadius: 0,
  49. borderEndStartRadius: 0
  50. }
  51. }
  52. },
  53. [componentCls]: {
  54. position: 'relative',
  55. zIndex: 1,
  56. '&:hover, &:focus, &:active': {
  57. zIndex: 2
  58. },
  59. '&[disabled]': {
  60. zIndex: 0
  61. }
  62. },
  63. [`${componentCls}-icon-only`]: {
  64. fontSize
  65. }
  66. },
  67. // Border Color
  68. genButtonBorderStyle(`${componentCls}-primary`, groupBorderColor), genButtonBorderStyle(`${componentCls}-danger`, colorErrorHover)]
  69. };
  70. };
  71. var _default = exports.default = genGroupStyle;