@@ -15,7 +15,6 @@ import (
1515 "github.com/macropower/kat/pkg/profile"
1616 "github.com/macropower/kat/pkg/ui/common"
1717 "github.com/macropower/kat/pkg/ui/filepicker"
18- "github.com/macropower/kat/pkg/ui/theme"
1918)
2019
2120const (
@@ -50,7 +49,7 @@ type Commander interface {
5049 FS () (* command.FilteredFS , error )
5150}
5251
53- func NewModel (cmd Commander , t * theme .Theme ) Model {
52+ func NewModel (cmd Commander , t * huh .Theme , km * huh. KeyMap ) Model {
5453 var (
5554 m Model
5655 selectedPath string
@@ -102,60 +101,12 @@ func NewModel(cmd Commander, t *theme.Theme) Model {
102101 ),
103102 ).
104103 WithShowHelp (false ).
105- WithTheme (ThemeToHuhTheme (t ))
104+ WithTheme (t ).
105+ WithKeyMap (km )
106106
107107 return m
108108}
109109
110- func ThemeToHuhTheme (t * theme.Theme ) * huh.Theme {
111- h := huh .ThemeBase ()
112-
113- h .Focused .Base = h .Focused .Base .BorderForeground (t .SelectedStyle .GetForeground ())
114- h .Focused .Card = h .Focused .Base
115- h .Focused .Title = h .Focused .Title .Foreground (t .SelectedStyle .GetForeground ()).Bold (true )
116- h .Focused .NoteTitle = h .Focused .NoteTitle .Foreground (t .SelectedStyle .GetForeground ()).Bold (true ).MarginBottom (1 )
117- h .Focused .Directory = h .Focused .Directory .Foreground (t .SelectedSubtleStyle .GetForeground ())
118- h .Focused .Description = h .Focused .Description .Foreground (t .SelectedSubtleStyle .GetForeground ())
119- h .Focused .ErrorIndicator = h .Focused .ErrorIndicator .Foreground (t .ErrorTextStyle .GetForeground ())
120- h .Focused .ErrorMessage = h .Focused .ErrorMessage .Foreground (t .ErrorTextStyle .GetForeground ())
121- h .Focused .SelectSelector = h .Focused .SelectSelector .Foreground (t .SelectedStyle .GetForeground ())
122- h .Focused .NextIndicator = h .Focused .NextIndicator .Foreground (t .SelectedStyle .GetForeground ())
123- h .Focused .PrevIndicator = h .Focused .PrevIndicator .Foreground (t .SelectedStyle .GetForeground ())
124- h .Focused .Option = h .Focused .Option .Foreground (t .GenericTextStyle .GetBackground ())
125- h .Focused .MultiSelectSelector = h .Focused .MultiSelectSelector .Foreground (t .SelectedStyle .GetForeground ())
126- h .Focused .SelectedOption = h .Focused .SelectedOption .Foreground (t .SelectedStyle .GetForeground ())
127- h .Focused .SelectedPrefix = lipgloss .NewStyle ().
128- Foreground (t .SelectedStyle .GetForeground ()).
129- SetString ("✓ " )
130- h .Focused .UnselectedPrefix = lipgloss .NewStyle ().
131- Foreground (t .SubtleStyle .GetForeground ()).
132- SetString ("• " )
133- h .Focused .UnselectedOption = h .Focused .UnselectedOption .
134- Foreground (t .GenericTextStyle .GetBackground ())
135- h .Focused .FocusedButton = h .Focused .FocusedButton .
136- Foreground (t .LogoStyle .GetForeground ()).
137- Background (t .LogoStyle .GetBackground ())
138- h .Focused .Next = h .Focused .FocusedButton
139- h .Focused .BlurredButton = h .Focused .BlurredButton .
140- Foreground (t .LogoStyle .GetForeground ()).
141- Background (t .SubtleStyle .GetForeground ())
142-
143- h .Focused .TextInput .Cursor = h .Focused .TextInput .Cursor .Foreground (t .SelectedStyle .GetForeground ())
144- h .Focused .TextInput .Placeholder = h .Focused .TextInput .Placeholder .Foreground (t .SubtleStyle .GetForeground ())
145- h .Focused .TextInput .Prompt = h .Focused .TextInput .Prompt .Foreground (t .SelectedStyle .GetForeground ())
146-
147- h .Blurred = h .Focused
148- h .Blurred .Base = h .Focused .Base .BorderStyle (lipgloss .HiddenBorder ())
149- h .Blurred .Card = h .Blurred .Base
150- h .Blurred .NextIndicator = lipgloss .NewStyle ()
151- h .Blurred .PrevIndicator = lipgloss .NewStyle ()
152-
153- h .Group .Title = h .Focused .Title
154- h .Group .Description = h .Focused .Description
155-
156- return h
157- }
158-
159110func (m Model ) Init () tea.Cmd {
160111 return m .form .Init ()
161112}
0 commit comments