2021-06-30 07:36:23 +00:00
|
|
|
@import '../../common/variables.less';
|
|
|
|
|
2020-11-19 17:12:53 +00:00
|
|
|
/**
|
|
|
|
* Minimal styling for initial no-JS server-rendered
|
|
|
|
* search form, which gets replaced by WVUI on focus.
|
|
|
|
* Most values are hard-coded since they aim to
|
2020-12-09 13:02:10 +00:00
|
|
|
* mimic WVUI-specific variables and disable the
|
|
|
|
* ResourceLoader LESS transformation of `calc`.
|
2020-11-19 17:12:53 +00:00
|
|
|
*/
|
|
|
|
|
2020-12-14 19:29:38 +00:00
|
|
|
// Derived from @size-base in WVUI
|
|
|
|
// https://gerrit.wikimedia.org/r/plugins/gitiles/wvui/+/e32b54f3b8d1118b6a25cdc46b5638d6d048533e/src/themes/wikimedia-ui.less#7
|
|
|
|
@size-base: unit( 32px / @font-size-browser / @font-size-base, em );
|
|
|
|
|
|
|
|
@min-size-search-button: 30px;
|
|
|
|
@background-size-x-search-button: unit( 20px / @font-size-browser / @font-size-base, em );
|
|
|
|
|
|
|
|
// Search container
|
|
|
|
// We have to put those styles outside `.skin-vector-search-vue`,
|
|
|
|
// as we can't address no-JS modern and Vue enhanced otherwise.
|
2021-09-09 21:03:15 +00:00
|
|
|
.vector-search-box {
|
2021-05-21 01:02:07 +00:00
|
|
|
// Use Vector's base font-size, as this is a component outside of `.vector-body`.
|
2020-12-14 19:29:38 +00:00
|
|
|
font-size: @font-size-base;
|
|
|
|
// Support IE 9-11, Trident cuts values 2 digits after decimal point.
|
|
|
|
// `calc` enables to set correct calculation in place again. See T102364.
|
|
|
|
font-size: @font-size-base--trident-hack;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Typeahead search elements
|
2021-09-16 18:00:05 +00:00
|
|
|
.vector-search-box-vue .vector-search-box-input,
|
|
|
|
.vector-search-box-vue .searchButton {
|
2020-12-14 19:29:38 +00:00
|
|
|
// Overrides #mw-searchButton in resources/skins.vector.styles/SearchBox.less
|
|
|
|
font-size: inherit;
|
|
|
|
}
|
|
|
|
|
2021-09-28 16:27:10 +00:00
|
|
|
.vector-search-box-vue .vector-search-box-input {
|
2020-12-14 19:29:38 +00:00
|
|
|
height: @size-base;
|
|
|
|
}
|
|
|
|
|
2021-09-28 16:27:10 +00:00
|
|
|
.vector-search-box-vue .searchButton {
|
2020-12-14 19:29:38 +00:00
|
|
|
background-size: @background-size-x-search-button auto;
|
|
|
|
}
|
|
|
|
|
2020-12-17 05:52:54 +00:00
|
|
|
// Only apply the following WVUI-related rules to clients who have js enabled.
|
2021-09-16 18:00:05 +00:00
|
|
|
// TODO: .skin-vector-search-vue class can be removed when $wgVectorUseWvuiSearch is no longer supported
|
|
|
|
// OR .vector-search-box-vue is in cached HTML.
|
|
|
|
.client-js .skin-vector-search-vue,
|
|
|
|
.client-js .vector-search-box-vue {
|
2020-12-09 13:02:10 +00:00
|
|
|
// Derived from @size-search-figure in WVUI
|
|
|
|
// https://gerrit.wikimedia.org/r/plugins/gitiles/wvui/+/e32b54f3b8d1118b6a25cdc46b5638d6d048533e/src/themes/wikimedia-ui.less#21
|
2020-12-14 19:29:38 +00:00
|
|
|
@size-search-figure: unit( 36px / @font-size-browser / @font-size-base, em );
|
2020-12-09 13:02:10 +00:00
|
|
|
|
2020-12-17 06:03:40 +00:00
|
|
|
.wvui-typeahead-search__suggestion,
|
|
|
|
.wvui-typeahead-search__suggestions__footer {
|
|
|
|
// Remove link underline on hover that is applied by mediawiki.skinning/elements.css.
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
2021-09-16 18:00:05 +00:00
|
|
|
.wvui-typeahead-search__suggestions li {
|
2020-12-17 06:03:40 +00:00
|
|
|
// Remove margin-bottom on li elements that is applied by mediawiki.skinning/elements.css.
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
2021-09-28 16:27:10 +00:00
|
|
|
.vector-search-box-input {
|
2020-12-09 13:02:10 +00:00
|
|
|
padding-left: @size-search-figure;
|
2020-12-17 05:52:54 +00:00
|
|
|
// Derived from @padding-input-text in WVUI's Input component.
|
|
|
|
padding-right: 8px;
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Move & resize search icon to match WVUI.
|
2021-09-16 18:00:05 +00:00
|
|
|
.searchButton {
|
2021-01-13 23:25:03 +00:00
|
|
|
// T270202: Act like a an inert element instead of a submit button before
|
|
|
|
// WVUI loads to discourage people clicking on it since it is a submit
|
|
|
|
// button styled to look like WVUI's inert start icon. Note, ideally these
|
|
|
|
// submit buttons should be changed to inert elements like span to be
|
|
|
|
// semantically correct.
|
|
|
|
pointer-events: none;
|
2020-12-09 13:02:10 +00:00
|
|
|
// Override the default right & left position of the icon.
|
2020-11-19 17:12:53 +00:00
|
|
|
right: auto;
|
2021-08-27 17:23:25 +00:00
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
2020-12-17 06:33:40 +00:00
|
|
|
// Accounts for the 1px input border. Derived from
|
|
|
|
// https://gerrit.wikimedia.org/g/wvui/+/refs/changes/93/650593/10/src/components/input/Input.vue#163
|
2021-12-16 03:13:56 +00:00
|
|
|
left: @border-width-base;
|
2020-12-09 13:02:10 +00:00
|
|
|
// Increase size to match WVUI.
|
|
|
|
width: @size-search-figure;
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|
|
|
|
|
2020-12-14 19:29:38 +00:00
|
|
|
// Reset WVUI. Prevents the input border from animating
|
2020-12-09 13:02:10 +00:00
|
|
|
// when it gets inserted into the DOM while being focused.
|
|
|
|
.wvui-input__input:not( [ disabled ] ) {
|
2020-12-14 19:29:38 +00:00
|
|
|
.transition( none );
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|
2021-01-26 23:48:20 +00:00
|
|
|
|
2021-06-02 22:57:43 +00:00
|
|
|
.vector-search-box-show-thumbnail {
|
2021-12-16 03:13:56 +00:00
|
|
|
.searchButton {
|
|
|
|
// Accounts for the margin that allocates space for the input expanding and
|
|
|
|
// 1px input border.
|
|
|
|
left: @size-search-expand + @border-width-base;
|
|
|
|
}
|
|
|
|
|
|
|
|
.vector-search-box-input {
|
|
|
|
margin-left: @size-search-expand;
|
|
|
|
width: ~'calc( 100% - @{size-search-expand} )';
|
|
|
|
}
|
|
|
|
|
2021-01-26 23:48:20 +00:00
|
|
|
// Recreate WVUI expanding input.
|
2021-09-28 16:27:10 +00:00
|
|
|
.vector-search-box-input:focus {
|
2021-12-16 03:13:56 +00:00
|
|
|
margin-left: 0;
|
2021-01-26 23:48:20 +00:00
|
|
|
// Use ~ and fixed values to disable the LESS transformation in ResourceLoader LESS implementation.
|
2021-05-05 18:27:50 +00:00
|
|
|
padding-left: ~'calc( @{size-search-figure} + @{size-search-expand} )';
|
2021-12-16 03:13:56 +00:00
|
|
|
width: 100%;
|
2021-01-26 23:48:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Reposition search icon for expanded input.
|
2021-09-28 16:27:10 +00:00
|
|
|
.vector-search-box-input:focus ~ .searchButton {
|
2021-01-26 23:48:20 +00:00
|
|
|
// Derived from
|
|
|
|
// https://gerrit.wikimedia.org/g/wvui/+/refs/changes/93/650593/10/src/components/typeahead-search/TypeaheadSearch.vue#655
|
2021-08-27 17:23:25 +00:00
|
|
|
// (12px of space between the border and the icon) with 1px to account for the focused input border.
|
2021-12-16 03:13:56 +00:00
|
|
|
@space-icon-start: @size-search-expand / 2;
|
|
|
|
left: @space-icon-start + @border-width-base;
|
2021-05-05 18:27:50 +00:00
|
|
|
}
|
2021-01-26 23:48:20 +00:00
|
|
|
}
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|