diff --git a/browser/components/firefoxview/firefoxview.css b/browser/components/firefoxview/firefoxview.css index 995ebaa60d7b..518b529b24b1 100644 --- a/browser/components/firefoxview/firefoxview.css +++ b/browser/components/firefoxview/firefoxview.css @@ -16,7 +16,6 @@ --fxview-text-color-hover: var(--newtab-text-primary-color); --fxview-primary-action-background: var(--newtab-primary-action-background, #0061e0); --fxview-border: var(--border-color-transparent); - --fxview-border-interactive: var(--border-color-interactive); --fxview-indicator-stroke-color-hover: #deddde; /* ensure utility button hover states match those of the rest of the page */ diff --git a/browser/components/firefoxview/fxview-search-textbox.css b/browser/components/firefoxview/fxview-search-textbox.css deleted file mode 100644 index ac8b7cae3e58..000000000000 --- a/browser/components/firefoxview/fxview-search-textbox.css +++ /dev/null @@ -1,76 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -.search-container { - color: var(--fxview-text-primary-color); - display: inline-flex; - overflow: hidden; - position: relative; - - &:focus-within { - overflow: visible; - } -} - -.search-icon { - background-image: url(chrome://global/skin/icons/search-textbox.svg); - background-position: center; - background-repeat: no-repeat; - background-size: 16px; - fill: currentColor; - -moz-context-properties: fill; - height: 16px; - width: 16px; - position: absolute; - top: 0; - bottom: 0; - margin: auto 0; - padding: 2px; - pointer-events: none; -} - -.search-icon:dir(ltr) { - left: 8px; -} - -.search-icon:dir(rtl) { - right: 8px; -} - -input { - border: 1px solid var(--fxview-border-interactive); - border-radius: var(--border-radius-small); - padding: 8px 32px; - width: 100%; -} - -.clear-icon { - background-image: url(resource://content-accessible/close-12.svg); - background-position: center; - background-repeat: no-repeat; - background-size: 16px; - fill: currentColor; - -moz-context-properties: fill; - cursor: pointer; - height: 16px; - width: 16px; - position: absolute; - top: 0; - bottom: 0; - margin: auto 0; - padding: 2px; -} - -.clear-icon:hover { - background-color: var(--fxview-element-background-hover); - color: var(--fxview-text-color-hover); -} - -.clear-icon:dir(ltr) { - right: 8px; -} - -.clear-icon:dir(rtl) { - left: 8px; -} diff --git a/browser/components/firefoxview/fxview-search-textbox.mjs b/browser/components/firefoxview/fxview-search-textbox.mjs deleted file mode 100644 index 771ca2370a82..000000000000 --- a/browser/components/firefoxview/fxview-search-textbox.mjs +++ /dev/null @@ -1,134 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import { html, ifDefined } from "chrome://global/content/vendor/lit.all.mjs"; -import { MozLitElement } from "chrome://global/content/lit-utils.mjs"; - -const SEARCH_DEBOUNCE_RATE_MS = 500; - -/** - * A search box that displays a search icon and is clearable. Updates to the - * search query trigger a `fxview-search-textbox-query` event with the current - * query value. - * - * There is no actual searching done here. That needs to be implemented by the - * `fxview-search-textbox-query` event handler. `searchTabList()` from - * `search-helpers.mjs` can be used as a starting point. - * - * @property {string} placeholder - * The placeholder text for the search box. - * @property {number} size - * The width (number of characters) of the search box. - * @property {string} pageName - * The hash for the page name that the search input is located on. - */ -export default class FxviewSearchTextbox extends MozLitElement { - static properties = { - placeholder: { type: String }, - size: { type: Number }, - pageName: { type: String }, - autofocus: { type: Boolean }, - }; - - static queries = { - clearButton: ".clear-icon", - input: "input", - }; - - #query = ""; - #searchTimer; - - firstUpdated() { - if (this.autofocus) { - this.focus(); - } - } - - disconnectedCallback() { - super.disconnectedCallback(); - clearTimeout(this.#searchTimer); - } - - focus() { - this.input.focus(); - } - - blur() { - this.input.blur(); - } - - onInput(event) { - this.#query = event.target.value.trim(); - event.preventDefault(); - this.onSearch(); - } - - /** - * Handler for query updates from keyboard input, and textbox clears from 'X' - * button. - */ - onSearch() { - clearTimeout(this.#searchTimer); - this.#searchTimer = setTimeout( - () => this.#dispatchQueryEvent(), - SEARCH_DEBOUNCE_RATE_MS - ); - this.requestUpdate(); - } - - clear(event) { - if ( - event.type == "click" || - (event.type == "keydown" && event.code == "Enter") || - (event.type == "keydown" && event.code == "Space") - ) { - this.#query = ""; - event.preventDefault(); - this.onSearch(); - } - } - - #dispatchQueryEvent() { - window.scrollTo(0, 0); - this.dispatchEvent( - new CustomEvent("fxview-search-textbox-query", { - bubbles: true, - composed: true, - detail: { query: this.#query }, - }) - ); - if (!window.IS_STORYBOOK) { - Glean.firefoxviewNext.searchInitiatedSearch.record({ - page: this.pageName, - }); - } - } - - render() { - return html` - -