summaryrefslogtreecommitdiffstats
path: root/WebContent/VAADIN/themes/valo/components/_optiongroup.scss
blob: a058ad4e85b67a13c60e31b0a7dc8e38a9d2b63a (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
@mixin valo-optiongroup ($primary-stylename: v-select-optiongroup, $include-additional-styles: contains($v-included-additional-styles, optiongroup)) {

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

  .#{$primary-stylename} {
    @include valo-optiongroup-style;
  }


  @if $include-additional-styles {
    .#{$primary-stylename}-small {
      @include valo-optiongroup-style($unit-size: $v-unit-size--small);
      font-size: $v-font-size--small;
    }

    .#{$primary-stylename}-large {
      @include valo-optiongroup-style($unit-size: $v-unit-size--large);
      font-size: $v-font-size--large;
    }

    .#{$primary-stylename}-horizontal {
      @include valo-optiongroup-horizontal;
    }
  }

}


@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;
    }
  }
}