summaryrefslogtreecommitdiffstats
path: root/WebContent/VAADIN/themes/valo/components/_optiongroup.scss
blob: 71c67cd9d809363effaab0edb8f8d83ae560de00 (plain)
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
@mixin valo-optiongroup ($primary-stylename: v-optiongroup) {

  .v-radiobutton {
    @include valo-radiobutton-style;
  }

  .v-select-optiongroup {
    @include valo-optiongroup-style;
  }

}


@mixin valo-radiobutton-style ($background-color: $v-background-color, $unit-size: $v-unit-size, $selection-color: $v-selection-color) {
  @include valo-checkbox-style($background-color: $background-color, $unit-size: $unit-size, $selection-color: $selection-color);

  :root & > input {
    &:checked ~ label:after {
      $size: ceil($unit-size/6);
      $offset: round($unit-size/6);
      width: $size;
      height: $size;
      top: $offset;
      left: $offset;
      background: $selection-color;
    }

    & ~ label:before,
    & ~ label:after {
      border-radius: 50%;
      content: "";
    }
  }
}



@mixin valo-optiongroup-style ($unit-size: $v-unit-size, $font-size: $v-font-size) {

  @if $unit-size != $v-unit-size {
    .v-checkbox {
      @include valo-checkbox-style($unit-size: $unit-size);
    }
    .v-radiobutton {
      @include valo-radiobutton-style($unit-size: $unit-size);
    }
  }

  .v-radiobutton,
  .v-checkbox {
    display: block;
    margin: round($unit-size/4) $font-size 0 0;

    &:first-child {
      margin-top: round($unit-size/6);
    }

    &:last-child {
      margin-bottom: round($unit-size/6);
    }
  }

  &.v-has-width label {
    white-space: normal;
  }
}


@mixin valo-optiongroup-horizontal {
  white-space: nowrap;

  .v-radiobutton,
  .v-checkbox {
    display: inline-block;
  }

  &.v-has-width {
    white-space: normal;

    label {
      white-space: nowrap;
    }
  }
}