2019-01-20 12:11:20 +08:00
|
|
|
/*
|
|
|
|
Copyright 2019 New Vector Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-07-15 21:53:23 +08:00
|
|
|
/* TODO: Consider unifying with general input styles in _light.pcss */
|
2019-01-20 12:11:20 +08:00
|
|
|
|
|
|
|
.mx_Field {
|
2019-03-05 23:13:12 +08:00
|
|
|
display: flex;
|
2019-06-18 00:29:03 +08:00
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
2019-01-20 12:11:20 +08:00
|
|
|
position: relative;
|
|
|
|
margin: 1em 0;
|
2024-03-05 12:25:47 +08:00
|
|
|
border-radius: 8px;
|
2019-03-02 00:45:33 +08:00
|
|
|
transition: border-color 0.25s;
|
2024-03-05 12:25:47 +08:00
|
|
|
border: 1px solid var(--cpd-color-border-interactive-secondary);
|
2019-01-20 12:11:20 +08:00
|
|
|
}
|
|
|
|
|
2019-03-05 23:13:12 +08:00
|
|
|
.mx_Field_prefix {
|
2024-03-05 12:25:47 +08:00
|
|
|
border-right: 1px solid var(--cpd-color-border-interactive-secondary);
|
2019-03-05 23:13:12 +08:00
|
|
|
}
|
|
|
|
|
2019-09-20 23:45:14 +08:00
|
|
|
.mx_Field_postfix {
|
2024-03-05 12:25:47 +08:00
|
|
|
border-left: 1px solid var(--cpd-color-border-interactive-secondary);
|
2019-09-20 23:45:14 +08:00
|
|
|
}
|
|
|
|
|
2019-01-23 10:25:09 +08:00
|
|
|
.mx_Field input,
|
2019-01-26 11:38:35 +08:00
|
|
|
.mx_Field select,
|
|
|
|
.mx_Field textarea {
|
2023-06-29 18:30:25 +08:00
|
|
|
font: var(--cpd-font-body-md-regular);
|
2019-03-02 00:45:33 +08:00
|
|
|
border: none;
|
2022-07-27 21:39:29 +08:00
|
|
|
/* Even without a border here, we still need this avoid overlapping the rounded */
|
|
|
|
/* corners on the field above. */
|
2024-03-05 12:25:47 +08:00
|
|
|
border-radius: 8px;
|
2019-01-22 00:16:20 +08:00
|
|
|
padding: 8px 9px;
|
2021-08-12 17:27:12 +08:00
|
|
|
color: $primary-content;
|
2021-08-12 17:10:47 +08:00
|
|
|
background-color: $background;
|
2019-06-14 06:48:47 +08:00
|
|
|
flex: 1;
|
2019-11-15 22:37:43 +08:00
|
|
|
min-width: 0;
|
2019-01-20 12:11:20 +08:00
|
|
|
}
|
|
|
|
|
2019-01-31 06:40:53 +08:00
|
|
|
.mx_Field select {
|
|
|
|
-moz-appearance: none;
|
|
|
|
-webkit-appearance: none;
|
2023-10-09 18:55:43 +08:00
|
|
|
text-overflow: ellipsis;
|
2019-01-31 06:40:53 +08:00
|
|
|
}
|
|
|
|
|
2022-07-27 21:39:29 +08:00
|
|
|
/* Can't add pseudo-elements to a select directly, so we use its parent. */
|
2019-01-31 06:40:53 +08:00
|
|
|
.mx_Field_select::before {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
top: 15px;
|
|
|
|
right: 10px;
|
|
|
|
width: 10px;
|
|
|
|
height: 6px;
|
2019-02-27 18:42:05 +08:00
|
|
|
mask: url("$(res)/img/feather-customised/dropdown-arrow.svg");
|
2019-01-31 06:40:53 +08:00
|
|
|
mask-repeat: no-repeat;
|
2021-08-12 17:27:12 +08:00
|
|
|
background-color: $primary-content;
|
2019-01-31 06:40:53 +08:00
|
|
|
z-index: 1;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
2019-03-02 00:45:33 +08:00
|
|
|
.mx_Field:focus-within {
|
2021-11-29 20:52:09 +08:00
|
|
|
border-color: $accent-alt;
|
2019-03-02 00:45:33 +08:00
|
|
|
}
|
|
|
|
|
2019-01-23 10:25:09 +08:00
|
|
|
.mx_Field input:focus,
|
2019-01-26 11:38:35 +08:00
|
|
|
.mx_Field select:focus,
|
|
|
|
.mx_Field textarea:focus {
|
2019-01-20 12:11:20 +08:00
|
|
|
outline: 0;
|
|
|
|
}
|
|
|
|
|
2019-01-26 11:38:35 +08:00
|
|
|
.mx_Field input::placeholder,
|
|
|
|
.mx_Field textarea::placeholder {
|
2019-01-20 12:11:20 +08:00
|
|
|
transition: color 0.25s ease-in 0s;
|
|
|
|
color: transparent;
|
|
|
|
}
|
|
|
|
|
2019-01-26 11:38:35 +08:00
|
|
|
.mx_Field input:placeholder-shown:focus::placeholder,
|
2021-11-02 13:44:42 +08:00
|
|
|
.mx_Field textarea:placeholder-shown:focus::placeholder,
|
|
|
|
.mx_Field.mx_Field_placeholderIsHint input::placeholder {
|
2019-01-20 12:11:20 +08:00
|
|
|
transition: color 0.25s ease-in 0.1s;
|
2021-11-29 20:52:09 +08:00
|
|
|
color: $info-plinth-fg-color;
|
2019-01-20 12:11:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.mx_Field label {
|
2024-01-03 02:56:39 +08:00
|
|
|
transition:
|
|
|
|
font-size 0.25s ease-out 0.1s,
|
|
|
|
color 0.25s ease-out 0.1s,
|
|
|
|
transform 0.25s ease-out 0.1s,
|
2019-01-20 12:11:20 +08:00
|
|
|
background-color 0.25s ease-out 0.1s;
|
|
|
|
background-color: transparent;
|
2023-06-29 18:30:25 +08:00
|
|
|
font: var(--cpd-font-body-md-regular);
|
2024-03-05 12:25:47 +08:00
|
|
|
color: var(--cpd-color-text-secondary);
|
2021-09-11 15:03:55 +08:00
|
|
|
transform: translateY(0);
|
2019-01-20 12:11:20 +08:00
|
|
|
position: absolute;
|
|
|
|
left: 0px;
|
2019-01-22 00:09:33 +08:00
|
|
|
margin: 7px 8px;
|
2019-01-20 12:11:20 +08:00
|
|
|
padding: 2px;
|
2022-07-27 21:39:29 +08:00
|
|
|
pointer-events: none; /* Allow clicks to fall through to the input */
|
2019-03-04 20:02:23 +08:00
|
|
|
overflow: hidden;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
2022-07-27 21:39:29 +08:00
|
|
|
max-width: calc(100% - 20px); /* 100% of parent minus margin and padding */
|
2019-01-20 12:11:20 +08:00
|
|
|
}
|
|
|
|
|
2019-07-10 23:55:03 +08:00
|
|
|
.mx_Field_labelAlwaysTopLeft label,
|
2019-07-11 20:14:20 +08:00
|
|
|
.mx_Field select + label /* Always show a select's label on top to not collide with the value */,
|
2019-01-20 12:11:20 +08:00
|
|
|
.mx_Field input:focus + label,
|
2019-01-23 10:25:09 +08:00
|
|
|
.mx_Field input:not(:placeholder-shown) + label,
|
2019-01-26 11:38:35 +08:00
|
|
|
.mx_Field textarea:focus + label,
|
2019-07-10 23:55:03 +08:00
|
|
|
.mx_Field textarea:not(:placeholder-shown) + label {
|
2024-01-03 02:56:39 +08:00
|
|
|
transition:
|
|
|
|
font-size 0.25s ease-out 0s,
|
|
|
|
color 0.25s ease-out 0s,
|
|
|
|
transform 0.25s ease-out 0s,
|
2019-01-20 12:11:20 +08:00
|
|
|
background-color 0.25s ease-out 0s;
|
2020-03-31 22:26:23 +08:00
|
|
|
font-size: $font-10px;
|
2021-09-11 15:03:55 +08:00
|
|
|
transform: translateY(-13px);
|
2019-02-05 23:50:56 +08:00
|
|
|
padding: 0 2px;
|
2021-10-17 00:26:05 +08:00
|
|
|
background-color: $background;
|
2019-02-27 21:23:45 +08:00
|
|
|
pointer-events: initial;
|
2019-01-20 12:11:20 +08:00
|
|
|
}
|
|
|
|
|
2019-01-23 10:25:09 +08:00
|
|
|
.mx_Field input:focus + label,
|
2019-01-26 11:38:35 +08:00
|
|
|
.mx_Field select:focus + label,
|
|
|
|
.mx_Field textarea:focus + label {
|
2021-11-29 20:52:09 +08:00
|
|
|
color: $accent-alt;
|
2019-01-20 12:11:20 +08:00
|
|
|
}
|
2019-01-25 10:27:20 +08:00
|
|
|
|
2019-01-26 00:10:16 +08:00
|
|
|
.mx_Field select:disabled,
|
2019-02-09 00:52:14 +08:00
|
|
|
.mx_Field select:disabled + label,
|
2019-02-08 02:58:15 +08:00
|
|
|
.mx_Field input:disabled,
|
2019-02-09 00:52:14 +08:00
|
|
|
.mx_Field input:disabled + label,
|
2019-02-08 02:58:15 +08:00
|
|
|
.mx_Field textarea:disabled,
|
|
|
|
.mx_Field textarea:disabled + label {
|
2021-10-17 00:26:05 +08:00
|
|
|
background-color: $background;
|
2021-11-29 20:52:09 +08:00
|
|
|
color: $info-plinth-fg-color;
|
2019-01-25 10:27:20 +08:00
|
|
|
}
|
2019-03-05 23:16:07 +08:00
|
|
|
|
2019-03-07 22:16:39 +08:00
|
|
|
.mx_Field_valid {
|
|
|
|
&.mx_Field,
|
|
|
|
&.mx_Field:focus-within {
|
2021-11-11 21:37:29 +08:00
|
|
|
border-color: $accent;
|
2019-03-07 22:16:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&.mx_Field label,
|
|
|
|
&.mx_Field:focus-within label {
|
2021-11-11 21:37:29 +08:00
|
|
|
color: $accent;
|
2019-03-07 22:16:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.mx_Field_invalid {
|
|
|
|
&.mx_Field,
|
|
|
|
&.mx_Field:focus-within {
|
2021-11-11 21:37:29 +08:00
|
|
|
border-color: $alert;
|
2019-03-07 22:16:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&.mx_Field label,
|
|
|
|
&.mx_Field:focus-within label {
|
2021-11-11 21:37:29 +08:00
|
|
|
color: $alert;
|
2019-03-07 22:16:39 +08:00
|
|
|
}
|
2019-02-01 07:36:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.mx_Field_tooltip {
|
2019-04-23 23:35:11 +08:00
|
|
|
width: 200px;
|
2019-02-01 07:36:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.mx_Field_tooltip.mx_Field_valid {
|
|
|
|
animation: mx_fadeout 1s 2s forwards;
|
|
|
|
}
|
|
|
|
|
2022-07-27 21:39:29 +08:00
|
|
|
/* Customise other components when placed inside a Field */
|
2019-03-05 23:16:07 +08:00
|
|
|
|
|
|
|
.mx_Field .mx_Dropdown_input {
|
|
|
|
border: initial;
|
|
|
|
border-radius: initial;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mx_Field .mx_CountryDropdown {
|
2023-06-29 18:30:25 +08:00
|
|
|
width: fit-content;
|
2019-03-05 23:16:07 +08:00
|
|
|
}
|