mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 02:02:21 +00:00
Vue kit: UiSearchField for the Context and Layer Finder searches
UiSearchField is the search glyph, a search input with v-model and, with clearLabel, a UiCloseButton shown while text is typed that clears and refocuses. tag is div or label; attributes go to the frame, and inputId, inputClass, autocomplete and spellcheck to the input. Escape stops at the input and is emitted with its event; focus() focuses the input. search-field.css holds the declarations both skins had in common (the frame's flex row, the input's min-width, border and background), moved out of context-dock.css and layer-finder.css and loaded before them. The browser's cancel button stays each skin's own. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
1711b4b456
commit
52dd576769
12 files changed
+303
-23
No files matched your search
@@ -17,7 +17,7 @@ import ViewContext from './panels/ViewContext.vue';
|
||||
import SpaceMissionsPanel from './panels/SpaceMissionsPanel.vue';
|
||||
import RadioPanel from './panels/RadioPanel.vue';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiCloseButton from '../kit/UiCloseButton.vue';
|
||||
import UiSearchField from '../kit/UiSearchField.vue';
|
||||
import { cockpitEntryFace } from '../cockpitPresentation.js';
|
||||
import { LAYER_TABS, TAB_AFFECTS, activeTab, availableTabs, contextReady, enabledLayerIds, setEnabledLayers, tabTarget } from '../contextLayerTabs.js';
|
||||
import { shownLayerName } from '../layerNames.js';
|
||||
@@ -190,11 +190,7 @@ watch(
|
||||
</button>
|
||||
</template>
|
||||
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
|
||||
<div v-if="contextSearchOpen" class="context-search" role="search">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">search</span>
|
||||
<input ref="searchInput" v-model="contextSearchText" type="search" class="context-search__input" :placeholder="searchHint" :aria-label="searchHint" autocomplete="off" spellcheck="false" @keydown.esc.stop="closeContextSearch" />
|
||||
<UiCloseButton v-if="contextSearchText" class="context-search__clear" glyph="icon" :label="t('Clear search')" :title="t('Clear search')" @click="contextSearchText = ''; searchInput?.focus()" />
|
||||
</div>
|
||||
<UiSearchField v-if="contextSearchOpen" ref="searchInput" v-model="contextSearchText" class="context-search" role="search" input-class="context-search__input" :label="searchHint" :placeholder="searchHint" autocomplete="off" spellcheck="false" :clear-label="t('Clear search')" clear-class="context-search__clear" @escape="closeContextSearch" />
|
||||
<div v-if="availableTabs.length" class="context-tabs" role="tablist" :aria-label="t('Context tabs')">
|
||||
<button id="context-tab-btn-view" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">visibility</span><span class="context-tabs__label">{{ t('Inspector') }}</span>
|
||||
|
||||
@@ -22,6 +22,7 @@ const finder = {
|
||||
<script setup>
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref, watch, computed } from 'vue';
|
||||
import { msg, t } from '../../../i18n/index.js';
|
||||
import UiSearchField from '../../kit/UiSearchField.vue';
|
||||
|
||||
// Search and filter for the Data Layers list. The rows are rendered elsewhere
|
||||
// (LayerRows), so this works on the list as it stands: it marks rows that
|
||||
@@ -246,10 +247,7 @@ if (props.part === 'buttons') {
|
||||
</span>
|
||||
</template>
|
||||
<div v-else-if="searching || narrowed" class="layer-finder__bar">
|
||||
<label v-if="searching" class="layer-finder__field">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">search</span>
|
||||
<input id="layer-finder-input" v-model="query" type="search" :placeholder="t('Search layers…')" :aria-label="t('Search layers')" @keydown.esc.stop.prevent="closeSearch" />
|
||||
</label>
|
||||
<UiSearchField v-if="searching" v-model="query" tag="label" class="layer-finder__field" input-id="layer-finder-input" :label="t('Search layers')" :placeholder="t('Search layers…')" @escape="(event) => { event.preventDefault(); closeSearch(); }" />
|
||||
<button v-if="show !== 'all'" type="button" class="layer-finder__chip" @click="show = 'all'">
|
||||
{{ show === 'on' ? t('On') : t('Off') }}<span class="material-symbols-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user