aboutsummaryrefslogtreecommitdiffstats
path: root/web/cobrands/sass/_multiselect.scss
blob: 5f59599a63466cb3d704914231113a5a3b20a5ef (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
.multi-select-container {
    position: relative;
    display: inline-block; // shrink to width of .multi-select-button
}

.multi-select-menu {
    position: absolute;
    #{$left}: 0;
    top: 0.8em;
    z-index: 2; // stack above mysoc-footer
    float: #{$left}; // shrink to width of child elements
    min-width: 100%; // always at least as wide as its .multi-select-button sibling
    background: #fff;
    margin: 1em 0;
    border: 1px solid #aaa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    display: none;
}

.multi-select-menuitem {
    display: block;
    font-size: 0.875em;
    padding: flip(0.6em 1em 0.6em 30px, 0.6em 30px 0.6em 1em);
    margin: 0;
    white-space: nowrap;

    & + & {
        padding-top: 0;
    }

    input {
        position: absolute;
        margin-top: 0.25em;
        margin-#{$left}: -20px;
    }
}

.multi-select-modal {
    display: none;
}

// Centred, modal display for sub-768px screens only.
@media (max-width: 47.94em) {
    .multi-select-menu {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 75% !important; // override inline "width: auto"
        max-height: 50%;
        min-width: 0;
        overflow: auto; // allow scrolling
        border: none;
        border-radius: 0.3em;
        box-shadow: 0 1em 3em rgba(0, 0, 0, 0.4);
    }

    .multi-select-menuitem {
        font-size: 1em;
        padding: flip(1em 2.5em 1em 3.5em, 1em 3.5em 1em 2.5em);

        input {
            margin-top: 0.15em;
            margin-#{$left}: -2em;
        }
    }

    .multi-select-modal {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1;
        background: rgba(0, 0, 0, 0.4);

        .multi-select-container--open & {
            display: block;
        }
    }
}

.multi-select-presets {
    border-bottom: 1px solid #ddd;
}

.multi-select-button {
    display: inline-block;
    font-size: 0.875em;
    padding: flip(0.2em 1.5em 0.2em 0.6em, 0.2em 0.6em 0.2em 1.5em);
    max-width: 20em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: -0.5em;
    background-color: #fff;
    border: 1px solid $form-control-border-color;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: default;
    position: relative;

    &:after {
        content: "";
        display: block;
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0.4em 0.4em 0 0.4em;
        border-color: #999 transparent transparent transparent;

        position: absolute;
        #{$right}: 0.5em;
        top: 50%;
        margin: -0.2em 0 0 0;
    }
}

.multi-select-container--open {
    .multi-select-menu {
        display: block;
    }

    .multi-select-button:after {
        border-width: 0 0.4em 0.4em 0.4em;
        border-color: transparent transparent #999 transparent;
    }
}

.multi-select-container--positioned {
    .multi-select-menu {
        box-sizing: border-box;

        label {
            white-space: normal;
        }
    }
}