File size: 1,838 Bytes
89ce340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
  <div class="button-group" :class="{ 'passive': passive }" ref="groupRef">
    <slot></slot>
  </div>
</template>

<script lang="ts" setup>
withDefaults(defineProps<{
  passive?: boolean
}>(), {
  passive: false,
})
</script>

<style lang="scss" scoped>
.button-group {
  display: flex;
  align-items: center;

  ::v-deep(button.button) {
    border-radius: 0;
    border-left-width: 1px;
    border-right-width: 0;
    display: inline-block;
  }

  &:not(.passive) {
    ::v-deep(button.button) {
      &:not(:last-child, .radio, .checkbox):hover {
        position: relative;

        &::after {
          content: '';
          width: 1px;
          height: calc(100% + 2px);
          background-color: $themeColor;
          position: absolute;
          top: -1px;
          right: -1px;
        }
      }

      &:first-child {
        border-top-left-radius: $borderRadius;
        border-bottom-left-radius: $borderRadius;
        border-left-width: 1px;
      }

      &:last-child {
        border-top-right-radius: $borderRadius;
        border-bottom-right-radius: $borderRadius;
        border-right-width: 1px;
      }
    }
  }
  &.passive {
    ::v-deep(button.button) {
      &:not(.last, .radio, .checkbox):hover {
        position: relative;

        &::after {
          content: '';
          width: 1px;
          height: calc(100% + 2px);
          background-color: $themeColor;
          position: absolute;
          top: -1px;
          right: -1px;
        }
      }

      &.first {
        border-top-left-radius: $borderRadius;
        border-bottom-left-radius: $borderRadius;
        border-left-width: 1px;
      }

      &.last {
        border-top-right-radius: $borderRadius;
        border-bottom-right-radius: $borderRadius;
        border-right-width: 1px;
      }
    }
  }
}
</style>