summaryrefslogtreecommitdiffstats
path: root/css/Properties/Properties.scss
blob: e2a7973ccca77df50ac7c9aefee94c0aa954a2d7 (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/**
 * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
 *
 * @author John Molakvoæ <skjnldsv@protonmail.com>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
$property-label-min-width: 60px;
$property-label-max-width: 2 * $property-label-min-width;
$property-value-max-width: 250px;
$property-ext-padding-right: 8px;

.property {
	position: relative;
	width: 100%;
	// we need this to keep the alignment of the ext and delete/action button
	// The flex grow will never go over those values. Therefore we can set
	// the max width and keep the right alignment
	max-width: $property-label-max-width + $property-value-max-width + 44px;

	justify-self: center;

	&--last {
		margin-bottom: $grid-height-unit;
	}
	// no delete/action icon on addressbook selector
	&--addressbooks &__actions {
		display: none !important;
	}

	&--without-actions {
		padding-right: 44px; // actions menu / button
	}

	// property row
	&__row {
		position: relative;
		display: flex;
		align-items: center;
	}

	// property label or multiselect within row
	&__label,
	&__label.multiselect {
		flex: 1 0; // min width is 60px, let's grow until 120px
		width: $property-label-min-width;
		min-width: $property-label-min-width !important; // override multiselect
		max-width: $property-label-max-width;

		&:not(.multiselect) {
			overflow: hidden;
			overflow-x: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			opacity: .7;
		}

		// mouse feedback
		.multiselect__tags {
			opacity: .7;
		}
		&:hover,
		&:focus,
		&:active {
			.multiselect__tags {
				opacity: 1;
				border-color: var(--color-border-dark);
			}
		}

		// read-only mode
		&.multiselect--disabled {
			&, .multiselect__single {
				&, &:hover, &:focus &:active {
					border-color: transparent !important;
					background-color: var(--color-main-background) !important;
				}
			}
		}
	}

	&__label.multiselect {
		.multiselect__tags {
			border: none !important; // override multiselect
		}
	}

	// Hide delete buttons initially
	.action-item.icon-delete {
		opacity: 0;
	}

	// Property value within row, after label
	&__value {
		flex: 1 1;

		textarea {
			align-self: flex-start;
			min-height: 2 * $grid-height-unit - 2*$grid-input-margin;
			max-height: 5 * $grid-height-unit - 2*$grid-input-margin;
		}

		// read-only mode
		&:read-only {
			border-color: var(--color-border-dark);
		}
		&--with-ext {
			// ext icon width + 8px padding
			padding-right: 24px;
		}

		// Show ext and delete icon permanently on focus
		&:hover,
		&:focus,
		&:active {
			~ .property__ext,
			~ .action-item.icon-delete {
				opacity: .5;
			}
		}
	}

	// Show ext and delete buttons on full row hover
	&:hover {
		.property__ext,
		.action-item {
			opacity: .5;
		}
	}

	// External link (tel, mailto, http, ftp...)
	&__ext {
		position: absolute;
		// 8px padding + actions
		right: 44px + $property-ext-padding-right;
		opacity: 0;
		&:hover,
		&:focus,
		&:active {
			opacity: .7;
		}
	}

	.no-move {
		right: $property-ext-padding-right;
	}

	// Delete property button + actions
	&__actions {
		z-index: 10;
		margin-left: auto !important;
		// floating actions next to the title
		&--floating {
			position: absolute !important;
			right: 0;
			bottom: 0;
		}
	}
	.property__value {
		margin-right: 0;
	}
}