From ba17a17224fe5aae359e5ba060082bc3eaf17d62 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 15 Dec 2025 11:03:06 -0800 Subject: [PATCH] style CharacterTypeahead to match Select, use granblueId as value --- .../components/ui/CharacterTypeahead.svelte | 158 ++++++++++++++---- 1 file changed, 128 insertions(+), 30 deletions(-) diff --git a/src/lib/components/ui/CharacterTypeahead.svelte b/src/lib/components/ui/CharacterTypeahead.svelte index b0a287a8..8aab0375 100644 --- a/src/lib/components/ui/CharacterTypeahead.svelte +++ b/src/lib/components/ui/CharacterTypeahead.svelte @@ -3,6 +3,7 @@
+ > + {#snippet toggleIcon(dropdownShow)} + + {/snippet} + {#if isLoading} ... {/if} @@ -129,19 +164,21 @@ @use '$src/themes/colors' as *; @use '$src/themes/typography' as *; @use '$src/themes/layout' as *; + @use '$src/themes/mixins' as *; + @use '$src/themes/effects' as *; .character-typeahead { position: relative; width: 100%; - // Svelecte overrides + // Svelecte CSS variable overrides --sv-bg: var(--input-bg); --sv-border-color: transparent; - --sv-border: 2px solid var(--sv-border-color); - --sv-active-border: 2px solid #{$blue}; + --sv-border: 1px solid var(--sv-border-color); + --sv-active-border: 1px solid #{$blue}; --sv-active-outline: none; --sv-border-radius: #{$input-corner}; - --sv-min-height: calc(#{$unit} * 5.5); + --sv-min-height: #{$unit-4x}; --sv-placeholder-color: var(--text-tertiary); --sv-color: var(--text-primary); @@ -154,27 +191,88 @@ --sv-item-active-bg: var(--option-bg-hover); --sv-item-selected-bg: var(--option-bg-hover); - --sv-icon-color: var(--text-secondary); + --sv-icon-color: var(--text-tertiary); --sv-icon-hover-color: var(--text-primary); &.disabled { opacity: 0.5; pointer-events: none; } + + // Target Svelecte control for hover states + :global(.sv-control) { + padding: calc($unit-half + 1px) $unit calc($unit-half + 1px) $unit-half; + @include smooth-transition($duration-quick, background-color, border-color); + } + + &:hover:not(.disabled) :global(.sv-control) { + background-color: var(--input-bg-hover); + } + + // Contained variant + &.contained { + --sv-bg: var(--select-contained-bg); + + &:hover:not(.disabled) :global(.sv-control) { + background-color: var(--select-contained-bg-hover); + } + } + + // Style the dropdown + :global(.sv_dropdown) { + border: 1px solid rgba(0, 0, 0, 0.1); + max-height: 40vh; + z-index: 102; + } + + // Style dropdown items + :global(.sv-item) { + border-radius: $item-corner-small; + padding: $unit $unit-2x; + gap: $unit; + @include smooth-transition($duration-quick, background-color); + } + + // Style the input text + :global(.sv-input--text) { + font-family: var(--font-family); + } + + // Style the indicator buttons + :global(.sv-btn-indicator) { + color: var(--text-tertiary); + @include smooth-transition($duration-quick, color); + + &:hover { + color: var(--text-primary); + } + } + + // Style our custom chevron icon + :global(.chevron) { + flex-shrink: 0; + color: var(--text-tertiary); + } + + // Hide the separator bar between buttons + :global(.sv-btn-separator) { + display: none; + } } + // Size variants .character-typeahead.small { - --sv-min-height: calc(#{$unit} * 3.5); + --sv-min-height: #{$unit-3x}; --sv-font-size: #{$font-small}; } .character-typeahead.medium { - --sv-min-height: calc(#{$unit} * 5.5); + --sv-min-height: #{$unit-4x}; --sv-font-size: #{$font-regular}; } .character-typeahead.large { - --sv-min-height: calc(#{$unit} * 6.5); + --sv-min-height: calc(#{$unit} * 6); --sv-font-size: #{$font-large}; }