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
|
2022-02-01 20:52:16 +00:00
|
|
|
* search form, which gets replaced by Codex on focus.
|
2020-11-19 17:12:53 +00:00
|
|
|
* Most values are hard-coded since they aim to
|
2022-02-01 20:52:16 +00:00
|
|
|
* mimic Codex-specific variables and disable the
|
2020-12-09 13:02:10 +00:00
|
|
|
* ResourceLoader LESS transformation of `calc`.
|
2020-11-19 17:12:53 +00:00
|
|
|
*/
|
|
|
|
|
2022-02-01 20:52:16 +00:00
|
|
|
// Derived from @size-base design token in Codex
|
|
|
|
@size-base: 32px;
|
2020-12-14 19:29:38 +00:00
|
|
|
|
|
|
|
@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;
|
2022-06-02 21:52:15 +00:00
|
|
|
// If this is a flex item, make sure it grows into available space.
|
|
|
|
flex-grow: 1;
|
2022-06-13 20:57:13 +00:00
|
|
|
|
|
|
|
> div {
|
|
|
|
max-width: @max-width-search;
|
|
|
|
}
|
2020-12-14 19:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2022-02-01 20:52:16 +00:00
|
|
|
// Only apply the following Codex-related rules to clients who have js enabled.
|
2021-09-16 18:00:05 +00:00
|
|
|
.client-js .vector-search-box-vue {
|
2022-02-01 20:52:16 +00:00
|
|
|
// Derived from @size-search-figure in Codex.
|
|
|
|
// https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/typeahead-search/TypeaheadSearch.vue#676
|
|
|
|
@size-search-figure: 40px;
|
|
|
|
// Derived from text input start icon padding in Codex.
|
|
|
|
// https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/text-input/TextInput.vue#257
|
|
|
|
@padding-left-start-icon: 36px;
|
|
|
|
|
2022-09-01 18:04:12 +00:00
|
|
|
.vector-typeahead-search {
|
2022-02-01 20:52:16 +00:00
|
|
|
// Hide the button, only show it on hover or when the input or the button itself is focused
|
|
|
|
.cdx-search-input__end-button {
|
|
|
|
opacity: 0;
|
|
|
|
// 250ms transition to match the border-color transition in CdxTextInput
|
|
|
|
transition: opacity 250ms;
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Hide the border between the input and the button
|
|
|
|
.cdx-text-input__input:not( :hover ):not( :focus ) {
|
|
|
|
border-right-color: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
&--active,
|
|
|
|
&:hover {
|
|
|
|
.cdx-search-input__end-button {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make the text input's right border appear on top of the button's left border,
|
|
|
|
// otherwise the hover transition looks weird
|
|
|
|
.cdx-text-input {
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use straight corners instead of rounded corners for the border between the
|
|
|
|
// input and the button. Only apply this on hover, to reduce (but not eliminate) the
|
|
|
|
// tiny gap in the input's border when the button is hidden
|
|
|
|
.cdx-text-input__input {
|
|
|
|
border-top-right-radius: 0;
|
|
|
|
border-bottom-right-radius: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.cdx-menu-item {
|
|
|
|
// Remove margin-bottom on li elements that is applied by
|
|
|
|
// mediawiki.skinning/elements.css.
|
|
|
|
margin-bottom: 0;
|
2020-12-17 06:03:40 +00:00
|
|
|
|
2022-02-01 20:52:16 +00:00
|
|
|
a {
|
|
|
|
// Remove link underline on hover that is applied by
|
|
|
|
// mediawiki.skinning/elements.css.
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset Codex. Prevents the input border and the start icon from animating
|
|
|
|
// when the input gets inserted into the DOM while being focused.
|
|
|
|
&.vector-search-box-disable-transitions {
|
|
|
|
.cdx-text-input__input:enabled,
|
|
|
|
.cdx-text-input__start-icon {
|
|
|
|
transition: none;
|
|
|
|
}
|
|
|
|
}
|
2020-12-17 06:03:40 +00:00
|
|
|
}
|
|
|
|
|
2021-09-28 16:27:10 +00:00
|
|
|
.vector-search-box-input {
|
2022-02-01 20:52:16 +00:00
|
|
|
padding-left: @padding-left-start-icon;
|
|
|
|
// Derived from @padding-input-text in Codex's TextInput component.
|
2020-12-17 05:52:54 +00:00
|
|
|
padding-right: 8px;
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|
|
|
|
|
2022-02-01 20:52:16 +00:00
|
|
|
// Move & resize search icon to match Codex.
|
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
|
2022-02-01 20:52:16 +00:00
|
|
|
// Codex loads to discourage people clicking on it since it is a submit
|
|
|
|
// button styled to look like Codex's inert start icon. Note, ideally these
|
2021-01-13 23:25:03 +00:00
|
|
|
// 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;
|
2022-02-01 20:52:16 +00:00
|
|
|
// Accounts for the 1px input border.
|
2021-12-16 03:13:56 +00:00
|
|
|
left: @border-width-base;
|
2022-02-01 20:52:16 +00:00
|
|
|
// Increase size to match Codex.
|
|
|
|
width: @padding-left-start-icon;
|
|
|
|
// Set opacity to match icon color from Codex (0.51 approximates #72777d)
|
|
|
|
opacity: 0.51;
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|
|
|
|
|
2022-02-01 20:52:16 +00:00
|
|
|
.vector-search-box-input:focus ~ .searchButton {
|
|
|
|
// When the input is focused, change icon color to match Codex (0.87 approximates #202122)
|
|
|
|
opacity: 0.87;
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|
2021-01-26 23:48:20 +00:00
|
|
|
|
2022-04-12 00:01:19 +00:00
|
|
|
&.vector-search-box-show-thumbnail {
|
2022-06-13 20:57:13 +00:00
|
|
|
> div {
|
|
|
|
// Ensure the input + search button = 500px when unfocused and `auto-expand-width` enabled (i.e. search in header)
|
|
|
|
// Also increases the width of the sticky header search, which has `auto-expand-width` disabled
|
|
|
|
max-width: @max-width-search + unit( @size-search-expand / @font-size-browser / @font-size-base, em ); // 37.42857143em @ 16 & 0.875em
|
|
|
|
}
|
|
|
|
|
2021-12-17 22:30:56 +00:00
|
|
|
&.vector-search-box-auto-expand-width .searchButton {
|
2021-12-16 03:13:56 +00:00
|
|
|
// Accounts for the margin that allocates space for the input expanding and
|
|
|
|
// 1px input border.
|
|
|
|
left: @size-search-expand + @border-width-base;
|
|
|
|
}
|
|
|
|
|
2021-12-17 22:30:56 +00:00
|
|
|
&.vector-search-box-auto-expand-width .vector-search-box-input {
|
2021-12-16 03:13:56 +00:00
|
|
|
margin-left: @size-search-expand;
|
|
|
|
width: ~'calc( 100% - @{size-search-expand} )';
|
|
|
|
}
|
|
|
|
|
2022-02-01 20:52:16 +00:00
|
|
|
// Recreate Codex expanding input.
|
2021-12-17 22:30:56 +00:00
|
|
|
&:not( .vector-search-box-auto-expand-width ) .vector-search-box-input,
|
|
|
|
&.vector-search-box-auto-expand-width .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.
|
2022-02-01 20:52:16 +00:00
|
|
|
padding-left: ~'calc( @{padding-left-start-icon} + @{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-12-17 22:30:56 +00:00
|
|
|
&:not( .vector-search-box-auto-expand-width ) .vector-search-box-input ~ .searchButton,
|
|
|
|
&.vector-search-box-auto-expand-width .vector-search-box-input:focus ~ .searchButton {
|
2022-02-01 20:52:16 +00:00
|
|
|
// Derived from @spacing-start-typeahead-icon in Codex
|
|
|
|
// https://gerrit.wikimedia.org/r/plugins/gitiles/design/codex/+/refs/tags/v0.1.0-alpha.8/packages/codex/src/components/typeahead-search/TypeaheadSearch.vue#708
|
|
|
|
@spacing-start-typeahead-icon: 22px;
|
|
|
|
// Codex uses left: @spacing-start-typeahead-icon, but we have to account for the fact
|
|
|
|
// that we made the search button wider and centered the icon in it
|
|
|
|
@size-icon-px: 20px;
|
|
|
|
left: @spacing-start-typeahead-icon - ( @padding-left-start-icon - @size-icon-px ) / 2;
|
2021-05-05 18:27:50 +00:00
|
|
|
}
|
2021-01-26 23:48:20 +00:00
|
|
|
}
|
2020-11-19 17:12:53 +00:00
|
|
|
}
|